Populate free variables

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hales8181
Posts: 33
Joined: Thu Jan 19, 2017 11:15 am

Populate free variables

Post by hales8181 »

Is it possible for a check to populate a hosts free variables? i.e a check pull back the latest software version for instance and populate the hosts free variable for the software version.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Populate free variables

Post by mcapra »

Not exactly. One way to do that sort of thing would be to leverage the back-end API of Nagios XI. Documentation regarding usage of the back-end API can be found in the "Help" section of your Nagios XI installation.

The gist of the API calls in script form might look like:
  • Get the current host object you want to check the software version of
  • Delete it (because updates aren't implemented yet, we start fresh using the previously grabbed copy)
  • Get the software version from whatever remote system
  • Add it to your host object, maybe under something like _softwareversion
  • Re-create the host
This would result in the changes being "staged" and ready for your next apply config. You could also alter the last call you make to include applyconfig=1 to apply the changes right away.
Former Nagios employee
https://www.mcapra.com/
Locked