博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Nagios设置飞信报警
阅读量:6864 次
发布时间:2019-06-26

本文共 5974 字,大约阅读时间需要 19 分钟。

  hot3.png

一.下载飞信
到此网站下载飞信机器人
下载完把飞信移动到/usr/lcaol/fetion
安装好FTP,等会飞信需要输入验证码,要看验证码
二.配置库
cd /usr/local/fetion/
1.将库加载到系统
vim /etc/ld.so.conf.d/fetion
/usr/local/fetion
ldconfig

[root@bogon fetion]# ./fetion-bash: ./fetion: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory出了个错[root@bogon fetion]#  yum install /lib/ld-linux.so.2[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libACE-5.7.2.so: cannot open shared object file: No such file or directory又出了个错[root@bogon fetion]# cp libACE-5.7.2.so /lib[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libACE_SSL-5.7.2.so: cannot open shared object file: No such file or directory[root@bogon fetion]# cp libACE_SSL-5.7.2.so /lib又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libssl.so.4: cannot open shared object file: No such file or directory[root@bogon fetion]# cp libssl.so.4 /lib又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory[root@bogon fetion]# cp libstdc++.so.6 /lib又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory[root@bogon fetion]# yum -y install libgcc_s.so.1又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libcrypto.so.4: cannot open shared object file: No such file or directory[root@bogon fetion]# cp libcrypto.so.4 /lib又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libgssapi_krb5.so.2: cannot open shared object file: No such file or directory[root@bogon fetion]# yum -y install libgssapi_krb5.so.2又出了个错[root@bogon fetion]# ./fetion./fetion: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory[root@bogon fetion]# yum -y install libz.so.1直到出现这样就成功了[root@bogon 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/]

2.发信测试

第一次发信会提示你输入验证码

./fetion --mobile=1590***** --pwd=*****--to=18501223113 --msg-utf8=test
3.创建脚本

vim fetion.sh#!/bin/bash/usr/local/fetion/fetion --mobile=159******** --pwd=******** --to="$1" --msg-utf8="$2"

chmod 755 fetion.shchown nagios.nagios fetion.shsh fetion.sh 159****** test

SIP-C/4.0 280 Send SMS OK
T: sip:531765466@fetion.com.cn;p=5913
I: 2
Q: 1 M
L: 112
D: Sat, 14 Sep 2013 17:13:45 GMT
XI: 4DEBE57197CEBC01DAC262E2A9D23EE2

三.修改模版配置文件templates.cfg
vim /usr/local/nagios/etc/objects/templates.cfg

define contact{        name                            generic-contact         ; The name of this contact template        service_notification_period     24x7                    ; service notifications can be sent anytime        host_notification_period        24x7                    ; host notifications can be sent anytime        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events        service_notification_commands   notify-service-by-email,notify-service-by-fetion        ; send service notifications via email        host_notification_commands      notify-host-by-email,notify-host-by-fetion    ; send host notifications via email        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!        }

四.修改命令配置文件commadns.cfg

vim /usr/local/nagios/etc/objects/commands.cfg

# 'notify-host-by-fetion' command definition define command{  command_name    notify-host-by-fetion  command_line    $USER1$/fetion.sh $CONTACTPAGER$ "$NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$"} # 'notify-service-by-fetion' command definition define command{ command_name    notify-service-by-fetion command_line    $USER1$/fetion.sh $CONTACTPAGER$ "$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$"}

五.修改联系人配置文件contacts.cfg

vim /usr/local/nagios/etc/objects/contacts.cfg

define contact{        contact_name                    nagiosadmin             ; Short name of user        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)        alias                           Nagios Admin            ; Full name of user        email                           f91jty@gmail.com        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******        pager                           1590*******        }

转载于:https://my.oschina.net/f91jty/blog/168392

你可能感兴趣的文章
Flip Game poj1753
查看>>
工作笔记--关于服务出问题时如何处理的流程
查看>>
Cesium官方教程8-- 几何体和外观效果
查看>>
Nginx常见的错误及解决方法
查看>>
我的友情链接
查看>>
linux 命令篇 -- 新建用户
查看>>
基于python的大数据分析实战学习笔记-pandas(数据分析包)
查看>>
火狐访问HTTPS网站显示连接不安全的解决方法
查看>>
nGrinder中快速编写groovy脚本03-在GET请求中发送参数
查看>>
转盘抽奖
查看>>
Dubbo中基于权重的随机算法
查看>>
<问题解决10>使用带有框架的页面跳转到登录页面时,登录页面只显示在子框架中,未能铺满整个浏览器--解决方案如下:...
查看>>
oracle 锁表
查看>>
UML关系说明文档
查看>>
如何去除My97 DatePicker控件上右键弹出官网的链接 - 如何debug混淆过的代码
查看>>
dedecms织梦移站后替换数据库中文件路径命令
查看>>
openssl
查看>>
《深入浅出Mysql》學習筆記--日志
查看>>
maven笔记(3)
查看>>
C#面向对象(一) 封装
查看>>