I'm using NagiosXI (2011R2.4) and we need to be able to change current service checks and to add a new one through API.
For example:
1. I need to add a new URL (check_http) check for existing host and configure the run interval.
2. Change thresholds of specific service check.
I'm familiar with the NagiosXI API, but those are for retrieving data only.
Also, the directly file change is not god as the NagiosXI DB will overwrite them.
Please help to understand if this API is available.
Nagios API to add and change service check
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Nagios API to add and change service check
This API isn't available, however there is a static directory under /usr/local/nagios/libexec that you can put files in that is not overwritten by the database.
You could write files here and then restart nagios for them to take affect
You could write files here and then restart nagios for them to take affect
Re: Nagios API to add and change service check
I have resolved that in the following way.
Nagios is using the named-pipe "/usr/local/nagios/var/rw/nagios.cmd" to run commands (external commands).
I had to pipe a command (for example "SCHEDULE_HOST_SVC_DOWNTIME" for propagated downtime) to this on order to set some services for scheduled downtime.
Also I wrote a small php script (a php file sitting in a directory: /usr/local/pnp4nagios/share) to provide an API for remotely use nagios commands.
working...
Nagios is using the named-pipe "/usr/local/nagios/var/rw/nagios.cmd" to run commands (external commands).
I had to pipe a command (for example "SCHEDULE_HOST_SVC_DOWNTIME" for propagated downtime) to this on order to set some services for scheduled downtime.
Also I wrote a small php script (a php file sitting in a directory: /usr/local/pnp4nagios/share) to provide an API for remotely use nagios commands.
working...