Overview
TheNMISNG module is the central library for NMIS network management operations. It provides access to nodes, events, inventory, and database operations. This is the main entry point for interacting with the NMIS system.
Version: 9.6.5
Location: lib/NMISNG.pm
Constructor
new()
Creates a new NMISNG object instance.Configuration hash containing NMIS configuration
NMISNG::Log object for logging
MongoDB database object. If not provided, automatically connects to database using configuration
Whether to drop unwanted database indices during initialization
List of existing timed collections (created dynamically). Hash of collection name => 1
Test collection names for running tests. Specify with keys like
nodes_test_collection, events_test_collectionReturns NMISNG object on success, dies on error
Core Methods
config()
Returns the configuration hash.Configuration hash reference
log()
Returns the log object.NMISNG::Log object
Node Operations
get_nodes_model()
Retrieves nodes based on filter criteria.Filter criteria (e.g.,
{"activated.NMIS" => 1, group => "Distribution"})Specify which fields to return (e.g.,
{uuid => 1, name => 1})Sort criteria (e.g.,
{name => 1} for ascending)Number of records to skip (pagination)
Maximum number of records to return
ModelData object containing node records. Check
->error for errors, ->count for number of results, ->data for array of recordsnode()
Retrieve or create a node object.Node UUID (for existing node)
Node name (alternative to UUID)
Filter criteria to find node
NMISNG::Node object or undef if not found
get_node_names()
Retrieve node names by UUID.expand_node_selection()
Expands multiple node selection filters sequentially (f1 OR f2).Array of filter hashes
ModelData object with matching active nodes
Inventory Operations
get_inventory_model()
Retrieve inventory items with filtering.Cluster ID to filter by
Node UUID to filter by
Inventory concept (e.g., “interface”, “service”, “catchall”)
Additional filter criteria (e.g.,
{historic => 0, enabled => 1})Specify class instantiation mapping (e.g.,
{concept => \&NMISNG::Inventory::get_inventory_class})ModelData object with inventory records
Event Operations
events()
Returns the events manager object.NMISNG::Events object for event operations
get_events_model()
Retrieve events based on filter criteria.Filter criteria (e.g.,
{node_uuid => $uuid, historic => 0, active => 1})ModelData object with event records
Threshold and Metrics
compute_thresholds()
Computes thresholds for a node.Sys object for the node
Whether running standalone (affects saving behavior)
Force threshold computation even if node is down
compute_all_thresholds()
Computes thresholds for all active nodes.compute_metrics()
Computes overall network metrics for all nodes/groups.Hash with
success (boolean) and optional error (string)Database Maintenance
dbcleanup()
Removes orphaned database records.Simulate cleanup without actually removing records
Hash with
success (boolean), error (string if failed), and info (array of messages)config_backup()
Creates a backup of NMIS configuration.Hash with
success (boolean), optional error (string), and file (backup file path)Collection Accessors
The following methods return MongoDB collection handles:nodes_collection()- Nodes collectionevents_collection()- Events collectioninventory_collection()- Inventory collectionlatest_data_collection()- Latest data collectionqueue_collection()- Job queue collectionopstatus_collection()- Operational status collectionstatus_collection()- Status collection
Utility Methods
get_group_names()
Returns list of all group names.ensure_indexes()
Ensures all database indexes are created.Whether to drop unwanted indexes
Constants
NMISNG module version
See Also
- NMISNG::Node - Node operations
- NMISNG::Inventory - Inventory management
- NMISNG::Events - Event system
- NMISNG::Event - Individual event operations