真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Nagios配合飛信發(fā)短信-創(chuàng)新互聯(lián)

nagios的安裝在此頁(yè)面 http://bbotte.blog.51cto.com/6205307/1403997

在灌云等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專(zhuān)注、極致的服務(wù)理念,為客戶(hù)提供成都網(wǎng)站建設(shè)、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需求定制制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),網(wǎng)絡(luò)營(yíng)銷(xiāo)推廣,成都外貿(mào)網(wǎng)站制作,灌云網(wǎng)站建設(shè)費(fèi)用合理。

提示:飛信接口已經(jīng)不可用

nagios要添加飛信報(bào)警功能,盡管網(wǎng)上有很多教程,不過(guò)許多都需要瞎折騰才能正常用飛信,所以下面記錄一下,供參考

系統(tǒng)centos6.4 64位

安裝飛信

下載地址 http://pan.baidu.com/s/1sXpGj 找到linux安裝包 > 飛信 >fetiontar.zip

# unzip fetiontar.zip
# cd fetiontar
# ls
fetion  lib
# mkdir /usr/local/fetion
# cp fetion /usr/local/fetion/
# chmod 755 /usr/local/fetion/fetion

# ls lib/   #lib文件夾下的so文件
ld-2.5.so            libcap.so.1          libcrypt.so.1          libpcre.so.0.0.1
ld-linux.so.2        libcap.so.1.10       libc.so.6              libproc-3.2.7.so
ld-lsb.so.3          libcidn-2.5.so       libeay32.dll           libpthread-2.5.so
ld.so.conf           libcidn.so.1         libnss_ldap-2.5.so     libpthread.so.0
libACE-5.6.5.so      libcom_err.so.2      libnss_ldap.so.2       libssl.so.0.9.7a
libACE-5.6.8.so      libcom_err.so.2.1    libpamc.so.0           libssl.so.0.9.8
libACE-5.7.2.so      libcrypt-2.5.so      libpamc.so.0.81.0      libssl.so.4
libACE_SSL-5.6.5.so  libcrypto.so.0.9.7a  libpam_misc.so.0       libstdc++.so.6
libACE_SSL-5.6.8.so  libcrypto.so.0.9.8   libpam_misc.so.0.81.2  libstdc++.so.6.0.8
libACE_SSL-5.7.2.so  libcrypto.so.0.9.8b  libpam.so.0            readme
libc-2.5.so          libcrypto.so.4       libpam.so.0.81.5
libcap.so            libcrypto.so.6       libpcre.so.0

設(shè)置fetion的庫(kù)文件

# cp -r lib/ /lib64/fetion
# vim /etc/ld.so.conf.d/fetion.conf
/lib64/fetion

# ldconfig -v|grep fetion
ldconfig: /etc/ld.so.conf.d/kernel-2.6.32-431.11.2.el6.x86_64.conf:6: duplicate hwcap 1 nosegneg
ldconfig: /lib64/fetion/libstdc++.so.6 is not a symbolic link
ldconfig: /lib64/fetion/libpamc.so.0 is not a symbolic link
ldconfig: /lib64/fetion/libpam_misc.so.0 is not a symbolic link
ldconfig: /lib64/fetion/libpcre.so.0 is not a symbolic link
ldconfig: /lib64/fetion/ld-linux.so.2 is not a symbolic link
ldconfig: /lib64/fetion/libcom_err.so.2 is not a symbolic link
ldconfig: /lib64/fetion/libcap.so.1 is not a symbolic link
ldconfig: /lib64/fetion/libpam.so.0 is not a symbolic link
/lib64/fetion:

查看缺少哪些庫(kù),然后依次安裝

