zorkian / nagios-api

A REST-like, JSON interface to Nagios
BSD 3-Clause "New" or "Revised" License
586 stars 173 forks source link

nagios-api | schedule_downtime does not seem to take any actions on the server side #93

Open gthosani1 opened 5 years ago

gthosani1 commented 5 years ago

Hello Folks,

I have written a wrapper to run schedule downtime from the client-side. It used to work sometime back (scheduling downtime on nagios server) but at the moment it does not. The wrapper executes the command successfully from the client side as follows:

XXXXXX@XXXXXX:/$ sudo python nagios.py -host XXXXXXXX -D 61 -v Nagios server='NAGIOS_SERVER' found for datacenter='XXX' NAGIOS_HOST - Making HTTP POST request to url='http://NAGIOS_SERVER:NAGIOS_API_PORT/schedule_downtime' with payload='{'duration': 61, 'comment': None, 'host': 'XXXXXXXX', 'author': 'root', 'services_too': True}', headers='{'content-type': 'application/json'}', retries='Retry(total=3, connect=None, read=None, redirect=None)' CLIENT_HOST - Completed successfully HTTP POST call with return status='200' and resp length=77 bytes Nagios downtime_notification completed on host=XXXXXXXX for duration=61 seconds in time=0 secs

I did run it from command line and this is the output curl -d '{"host": "XXXXXXXX", "duration": 61}' -H 'Content-Type: application/json' http://NAGIOS_SERVER:NAGIOS_API_PORT/schedule_downtime {"content": "External commands not enabled on nagios-api.", "success": false}

May be I m missing something, can you please help figure what could be the issue Appreciate your prompt reply soon

Thanks

zorkian commented 5 years ago

This error means you're not passing in the -c flag to point a Nagios external command file. Without this flag, the Nagios API service doesn't know how to submit commands to Nagios.

NiniiGit commented 4 years ago

Hi , can someone help me to know how i can use this api to find out last schedule down time from history of server if i pass Server name as a host