nagios cmd schedule service downtime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ckruijntjens
Posts: 5
Joined: Wed Oct 16, 2019 3:11 pm

nagios cmd schedule service downtime

Post by ckruijntjens »

Hi all,

I need some help. i am trying to schedule a downtime only for 1 service. However its is scheduling all the host services for downtime. I am using this command

curl -d "cmd_typ=86&cmd_mod=2&host=esx&service=Check Borgbackup Nextcloud&com_data=TestingDowntime&trigger=0&start_time=08-08-2024 01:55:00&end_time=08-08-2024 02:30:00&fixed=1&childoptions=0&btnSubmit=Commit" "http://192.168.2.7/nagios/cgi-bin/cmd.cgi" -u username:password


any ideas?
gwesterman
Posts: 268
Joined: Wed Aug 23, 2023 11:29 am

Re: nagios cmd schedule service downtime

Post by gwesterman »

Hi @ckruijntjens,

If you are using Nagios XI, you can use the API to do something like this. Namely, if you navigate to Help -> Documentation -> API Docs -> System Reference, there are a number of ways to mess with scheduled downtime via the API.

If you would rather stick with this curl, I believe cmd 86 is to schedule host_svc downtime (i.e. schedule downtime for all hosts on a service). I would try cmd_typ=56 for scheduling downtime for a specific service.

Let us know if this works for you and if you have any additional questions.

Thank you!
ckruijntjens
Posts: 5
Joined: Wed Oct 16, 2019 3:11 pm

Re: nagios cmd schedule service downtime

Post by ckruijntjens »

Hi @gwesterman,

How would my commando look like? i am using the community edition of nagios.

kind regards,

Chris
snapier3
Posts: 144
Joined: Tue Apr 23, 2019 7:12 pm

Re: nagios cmd schedule service downtime

Post by snapier3 »

I second the recommendation to try your hand with the API.

In the NagiosXI API you can use the the "System/ScheduleDowntime" endpoint or for more advanced options the "System/CoreCommand" endpoint to interact with XI's downtime workflows for;

SCHEDULE_HOSTGROUP_HOST_DOWNTIME
SCHEDULE_HOSTGROUP_SERVICE_DOWNTIME
SCHEDULE_SERVICEGROUP_HOST_DOWNTIME
SCHEDULE_SERVICEGROUP_SERVICE_DOWNTIME

Be sure to check the Nagios Core external command reference for the variables and the flags needed for use.
https://assets.nagios.com/downloads/nag ... /index.php
ckruijntjens
Posts: 5
Joined: Wed Oct 16, 2019 3:11 pm

Re: nagios cmd schedule service downtime

Post by ckruijntjens »

Perfect

i got it. thank you.
gwesterman
Posts: 268
Joined: Wed Aug 23, 2023 11:29 am

Re: nagios cmd schedule service downtime

Post by gwesterman »

Glad you got it figured out.

If you have any other questions, please reach out.

Thank you!
Locked