# ldd /usr/local/fetion/fetion 
linux-gate.so.1 =>  (0x00e41000)
libACE-5.7.2.so => /lib64/fetion/libACE-5.7.2.so (0x007ec000)
libACE_SSL-5.7.2.so => /lib64/fetion/libACE_SSL-5.7.2.so (0x002ad000)
libssl.so.4 => /lib64/fetion/libssl.so.4 (0x0069d000)
libstdc++.so.6 => /lib64/fetion/libstdc++.so.6 (0x004f8000)
libm.so.6 => /lib/libm.so.6 (0x00c7d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00dfe000)
libc.so.6 => /lib/libc.so.6 (0x002c2000)
libcrypto.so.4 => /lib64/fetion/libcrypto.so.4 (0x03e4a000)
librt.so.1 => /lib/librt.so.1 (0x001d0000)
libdl.so.2 => /lib/libdl.so.2 (0x001d9000)
libgssapi_krb5.so.2 => not found
libkrb5.so.3 => not found
libcom_err.so.2 => /lib64/fetion/libcom_err.so.2 (0x001de000)
libk5crypto.so.3 => not found
libresolv.so.2 => /lib/libresolv.so.2 (0x001e1000)
/lib/ld-linux.so.2 (0x0070f000)
libz.so.1 => not found
libgssapi_krb5.so.2 => not found
libkrb5.so.3 => not found
libk5crypto.so.3 => not found
libz.so.1 => not found
libpthread.so.0 => /lib/libpthread.so.0 (0x0079e000)

如果缺少libgcc_s.so.1,出現(xiàn)下面情況,那么 yum install libgcc_s.so.1

# /usr/local/fetion/fetion 
/usr/local/fetion/fetion: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory

