您好,登錄后才能下訂單哦!
當我們誤操作,批量設置了主機和服務的計劃維護時間,如何批量刪除呢?下面通過一個腳本輕松搞定~~~
#!/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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。