...
How to access the information in NMIS9
The following all assumes the following function initialization
Code Block |
---|
my (%args) = @_;
my ($node, $S, $C, $NG) = @args{qw(node sys config nmisng)}; |
Nodes
We can access the node object using the object sys:
...
Code Block |
---|
$NG->log->info("Working on $node Host Memory Calculations"); |
Installation
Just place the plugin into /usr/local/nmis9/conf/plugins and make sure it has the right permissions.
To fix permissions you can just run:
Code Block |
---|
/usr/local/nmis9/bin/nmis-cli act=fixperms |
You can test the plugin by running an update/collect for a node and check the log files (/usr/local/nmis9/logs/nmis.log).
You will see an info message like this:
Code Block |
---|
[Mon May 24 16:12:09 2020] [info] Host_Resources[8027] Running Host Resources plugin for node::test |
Example
You can see a complete example of a collect plugin in the Host_Resources plugin (Released in 9.1.2). . There are many more plugins added to the NMIS9 project.
Porting Plugins from NMIS8 to NMIS9
Existing plugins in NMIS8 were ported to NMIS9, so there are many good examples on the changes to the API calls required. You can find all the ported and any new plugins in GitHub here: https://github.com/Opmantek/nmis9/tree/nmis9_dev/conf-default/plugins
Review the NMIS8 Host_Resources and NMIS9 Host_Resources plugin as a way to see how to easily port one.
If you have a support contract and need some assistance to port your plugin, you can open a support case: FirstWave Support