Internal libraries

The internal libraries had been refactored. 

The basic structure: 

Some replacements in NMIS 8: 

Please, check the internal structure for other libraries. 

Database Access

As the new data backend has been moved from NMIS files to the mongo database, so the node information access is different. 

Here you can find a guide about the main structures and how to replace them: 

Sys::ndinfo  has been replaced by  Sys::nmisng_node  and  Node::nmisng_node  can be accessed directly rather than accessing  Sys::nmisng_node

Get the node

Now it is possible to get the node object using the main object nmisng. 

my $S = NMISNG::Sys->new(nmisng => $nmisng);
my $nodeobj = $nmisng->node(name => $node);

Get the node configuration

The node configuration:

And the node overrides: 

my $conf = $nodeobj->configuration;
my $overrides = $nodeobj->overrides;

Get the node model 

$S->init(node => $nodeobj, snmp => 0);
my $mdl = $S->mdl;

Get the node catchall 

Catchall Is a part of the node inventory and this is where all the main information collected from the node is saved.

The node model, the last poll date, or the health data collected like the sysDescr or the sysLocation: 

my $catchall_data = $S->inventory( concept => 'catchall' )->{_data};

Get the node interfaces

my $sectionIds = $S->nmisng_node->get_inventory_ids(
					concept => "interface",
					filter => { historic => 0 });
	
if (@$sectionIds)
{
				for my $sectionId (@$sectionIds)
				{
					
					my ($section, $error) = $S->nmisng_node->inventory(_id => $sectionId);
					if ($error)
					{
						print "Failed to get inventory $sectionId: $error \n";
						next;
					}
					my $interface = $section->data();
				}
}

Get the node inventory 


			my $sectionIds = $S->nmisng_node->get_inventory_ids(
					concept => $concept,
					filter => { historic => 0 });
	
			if (@$sectionIds)
			{
				for my $sectionId (@$sectionIds)
				{
					my ($section, $error) = $S->nmisng_node->inventory(_id => $sectionId);
					if ($error)
					{
						print "Failed to get inventory $sectionId: $error \n";
						next;
					}
					my $data = $section->data();
				}
			}


Example

/usr/local/nmis9/admin/dev_tests.pl act=show_node node=asgard what=ALL concept=addressTable


Related Documentation