# yum install krb5-libs libgssapi_krb5.so.2 libz.so.1 -y
# /usr/local/fetion/fetion 
 ************************ IMPORTANT STATEMENT ************************
 **                                                                 **
 **   PLEASE DON'T USE THIS SOFTWARE TO SEND JUNK SHORT MESSAGES.   **
 **   OTHERWISE PLEASE BEAR YOUR OWN CONSEQUENCES.                  **
 **                                                                 **
 **                                Version:[20101205002-linux]      **
 *********************************************************************
 This program is the console version of China Fetion!
 It's free for personal user.
 This project website: http://www.it-adv.net/
 AUTHOR:KelvinH MSN/EMAIL:shichangguo@msn.com
 Usage:
    --mobile=[mobile]
    --sid=[sid]
    --pwd=[pwd]
    --config=[config file] *format:index mobile password
    --index=[index no in config file,refer to sample.conf]
    --debug  *debug mode on
    --hide  *login fetion in hidden state
    --to=[mobile/sid]
    --command-path=[command file path]
    --robotmode
    --daemon(linux only)
    --proxy-ip(http proxy ip)
    --proxy-port(http proxy port)
    --msg-gb=[gb2312/gbk message]
    --msg-utf8=[utf8 message]
    --msg-type=[0/1/2 sms longsms smartmsg]
    --file-gb=[gb2312/gbk file]
    --file-utf8=[utf8 file]
    --query-cmcc-no
    --auto-retry
    --exit-on-verifycode
    --t3key=[http://www.tui3.com/page/smssend/]

ok,飛信已經(jīng)安裝好了,下面測(cè)試

# /usr/local/fetion/fetion --mobile=你的手機(jī)號(hào) --pwd=飛信密碼 --to=對(duì)方的手機(jī)號(hào) --msg-utf8="hello  hero"

HTTP/1.1 200 OK

Connection: close

Date: Sat, 23 Aug 2014 09:50:19 GMT

Server: Microsoft-IIS/6.0

X-Powered-By: ASP.NET

Content-Location: nav.fetion.com.cn

X-AspNet-Version: 4.0.30319

Cache-Control: private

Content-Type: text/html; charset=utf-8

Content-Length: 2473

#這里是提示輸入驗(yàn)證碼,驗(yàn)證碼到目錄,即下面的手機(jī)號(hào).jpg 文件

# cd /usr/local/fetion/

# ls

1591425****.cache  1591425****.jpg  fetion

Nagios配合飛信發(fā)短信

下面就可以給飛信的好友發(fā)送信息了

# /usr/local/fetion/fetion --mobile=1591425**** --pwd=****** --to=****** --msg-utf8="hello  hero,you are a man"

SIP-C/4.0 280 Send SMS OK

T: sip:1056282019@fetion.com.cn;p=7019

I: 3

Q: 1 M

RQ: 56602213092

L: 112

XI: 7df854ffd4ff4abeb840b878110fec25

----以上確定飛信可以正常使用,下面詳細(xì)說(shuō)明配置內(nèi)容----

下面幾個(gè)配置文件相互關(guān)聯(lián),commands.cfg中定義飛信發(fā)送短信的命令,contacts.cfg中說(shuō)明發(fā)送短信的用戶(hù)和組,templates.cfg定義觸發(fā)后要執(zhí)行的動(dòng)作,比如發(fā)飛信或郵件,什么時(shí)候發(fā),用那個(gè)用戶(hù)發(fā)送,timeperiods.cfg定義時(shí)間,工作日或者7x24,這里我使用默認(rèn)的7x24,linuxhost.cfg為自己創(chuàng)建的文件,定義監(jiān)控的服務(wù)和主機(jī),監(jiān)控的動(dòng)作

cd /usr/local/nagios/etc/objects
commands.cfg    #定義飛信的發(fā)送命令
define command {
  command_name notify-host-by-fetion
  command_line /usr/local/fetion/fetion --mobile=1591425**** --pwd=123456 --to=1591425**** --msg-utf8="$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"  --msg-type=1
}
define command {
  command_name notify-service-by-fetion
  command_line /usr/local/fetion/fetion --mobile=1591425**** --pwd=123456 --to=1591425**** --msg-utf8="$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n"   --msg-type=1
}

contacts.cfg   #創(chuàng)建用戶(hù)和用戶(hù)組,定義使用飛信發(fā)送通知信息
define contact{
        contact_name                        linux
        use                                 linux-contact
        alias                               linux server1
        service_notification_period         24x7
        host_notification_period            24x7
        service_notification_options        w,u,c,r,f,s
        host_notification_options           d,u,r,f,s
        service_notification_commands       notify-service-by-fetion
        host_notification_commands          notify-host-by-fetion
        }
define contactgroup{
        contactgroup_name           linux
        alias                       linux group1
        members                     linux
        }
templates.cfg    #在模板中定義檢測(cè)后所要執(zhí)行的選擇
define contact{
        name                            linux-contact
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r,f,s
        host_notification_options       d,u,r,f,s
        service_notification_commands   notify-service-by-fetion
        host_notification_commands      notify-host-by-fetion
        register                        0
        }
define host{
        name                            mylinux-server   
        use                             generic-host    
        check_period                    24x7            
        check_interval                  5               
        retry_interval                  1               
        max_check_attempts              10              
        check_command                   check-host-alive
        notification_period             24x7                                                                                                                  
        notification_interval           120             
        notification_options            d,u,r           
        contact_groups                  linux    
        register                        0               
        }
define service{
        name                            linux-service
        active_checks_enabled           1
        passive_checks_enabled          1
        parallelize_check               1
        obsess_over_service             1
        check_freshness                 0
        notifications_enabled           1
        event_handler_enabled           1
        flap_detection_enabled          1
        failure_prediction_enabled      1
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           1
        retry_check_interval            2
        contact_groups                  linux
        notification_options            w,u,c,r
        notification_interval           60
        notification_period             24x7
         register                        0
        }
linuxhost.cfg     #定義主機(jī)和監(jiān)控的服務(wù)
define host{
        use                     mylinux-server           
        host_name               webserver1
        alias                   webserver1
        address                 192.168.22.241
        }
define hostgroup{
        hostgroup_name  group1 
        alias           Linux group1 
        members         webserver1    
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check users
        check_command                   check_nrpe!check_users
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check load
        check_command                   check_nrpe!check_load
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check zombie proce
        check_command                   check_nrpe!check_zombie_procs
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check total proce
        check_command                   check_nrpe!check_total_procs
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check rootdisk
        check_command                   check_nrpe!check_rootdisk
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check swap
        check_command                   check_nrpe!check_swap
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check sda1
        check_command                   check_nrpe!check_sda1
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check sda3
        check_command                   check_nrpe!check_sda3
        }
define service{
        use                             linux-service
        host_name                       webserver1
        service_description             check mysql
        check_command                   check_nrpe!check_mysql
        }

測(cè)試service發(fā)送短信

被監(jiān)控端user設(shè)置 check_users -w 3 -c 3 現(xiàn)在5人登錄,稍后再登出

nagios日志,SERVICE NOTIFICATION: linux;webserver1;check users;CRITICAL;notify-service-by-fetion;USERS CRITICAL - 5 users currently logged in

[1409704648] SERVICE ALERT: webserver1;check users;CRITICAL;SOFT;1;USERS CRITICAL - 4 users currently logged in
[1409704768] SERVICE ALERT: webserver1;check users;CRITICAL;SOFT;2;USERS CRITICAL - 5 users currently logged in
[1409704888] SERVICE ALERT: webserver1;check users;CRITICAL;HARD;3;USERS CRITICAL - 5 users currently logged in
[1409704888] SERVICE NOTIFICATION: linux;webserver1;check users;CRITICAL;notify-service-by-fetion;USERS CRITICAL - 5 users currently logged in
[1409704948] SERVICE ALERT: webserver1;check users;OK;HARD;3;USERS OK - 1 users currently logged in
[1409704948] SERVICE NOTIFICATION: linux;webserver1;check users;OK;notify-service-by-fetion;USERS OK - 1 users currently logged in

測(cè)試host發(fā)送短信:

把被監(jiān)控端關(guān)機(jī)的nagios日志,HOST NOTIFICATION: linux;webserver1;DOWN;notify-host-by-fetion;CRITICAL - Host Unreachable (192.168.22.241)

[1409705298] HOST ALERT: webserver1;DOWN;HARD;10;CRITICAL - Host Unreachable (192.168.22.241)
[1409705298] HOST NOTIFICATION: linux;webserver1;DOWN;notify-host-by-fetion;CRITICAL - Host Unreachable (192.168.22.241)
[1409705307] Warning: Return code of 255 for check of service 'check sda3' on host 'webserver1' was out of bounds.
[1409705307] SERVICE ALERT: webserver1;check sda3;UNKNOWN;HARD;3;(Return code of 255 is out of bounds)
[1409705310] Warning: Return code of 255 for check of service 'check users' on host 'webserver1' was out of bounds.
[1409705310] SERVICE ALERT: webserver1;check users;UNKNOWN;HARD;3;(Return code of 255 is out of bounds)
[1409705313] Warning: Return code of 255 for check of service 'check load' on host 'webserver1' was out of bounds.
[1409705313] SERVICE ALERT: webserver1;check load;UNKNOWN;HARD;3;(Return code of 255 is out of bounds)
[1409705319] SERVICE ALERT: webserver1;check sda1;OK;HARD;3;DISK OK - free space: /boot 158 MB (86% inode=99%):
[1409705331] SERVICE ALERT: webserver1;check swap;OK;HARD;3;DISK OK - free space: / 17097 MB (91% inode=94%): /dev/shm 245 MB (100% inode=99%): /boot 158 MB (86% inode=99%):
[1409705335] SERVICE ALERT: webserver1;check zombie proce;OK;HARD;3;PROCS OK: 0 processes with STATE = Z
[1409705335] HOST ALERT: webserver1;UP;HARD;1;PING OK - Packet loss = 0%, RTA = 0.79 ms
[1409705335] HOST NOTIFICATION: linux;webserver1;UP;notify-host-by-fetion;PING OK - Packet loss = 0%, RTA = 0.79 ms
[1409705338] SERVICE ALERT: webserver1;check rootdisk;OK;HARD;3;DISK OK - free space: / 17097 MB (91% inode=94%):

無(wú)圖無(wú)真相

Nagios配合飛信發(fā)短信

Nagios配合飛信發(fā)短信

Nagios配合飛信發(fā)短信

Nagios配合飛信發(fā)短信

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線(xiàn),公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。


網(wǎng)頁(yè)名稱(chēng):Nagios配合飛信發(fā)短信-創(chuàng)新互聯(lián)
網(wǎng)站網(wǎng)址:http://weahome.cn/article/dhdied.html

其他資訊

在線(xiàn)咨詢(xún)

微信咨詢(xún)

電話(huà)咨詢(xún)

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部