Scheduling Downtime for Bulk services in Nagios core

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
ramakrishnan.a
Posts: 1
Joined: Thu Nov 05, 2020 5:13 am

Scheduling Downtime for Bulk services in Nagios core

Post by ramakrishnan.a »

Hi Team,
We are using Nagios core and being an open source tool, we dont have a direct integration with the ticketing tool.
We do see options to schedule a particular service or a Host under downtime from the settings. However we are looking for options to set bulk services (100-200 servers) into maintenance as a group rather than doing it individually from each service.

As we have both prod and non-prod servers configured under a same host, we are not able to put the entire Host into maintenance as we are looking to put only selected prod servers into maintenance mode. Kindly assist us on the possible options for getting this done.

Many Thanks !!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Scheduling Downtime for Bulk services in Nagios core

Post by benjaminsmith »

Hi,

Thanks for joining the Nagios Community Forum. Glad to have ya! In regards to your questions, here goes :D
However we are looking for options to set bulk services (100-200 servers) into maintenance as a group rather than doing it individually from each service.
Honestly, Nagios XI really shines in this area. That said, I would create host groups for the 100-200 servers and use the command to schedule downtime for entire the host groups.

SCHEDULE_HOSTGROUP_HOST_DOWNTIME
As we have both prod and non-prod servers configured under a same host, we are not able to put the entire Host into maintenance as we are looking to put only selected prod servers into maintenance mode. Kindly assist us on the possible options for getting this done.
I'd have to see the configurations but if you have multiple hosts created for single IP address, again you might just use host groups to schedule downtime for those groups.

Might be an opportunity to use parent-child relationships to help administer these servers in Nagios.

Determining Status and Reachability of Network Hosts

Hope that helps answer your questions.
Benjamin
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!
pomtomm
Posts: 5
Joined: Thu Nov 12, 2020 2:02 pm

Re: Scheduling Downtime for Bulk services in Nagios core

Post by pomtomm »

Check the external command reference regarding

Code: Select all

SCHEDULE_SVC_DOWNTIME
SCHEDULE_HOST_DOWNTIME
DEL_SVC_DOWNTIME
DEL_HOST_DOWNTIME
Basically, you need a (Bash, Perl, Python) loop iterating through your list of hosts and services, writing the appropriate downtime command to the Nagios command pipe (nagios.cmd, check nagios.cfg for the "command_file" setting).

A Perl example would be

Code: Select all

foreach my $service (@list) {
 print NAGCMD "[".time."] SCHEDULE_SVC_DOWNTIME;".$host.";".$service.";".time.";".$end.";1;0;0;".$name.";".$text."\n";
}
NAGCMD is the file handle pointing to your nagios.cmd command pipe.
The downtimes from this example would start immediately (because of the 2nd occurence of "time" with Perl "time" being the current time), you can use any Unix timestamp instead.
$end is the end time (Unix timestamp)
$name and $text are optional (downtime comment)
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Scheduling Downtime for Bulk services in Nagios core

Post by benjaminsmith »

Thanks @pomtomm!
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!
Locked