Does Nagios has any web API ?

It makes sense to a lot of people to ask if Nagios has an API for external controls. As far as I know there isn’t one that’s well designed.

However, you can either find your way to submit your commands to nagios.cmd file directly Examples, or you can findĀ out the Nagios web URL for the action you need to submit:

1. open your nagios web, go to the service and find the “Service Commands” box.

ScreenHunter_16 Aug. 01 09.23

 

2. Right click on the action you want to perform through API and copy the address. Now you have the full URL for the action to your specific service. eg. the url for Disable active checks of this service is:

http://mynagios.com/nagios/cgi-bin/cmd.cgi?cmd_typ=6&host=test_host&service=firefox1

3. Last you need to find your own way to call this url when you want to disable active check on service “firefox1”.

For Linux you can use:

curl -d “cmd_typ=6&host=test_host&service=firefox1” “http://mynagios.com/nagios/cgi-bin/cmd.cgi” -u <nagiosweb_login>:<nagiosweb_password>

For Windows, use the following VBScritp:
browse_url