Overview
TheNMISNG::Node module represents a single network node in NMIS. It provides methods for node configuration, inventory access, event management, and status reporting.
Version: 9.6.5
Location: lib/NMISNG/Node.pm
Constructor
new()
Creates a new Node object.NMISNG parent object
Node UUID (required for all nodes)
MongoDB _id if loading existing node
Returns Node object, or undef on error
Password encryption/decryption is handled automatically based on the
global_enable_password_encryption configuration setting.Configuration Methods
configuration()
Get or set node configuration.Optional new configuration hash. If provided, marks node as dirty requiring save()
Clone of current configuration hash
active(0/1) - Node is activecollect(0/1) - Enable data collectionping(0/1) - Enable ping monitoringsnmp(0/1) - Enable SNMP collectionnodeType(string) - Node type (router, switch, server)roleType(string) - Node role (core, distribution, access)group(string) - Node grouphost(string) - Hostname or IP addresscommunity(string) - SNMP community stringport(integer) - SNMP port (default 161)version(string) - SNMP version (snmpv1, snmpv2c, snmpv3)threshold(0/1) - Enable thresholdingpolling_policy(string) - Polling policy name
name()
Get node name (read-only after initial set).Node name
To rename a node, use the
rename() method instead of setting name directly.uuid()
Get node UUID (read-only).Node UUID
cluster_id()
Get or set cluster ID.New cluster ID (marks node as dirty)
Current cluster ID
activated()
Get or set node activation status per product.Hash of product names => 0/1 (e.g.,
{NMIS => 1, opCharts => 1})Clone of activation state hash
is_active()
Check if node is configured to be active.Returns 1 if active, 0 otherwise
Node Status
coarse_status()
Returns overall node status.Optional catchall inventory data (avoids lookup if provided)
Returns 1 (reachable), 0 (unreachable), or -1 (degraded)
precise_status()
Returns detailed status information.Hash with keys:
overall(integer): 1 reachable, 0 down, -1 degradedping_enabled(0/1)ping_status(0/1/undef)snmp_enabled(0/1)snmp_status(0/1/undef)wmi_enabled(0/1)wmi_status(0/1/undef)failover_status(0/1/undef)primary_ping_status(0/1/undef)failover_ping_status(0/1/undef)
Inventory Operations
inventory()
Find or create inventory object for this node.Inventory concept (e.g., “interface”, “service”, “catchall”)
Inventory data
Inventory path
Keys to use for path construction
Create inventory if not found
Returns (inventory_object, undef) on success, (undef, error_message) on error, or (undef, undef) if not found and create not specified
get_inventory_model()
Get inventory model for this node.Filter by concept
Additional filter criteria
Class instantiation mapping
ModelData object with inventory records
get_inventory_ids()
Get list of inventory IDs for this node.Filter by concept
Array reference of inventory IDs (may be empty)
inventory_concepts()
Get list of all inventory concepts for this node.Returns (arrayref, undef) on success, (undef, error) on failure
Event Operations
event()
Create an event object for this node.Event name
Event element (optional)
Event level (Normal, Warning, Minor, Major, Critical, Fatal)
Event details
NMISNG::Event object
eventAdd()
Add an event for this node.Returns undef on success, error message on failure
eventExist()
Check if an event exists for this node.Event name
Event element (optional)
Returns event record (hashref) if exists and is active, 0/undef otherwise
eventLoad()
Load detailed event information.Returns (error, event_object)
get_events_model()
Get events model for this node.Additional filter criteria (e.g.,
{historic => 0, active => 1})ModelData object with event records
eventsClean()
Clean all events for this node.Caller identifier for logging
Returns undef on success, error message on failure
Node Lifecycle
save()
Save node configuration to database.Returns (operation_count, error_message). operation_count is 1 for success, 0 for no changes, -1 for error
delete()
Delete node and clean up all associated data.Keep RRD files (don’t delete them)
Metadata for audit logging (who, where, how, details)
Returns (success, message) or (0, error_message)
Deletes node configuration, all inventories, timed data, events, opstatus entries, and optionally RRD files. Deactivates node first if active.
rename()
Rename node and update all file references.New node name
Server name for remote nodes
Whether this is a local node
Returns (success, message) or (0, error_message)
Renames node, relocates RRD files, updates inventories. Cannot rename if name contains ’/’ or doesn’t match
node_name_rule regex. Events are deleted (cannot be renamed sensibly).is_new()
Check if node is new (not yet saved to database).Returns 1 if new, 0 if exists in database
Additional Methods
aliases()
Get or set node aliases.addresses()
Get or set node addresses.comments()
Get or set node comments.overrides()
Get or set configuration overrides.lastupdate()
Get last update timestamp.Unix timestamp of last update
See Also
- NMISNG - Core NMISNG library
- NMISNG::Inventory - Inventory management
- NMISNG::Events - Event system