linux 短信监控

作者: admin 分类: linux 发布时间: 2010-11-16 15:06 ė 6 没有评论

文章只是讲了正确的配置 参数还是需要各位自己去看下资料 

今天测试了下短信监控 关于linux的飞信的安装请看http://www.linuxqq.com/archives/234.html

 下面是安装nagios配合飞信 参考了一些网上的子里哦

下面是下载nagios主程序

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.1.2.tar.gz

wget  http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz

我没有用APACHE 所以没安装

创建用户 useradd nagios

tar zxvf nagios-3.1.2.tar.gz

cd nagios

./configure –prefix=/usr/local/nagios  –with-nagios-user=nagios

make
make all
make install
make install-init
make install-commandmode
make install-config
cd nagios-plusins
./configure –prefix=/usr/local/nagios
make
make instal

记得看前面的文章 把飞信安装上 飞信如何安装我就不说了

启动service nagios start

cd /usr/local/nagios/etc/objects

vi hosts.cfg

添加如下

define host{
                host_name                             dns
                alias                                  dns
                max_check_attempts                     5
                contact_groups                        dnsweb
                address                            192.168.1.1                }

define hostgroup{
        hostgroup_name  dnswebgroup
        alias           dnserver
        members         *
        }
define service{
                host_name                            dns
                service_description                  PING
                is_volatile                             0
                check_period                         24×7
                max_check_attempts                   1
                normal_check_interval                1
                retry_check_interval                 1
                notification_options                 w,u,c,r
                notification_interval                1
                notification_period                 24×7
                check_command   check_ping!100.0,20%!500.0,60%
                   }

vi contacts.cfg

define contact{
        contact_name                    liyun           ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           liyunadmin              ; Full name of user
        service_notification_commands   service-notify-by-fei
        host_notification_commands      host-notify-by-fei

#        email                           nagios@localhost       ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        pager                            136******        }

define contactgroup{
        contactgroup_name       dnsweb
        alias                   web administrator
        members                 liyun
        }

保存

vi commands.cfg

添加如下

define command {
             command_name            host-notify-by-fei
             command_line            /var/soft/feixin/fx/fetion  –mobile=138**** –pwd=******* –to=$CONTACTPAGER$ –msg-utf8=”Host $HOSTSTATE$ alert for $HOSTNAME$! on ‘$LONGDATETIME$'” $CONTACTPAGER$
             }
define command {
             command_name         service-notify-by-fei
             command_line         /var/soft/feixin/fx/fetion  –mobile=138*****–pwd=********* –to=$CONTACTPAGER$ –msg-utf8=”$HOSTADDRESS$ $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ on $LONGDATETIME$” $CONTACTPAGER$
             }

保存退出 一般按我这样做就不会有错

转载注明(LINUXQQ)

本文出自 小Q,转载时请注明出处及相应链接。

本文永久链接: http://www.linuxqq.com/archives/250.html

0
更多
Ɣ回顶部