Page 1 of 1

Nagios commands for enable/disable/schedule down activities

Posted: Fri Oct 18, 2019 2:54 am
by ibmkenexa
Team,

Can you please provide commands to perform below actions for nagios host/service objects.

Disable - ?
Enable - ?
Schedule downtime - ?

I found below commands to disable/enable notifications. Now i am looking for individual host/service commands. Please help me.

curl -d "cmd_mod=2&cmd_typ=12" "http://[YOUR ADDRESS]/nagios/cgi-bin/cmd.cgi" -u "[YOUR USERNAME]"

curl -d "cmd_mod=2&cmd_typ=11" "http://[YOUR ADDRESS]/nagios/cgi-bin/cmd.cgi" -u "[YOUR USERNAME]"

Re: Nagios commands for enable/disable/schedule down activit

Posted: Fri Oct 18, 2019 5:50 am
by ibmkenexa
I could find commands for disable, enable and schedule down time. Now i am stuck to add multiple hosts to add in that command. Please help me.

curl -k -d "cmd_typ=55&cmd_mod=2&host=XXXXX&start_time=10-18-2019 06:25:00&end_time=10-18-2019 06:30:00&btnSubmit=Commit" "https://0.0.0.0/nagios/cgi-bin/cmd.cgi" -u "xxxxxx"

How to execute command for multiple hosts ?

Re: Nagios commands for enable/disable/schedule down activit

Posted: Fri Oct 18, 2019 9:56 am
by benjaminsmith
Hello @ibmkenexa,

For multiple hosts, this can be accomplished using the hostgroup commands. Take a look at the following commands:

SCHEDULE_HOSTGROUP_HOST_DOWNTIME

DISABLE_HOSTGROUP_HOST_NOTIFICATIONS

You can also send these commands via REST API as well. The API will allow you to schedule downtime using an array of hosts. Go to Help > API Docs > System Reference for documentation.

Let me know if you have any questions.

Re: Nagios commands for enable/disable/schedule down activit

Posted: Fri Nov 08, 2019 2:50 am
by ibmkenexa
How can we use api_key instead of -u user name in below commands

curl -d "cmd_mod=2&cmd_typ=12" "http://[YOUR ADDRESS]/nagios/cgi-bin/cmd.cgi" -u "[YOUR USERNAME]"

curl -d "cmd_mod=2&cmd_typ=11" "http://[YOUR ADDRESS]/nagios/cgi-bin/cmd.cgi" -u "[YOUR USERNAME]"

I was trying to use as below commands but it did not work.

curl -d "cmd_mod=2&cmd_typ=12" "http://[YOUR ADDRESS]/nagios/cgi-bin/cmd.cgi" -d "'api_key=ddddffggghhhhh3664b'"

Re: Nagios commands for enable/disable/schedule down activit

Posted: Fri Nov 08, 2019 9:52 am
by scottwilkerson
You cannot use an API key when calling the cmd.cgi directly, it is only possible if calling the XI API
Much of this can be done if calling the system/corecommand API in XI 5.6.8

Help -> API Docs -> System Reference -> system/corecommand