When we accidentally set the scheduled maintenance time for hosts and services in batches, how can we delete them in batches? The following is a script to easily handle the problem ~~~
#! /Bin/bash
# Eg:
#./Del_downtime.sh 877 885 hosts
# Delete the settings of Scheduled Host Downtime from 877 to 885 in the maintenance plan under System -- Downtime
#./Del_downtime.sh 886 894 services
# Delete the settings of Scheduled Service Downtime from 886 to 894 in the maintenance plan under System -- Downtime
If [$3 = "hosts"]; then
For (I = $1; I <= $2; I ++); do echo "\ ['date + % s' \] DEL_HOST_DOWNTIME; $ I ">/usr/local/nagios/var/rw/nagios. cmd; done
Elif [$3 = services]; then
For (I = $1; I <= $2; I ++); do echo "\ ['date + % s' \] DEL_SVC_DOWNTIME; $ I ">/usr/local/nagios/var/rw/nagios. cmd; done
Else
Echo "Input error ...."
Fi
Nagios details: click here
Nagios: click here
Network Monitor Nagios Overview
Nagios construction and Configuration
Build a Nagios monitoring platform in the Nginx Environment
Configure the basic Nagios System on RHEL5.3 (using Nagios-3.1.2)
CentOS 5.5 + Nginx + Nagios monitoring and control terminal installation and Configuration Guide
Install Nagios Core for Ubuntu 13.10 Server