Nagios中用飞信发送报警信息
Posted by devon on December 4th, 2009 filed in 部署与优化近期由于飞信的API变更,原先的Linux版本fetion程序不能再用来发送信息了。而由 flyerhzm 开发的rfetion更新较快,可用来配合Nagios的报警信息发送。
rfetion是基于ruby的一个飞信客户端工具,有命令行的发送模式。使用前,需事先安装好 ruby,及rubygem,相关安装过程在网上有很多。
安装好ruby及rubygem后,可通过如下两行命令来安装rfetion:
1 2 | gem sources -a http://gemcutter.org sudo gem install rfetion |
在nagios中增加用飞信发送报警信息的命令。需要注意的是rfetion可执行文件的路径/usr/local/ruby/bin/rfetion在不同平台可能会稍有区别,请根据自己的实际情况处理。同时,命令中的手机号与密码需要修改为对应的用于发送通知的飞信手机号码与密码。
1 2 3 4 5 6 7 8 9 | define command { command_name host-notify-by-sms command_line /usr/local/ruby/bin/rfetion --silence -m 18888888888 -p my_password -f $CONTACTPAGER$ -c "Host $HOSTSTATE$ alert for $HOSTNAME$! on $SHORTDATETIME$" } define command { command_name service-notify-by-sms command_line /usr/local/ruby/bin/rfetion --silence -m 18888888888 -p my_password -f $CONTACTPAGER$ -c "'$HOSTADDRESS$' $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ on $SHORTDATETIME$" } |
在对应的的contact定义里,定义报警信息发送使用service-notify-by-sms、host-notify-by-sms,并在pager一行中写入待通知的手机号码。
1 2 3 4 5 6 7 8 9 10 | define contact{ contact_name henry use generic-contact alias heyry service_notification_commands service-notify-by-sms host_notification_commands host-notify-by-sms email demo@demo.gmail pager 18666666666 } |
重新加载nagios后,报警信息即可通过飞信来发送。
rfetion还有其它更强大的功能,具体信息可通过 rfetion api and source code
Related posts:
- Nginx boot script 目的:让nginx随服务器启动 操作系统: Linux localhost.localdomain 2.6.9-42.ELsmp #1 SMP Wed Jul 12...
Related posts brought to you by Yet Another Related Posts Plugin.
December 18th, 2010 at 3:34 AM
████████►BUY VIAGRA◀███████…
████████▲▲▲▲▲▲▲▲▲████████…
December 21st, 2010 at 1:46 AM
abilify side effects in children…
Buydrugs without prescription…
December 26th, 2010 at 12:16 AM
rxlist@abilify.now” rel=”nofollow”>..…
Buydrugs without prescription…
December 29th, 2010 at 5:37 AM
Advair@official.site” rel=”nofollow”>.…
Buynow it…
December 30th, 2010 at 11:47 PM
Ampicillin@official.site” rel=”nofollow”>.…
Buynow it…
December 31st, 2010 at 3:33 PM
..…
Buygeneric drugs…
January 1st, 2011 at 9:31 PM
Augmentin@official.site” rel=”nofollow”>.…
Buywithout prescription…
January 2nd, 2011 at 6:06 AM
Clonidine@official.site” rel=”nofollow”>……
Buynow…
January 2nd, 2011 at 6:12 PM
celexa@canada.now” rel=”nofollow”>.…
Buynow…
January 17th, 2011 at 7:23 PM
Abilify@official.site” rel=”nofollow”>……
Buynow…
February 5th, 2011 at 5:08 PM
Zocor…
Buygeneric meds…
February 7th, 2011 at 1:10 PM
dog zyrtec…
Buygeneric drugs…
February 8th, 2011 at 1:39 AM
Vytorin…
Buynow…
March 3rd, 2011 at 12:48 PM
Zyvox…
Buydrugs without prescription…
March 3rd, 2011 at 1:55 PM
lioresal online…
Buygeneric drugs…
March 4th, 2011 at 8:38 PM
Zyprexa…
Buydrugs without prescription…
March 5th, 2011 at 12:46 PM
Rogaine…
Buygeneric meds…
March 9th, 2011 at 3:22 PM
howard county purim carnival 2010…
Buyno prescription…
March 10th, 2011 at 2:24 AM
Risperdal…
Buygeneric pills…
March 11th, 2011 at 2:11 PM
low dose haldol and paxil…
Buygeneric drugs…
March 29th, 2011 at 10:06 PM
Tri@Cyclen.now” rel=”nofollow”>……
Buyno prescription…
March 30th, 2011 at 5:47 AM
Soma@Soma.Soma” rel=”nofollow”>.…
Buyno prescription…
March 30th, 2011 at 11:16 PM
Purim@Purim.Purim” rel=”nofollow”>……
Buygeneric drugs…
March 31st, 2011 at 7:51 AM
Singulair@Singulair.Singulair” rel=”nofollow”>……
Buygeneric pills…
March 31st, 2011 at 9:30 AM
Prozac@Prozac.Prozac” rel=”nofollow”>.…
Buygeneric pills…
April 3rd, 2011 at 12:44 AM
allegra@print.colorado.springs” rel=”nofollow”>……
Buygeneric drugs…
April 5th, 2011 at 1:49 AM
alternatives@to.premarin” rel=”nofollow”>……
Buygeneric pills…
April 5th, 2011 at 1:01 PM
altace@generic.name” rel=”nofollow”>.…
Buynow it…