Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1154563
  • 博文数量: 188
  • 博客积分: 2267
  • 博客等级: 大尉
  • 技术积分: 1907
  • 用 户 组: 普通用户
  • 注册时间: 2011-08-01 11:17
文章分类

全部博文(188)

文章存档

2016年(16)

2015年(16)

2014年(12)

2013年(32)

2012年(45)

2011年(67)

分类: LINUX

2011-10-12 14:06:55

系统环境 RHEL6.0
Nagios 搭建请参考http://blog.chinaunix.net/space.php?uid=26118446&do=blog&id=2943736
第一次使用机器人时,即使是复杂密码,也可能会弹出图形验证码,以后将不再提示。验证码图片一般在/usr/local/fetion/手机号.jpg
# wget 
# mkdir /usr/local/fetion && cp fetion /usr/local/fetion
# ll /usr/local/fetion/fetion
-rwxr-xr-x. 1 root root 441445 Oct 12 11:22 /usr/local/fetion/fetion

# tar xf linuxso_20101113.tar.gz -C /usr/lib  (这个软件我用的是我们学校老师服务器上的)
# cd /usr/lib
# chmod +x libACE-5.7.2.so  libACE_SSL-5.7.2.so  libcrypto.so.4  libssl.so.4

# yum install -y ld-linux.so.2 libstdc++.so.6 libgssapi_krb5.so.2 libz.so.1
# cd /usr/local/fetion/
# ./fetion --mobile=1879258xxxx --pwd=xxxxxx --to='1879258xxxx' --msg-utf8="test messages"  

# yum install -y mysql-devel openssl-devel
# cat /usr/local/nagios/etc/objects/hosts.cfg
define host{
        use                     linux-server
        host_name               server26
        alias                   nagios server
        address                   192.168.0.55
        icon_image              web.gif
        statusmap_image         web.gd2
        2d_coords               100,300
        3d_coords               100,300,100
        }
define host{
        use                     linux-server
        host_name               localhost
        alias                   nagios server
        address                 192.168.0.55
        icon_image              web.gif
        statusmap_image         web.gd2
        2d_coords               100,500
        3d_coords               100,500,100
        }
define hostgroup{
        hostgroup_name 家用机器组
        alias   nagios
        members server26
        }

# cat /usr/local/nagios/etc/objects/services.cfg
define service{
        use                             local-service         
        host_name                       server26
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        }
define service{
        use                             local-service         
        host_name                       server26
        service_description             根分区
        check_command                   check_local_disk!20%!10%!/
        }
define service{
        use                             local-service         
        host_name                       server26
        service_description             进程总数
        check_command                   check_local_procs!250!400!RSZDT
        }
define service{
        use                             local-service         
        host_name                       localhost
        service_description             系统负荷
        check_command                   check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
        }
define service{
        use                             local-service         
        host_name                       server26
        service_description             交换空间利用率
        check_command                   check_local_swap!20!10
        }

define servicegroup{
        servicegroup_name local-service
        members server26,PING,server26,根分区,server26,进程总数,localhost,系统负荷,server26,交换空间利用率
        }



# vim /usr/local/nagios/etc/objects/templates.cfg
在define contact里修改以下内容,添加 service-nofity-by-fetion选项
service_notification_commands   notify-service-by-email,service-notify-by-fetion

host_notification_commands      notify-host-by-email,host-notify-by-fetion   

创建一个fetion.sh 的脚本
#!/bin/bash
/usr/loca/fetion --mobile=1879258xxxx --pwd=xxxxxx  --to=1879258xxxx --msg-utf8="$1"
# chmod +x /usr/local/nagios/libexec/fetion.sh
# chown nagios.nagios /usr/local/nagios/libexec/fetion.sh
# ll /usr/local/nagios/libexec/fetion.sh

# vim /usr/local/nagios/etc/objects/commands.cfg
# 'host-notify-by-fetion' command definition
define command{
        command_name    host-notify-by-fetion
        command_line    $USER1$/fetion.sh "主机测试信息,不要鸡动,保持蛋定"
        }

# 'service-notify-by-fetion' command definition
define command{
        command_name    service-notify-by-fetion
        command_line    $USER1$/fetion.sh "服务测试信息,不要鸡动,保持蛋定"
        }


# vim /usr/local/nagios/etc/objects/contacts.cfg
在define contact 里加入一行
pager          1879258xxxx ;   [1879258xxxx为接受短信的手机]
在email 这里可以定义自己有邮箱来接受报警邮件
# /etc/init.d/httpd restart
# /etc/init.d/nagios restart

阅读(1141) | 评论(1) | 转发(0) |
0

上一篇:Nagios

下一篇:RHEL6.0+Ganglia+Nagios+fetion

给主人留下些什么吧!~~

网络安全服务2011-10-13 15:58:55