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:

  1. 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.


28 Responses to “Nagios中用飞信发送报警信息”

  1. EVAN Says:

    ████████►BUY VIAGRA◀███████…

    ████████▲▲▲▲▲▲▲▲▲████████…

  2. LONNIE Says:

    abilify side effects in children

    Buydrugs without prescription…

  3. ANTHONY Says:

    rxlist@abilify.now” rel=”nofollow”>..

    Buydrugs without prescription…

  4. EUGENE Says:

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  5. KELLY Says:

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  6. LARRY Says:

    ..

    Buygeneric drugs…

  7. ALBERTO Says:

    Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  8. RICK Says:

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  9. RICK Says:

    celexa@canada.now” rel=”nofollow”>.

    Buynow…

  10. DOUGLAS Says:

    Abilify@official.site” rel=”nofollow”>…

    Buynow…

  11. CLINTON Says:

    Zocor

    Buygeneric meds…

  12. REGINALD Says:

    dog zyrtec

    Buygeneric drugs…

  13. STUART Says:

    Vytorin

    Buynow…

  14. ALFONSO Says:

    Zyvox

    Buydrugs without prescription…

  15. ISAAC Says:

    lioresal online

    Buygeneric drugs…

  16. CHAD Says:

    Zyprexa

    Buydrugs without prescription…

  17. CHRIS Says:

    Rogaine

    Buygeneric meds…

  18. TERRANCE Says:

    howard county purim carnival 2010

    Buyno prescription…

  19. AARON Says:

    Risperdal

    Buygeneric pills…

  20. ROBERTO Says:

    low dose haldol and paxil

    Buygeneric drugs…

  21. CLAUDE Says:

    Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  22. GEORGE Says:

    Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  23. SAM Says:

    Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  24. EDGAR Says:

    Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  25. TYRONE Says:

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  26. MANUEL Says:

    allegra@print.colorado.springs” rel=”nofollow”>…

    Buygeneric drugs…

  27. KIRK Says:

    alternatives@to.premarin” rel=”nofollow”>…

    Buygeneric pills…

  28. ADRIAN Says:

    altace@generic.name” rel=”nofollow”>.

    Buynow it…

Leave a Comment