CentOS 6.5 x64安装Nagios 飞信报警
一.由于运维工作使用的操作系统多是CentOS和Ubuntu,两个系统上面安装的飞信依赖包会有所不同,现在我就安装一下CentOS的fetion
二.安装fetion的一些依赖包 由于fetion需要的是32位系统的包,所以安装的软件名称后面加上.i686(ubuntu软件名称后面是:i386)
[root@localhost ~]#yum install glibc.i686 krb5-libs.i686 libstdc++.i686 zlib.i686
二.下载fetion程序文件
[root@localhost ~]wget http://www.it-adv.net/fetion/downng/fetion20091117-linux.tar.gz
[root@localhost ~]tar zxvf fetion20091117-linux.tar.gz
[root@localhost ~]mv fx/ /usr/local/fetion
[root@localhost ~]cd /usr/local/fetion/
[root@localhost fetion]# ls
cache commands done fetion libACE-5.7.2.so libACE_SSL-5.7.2.so libcrypto.so.4 libeay32.dll libssl.so.4 logs plugins
[root@localhost fetion]#sudo vim /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
/usr/local/fetion
[root@localhost fetion]#sudo ldconfig
三.由于fetion20091117-linux.tar.gz文件里面的fetion文件已经被作者更新,无法使用,所以要重官网下载fetion最新文件,文件下载网址(http://www.linuxidc.net/thread-2952-1-1.html )
[root@localhost ~]chmod +x fetion
[root@localhost ~]mv fetion /usr/sbin/
[root@localhost ~]cp /usr/sbin/fetion /usr/local/fetion/
四.下载更新后的库文件
[root@localhost ~]wget http://www.it-adv.net/fetion/linuxso_20101113.rar
[root@localhost ~]wget http://www.rarsoft.com/rar/rarlinux-3.6.0.tar.gz (rar的解压软件)
[root@localhost ~]tar zxvf rarlinux-3.6.0.tar.gz
[root@localhost ~]cd rar
[root@localhost rar]#make
[root@localhost rar]#cd ..
[root@localhost ~]unrar x linuxso_20101113.rar
[root@localhost ~]cp libACE* libcrypto.so.4 libssl.so.4 /usr/local/fetion/
五.安装完成之后测试,输入完验证码就可以正常发送短信
[root@localhost ~]fetion --mobile=13918016506 --pwd=Aiyou1234 --to=13918016506,13918016506 --msg-utf8="hello world"
要求输入验证码,验证码的路径在/usr/sbin路径下,由于是图片下载到本地查看
六.nagios配置配置飞信报警
Configuration contacts.cfg
define contact (
contact_name admin
alias system admin
host_notification_period 24x7
service_notification_period 24x7
host_notification_options d, r
service_notification_options c, w, r
service_notification_commands notify-service-by-fetion
host_notification_commands notify-host-by-fetion
pager 139xxxxxxxxx
)
Configuration miscommands.cfg file
define command (
command_name notify-host-by-fetion
command_line /usr/sbin/fetion --mobile=139xxxxxxxx --pwd=xxxxxxxx --to=$CONTACTPAGER$ --msg-utf8="Host $ HOSTSTATE $ alert for $ HOSTNAME $! on '$ LONGDATETIME $'"
)
define command (
command_name notify-service-by-fetion
command_line /usr/sbin/fetion --mobile=139xxxxxxxx --pwd=xxxxxxxx --to=$CONTACTPAGER$ --msg-utf8="$ HOSTADDRESS $ $ HOSTALIAS $ / $ SERVICEDESC $ is $ SERVICESTATE $ on $ LONGDATETIME $"
)
Nagios 的详细介绍:请点这里
Nagios 的下载地址:请点这里
相关阅读: