Nagios API to add and change service check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
micatwix
Posts: 36
Joined: Sun Jun 13, 2010 4:24 am

Nagios API to add and change service check

Post by micatwix »

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.
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

Post by scottwilkerson »

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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
micatwix
Posts: 36
Joined: Sun Jun 13, 2010 4:24 am

Re: Nagios API to add and change service check

Post by micatwix »

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...
Locked