自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Nagios飛信linux短信報警腳本配置

運維 系統(tǒng)運維
Nagios飛信linux短信報警腳本配置:Nagios是一個監(jiān)視系統(tǒng),它可以監(jiān)視系統(tǒng)運行狀態(tài)和網(wǎng)絡(luò)信息。Nagios能監(jiān)視所指定的本地、遠程主機以及服務、異常通知等。本文講述的是Nagios飛信linux短信報警腳本配置。

  Nagios飛信linux短信報警腳本配置

  1.編寫發(fā)送腳本

  1.   vi sendsms.sh  
  2.  
  3.   #!/bin/bash  
  4.  
  5.   fetionDir=/usr/local/fetion/  
  6.  
  7.   cd $fetionDir  
  8.  
  9.   DIR=`pwd`  
  10.  
  11.   user=13724506486 
  12.  
  13.   pwd=gjb88888 
  14.  
  15.   for phone in `cat $DIR/phonelist.txt`  
  16.  
  17.   do  
  18.  
  19.   echo "$phone" | sed ‘/^[ \t]*$/d’ | sed ‘s/^[ \t]*//’ | sed ‘s/[ \t]*$//’ | grep ‘^1[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]‘  
  20.  
  21.   if (($? == 0 ));then  
  22.  
  23.   if [[ -f $DIR/msg.txt ]];then  
  24.  
  25.   echo "================" >> msg.txt  
  26.  
  27.   fi  
  28.  
  29.   phone=`echo "$phone" | sed ‘s/^[ \t]*//’ | sed ‘s/[ \t]*$//’`  
  30.  
  31.   echo "sms $phone $1" >> $DIR/msg.txt  
  32.  
  33.   echo "quit" >> $DIR/msg.txt  
  34.  
  35.   $fetionDir/fetion –mobile=$user –pwd=$pwd –to=$phone –msg-utf8="$1" 
  36.  
  37.   else  
  38.  
  39.   continue  
  40.  
  41.   fi  
  42.  
  43.   done  
  44.  

  2.接收者電話號碼Nagios飛信

  1.   vi /usr/local/fetion/phonelist.txt  
  2.  
  3.   #hugwww  
  4.  
  5.   13724506486  
  6.  

  3.修改飛信目錄權(quán)限(否則運行Nagios的用戶不能寫入信息內(nèi)容到/usr/local/fetion/msg.txt)

  1.   chown -R nagios.nagios /usr/local/fetion  
  2.  
  3.   chmod +x /usr/local/fetion/sendsms.sh  
  4.  

  4.配置Nagios飛信

  1.   vi commands.cfg  
  2.  
  3.   ###################################################################  
  4.  
  5.   #  
  6.  
  7.   # notify-host-by-sendmsg/notify-service-by-sendmsg //定義發(fā)送飛信報警的命令  
  8.  
  9.   #  
  10.  
  11.   ###################################################################  
  12.  
  13.   define command {  
  14.  
  15.   command_name notify-host-by-fetion  
  16.  
  17.   command_line /usr/local/fetion/sendsms.sh "Host $HOSTSTATE$ alert for $HOSTNAME$($HOSTADDRESS$) on $TIME$."  
  18.  
  19.   }  
  20.  
  21.   define command {  
  22.  
  23.   command_name notify-service-by-fetion  
  24.  
  25.   command_line /usr/local/fetion/sendsms.sh ""$TIME$":$SERVICEDESC$($HOSTADDRESS$) is $SERVICESTATE$."  
  26.  
  27.   }  
  28.  

  5.Nagios飛信定義聯(lián)系人

  1.   vi contacts.cfg  
  2.  
  3.   define contact {  
  4.  
  5.   contact_name admin  
  6.  
  7.   alias system admin  
  8.  
  9.   host_notification_period 24×7  
  10.  
  11.   service_notification_period 24×7  
  12.  
  13.   host_notification_options d,r  
  14.  
  15.   service_notification_options w,u,c,r  
  16.  
  17.   service_notification_commands notify-service-by-email,notify-service-by-fetion  
  18.  
  19.   host_notification_commands notify-host-by-email,notify-host-by-fetion  
  20.  
  21.   email hugwww@115.com  
  22.  
  23.   pager 13724506486  
  24.  
  25.   }  
  26.  

  6.測試Nagios飛信故障時是否能夠觸發(fā)短信報警

  1.   /usr/local/fetion/sendsms.sh "nagios Host alert"  
  2.  

  Nagios飛信linux短信報警腳本配置完成!

【編輯推薦】

Nagios不發(fā)報警短信問題的解決

用Nagios來監(jiān)控網(wǎng)絡(luò)服務器-nagios配置

使用Nagios實現(xiàn)網(wǎng)絡(luò)監(jiān)控

責任編輯:zhaolei 來源: gaojinbo
相關(guān)推薦

2011-03-24 10:08:42

Nagios飛信Linux

2011-03-23 13:32:14

Nagios飛信

2011-03-24 13:00:31

Nagios飛信

2010-05-31 09:06:12

Nagios飛信

2011-03-25 13:10:08

2011-03-24 09:15:54

Nagios飛信

2011-03-23 12:55:51

NagiosMSN飛信

2011-03-23 09:07:50

Nagios短信

2011-04-06 14:24:18

2011-03-22 16:31:27

Nagios

2011-03-24 08:56:23

escalationsNagios報警

2014-03-12 16:09:21

Zabbix短信報警

2009-12-23 19:13:40

Fedora Linu

2011-03-24 08:56:21

Nagios郵件

2011-03-25 14:56:43

Nagiosescalations

2011-03-21 15:44:52

escalationsNagios

2010-03-10 12:59:08

Linux安裝飛信

2011-04-01 17:01:11

Zabbix短信

2011-03-23 14:43:09

2014-08-06 15:25:36

LinuxNagios
點贊
收藏

51CTO技術(shù)棧公眾號