Page 1 of 1
Populate free variables
Posted: Fri Feb 17, 2017 4:49 am
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.
Re: Populate free variables
Posted: Fri Feb 17, 2017 2:26 pm
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.