Nagios commands for enable/disable/schedule down activities

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ibmkenexa
Posts: 28
Joined: Wed Feb 13, 2019 4:05 am

Nagios commands for enable/disable/schedule down activities

Post 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]"
ibmkenexa
Posts: 28
Joined: Wed Feb 13, 2019 4:05 am

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

Post 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 ?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
ibmkenexa
Posts: 28
Joined: Wed Feb 13, 2019 4:05 am

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

Post 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'"
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

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

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked