当我们误操作,批量设置了主机和服务的计划维护时间,如何批量删除呢?下面通过一个脚本轻松搞定~~~
#!/bin/bash
#eg: # ./Del_downtime.sh 877 885 hosts # 删除System--Downtime下的维护计划中Scheduled Host Downtime从877到885项设置
# ./Del_downtime.sh 886 894 services # 删除System--Downtime下的维护计划中Scheduled Service Downtime从886到894项设置
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
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。