操作系统centos5.2 nagios 3.06 nagios-plugins1.4.13
yum install httpd gcc glibc glibc-common gd gd-devel
添加账号useradd nagios
passwd nagios
添加组groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
usermod -G nagcmd apache apache的用户大家可以看看自己的用户
安装naigos
解压
tar xvf nagios.xx.tar.gz
cd nagiosxx
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagios
安装差价
tar xvf nagios-plgxxx.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
关闭selinux 最好在安装钱关闭selinux
或者chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
chkconfgi --add httpd nagios
启动httpd和nagios
二配置飞信
我下载的是
不是最新版本的最新版本的好像有点问题
还有lib 也可以在上面下载。
把文件都 拷贝到 /lib 和/usr/lib
解压飞信譬如/home/down
./fetion -h 可以看到使用方法
在command.cfg里添加
define command{
command_name notify-service-by-sms
command_line /home/down/install/fetion --mobile=*** --pwd=xxx --to=xxx --msg-utf8="'$HOSTADDRESS$' $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ on '$LONGDATETIME$' " $CONTACTPAGER$
}
define command{
command_name notify-host-by-sms
command_line /home/down/install/fetion --mobile=xx --pwd=xxx --to=*** --msg-utf8="Host $HOSTSTATE$ alert for $HOSTNAME$! on '$LONGDATETIME$' " $CONTACTPAGER$
}
将这里的东西添加相应的手机号
在contacts.cfg
define contact{
contact_name crastyl
alias system administrator
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms
host_notification_commands notify-host-by-email,notify-host-by-sms
email
支持就ok了
我的配置文件都是以前备份的直接复制到里面的 。提示到邮件的错误
Make sure the script or binary you are trying to execute actually exists
在commands.cfg邮件的路径是/bin/mail 而不是/usr/bin/mail
发送的手机号要是好友才可以发
阅读(961) | 评论(1) | 转发(0) |