作为初学者,要想取得进步,成为高手,首先应该了解自己的不足之处.
全部博文(117)
分类: 系统运维
2011-03-22 09:01:01
nagios-3.2.3
nagios-plugins-1.4.15
yum install httpd php
yum install gcc glibc glibc-common
yum install gd gd-devel php-gd
/usr/sbin/useradd -m nagios
passwd nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
tar xzf nagios-3.2.3.tar.gz
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
make install-webconf
在/etc/httpd/conf.d/nagios.conf这个文件下指定了密码文件,所以需要加参数c,创建密码文件,并指定用户名。(用户名admin、密码admin)
htpasswd -c /usr/local/nagios/etc/htpasswd.users admin
tar xzf nagios-plugins-1.4.11.tar.gz
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
chkconfig --add nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios start
command_check_interval=-1
-1为尽可能的快速轮询
It appears as though you do not have permission to view information for any of the services you requested...
解决办法:
打开cgi.cfg(vim /usr/local/nagios/etc/cgi.cfg )配置文件,里面有个参数:
use_authentication=1 为了保障系统的安全性,nagios设置了这个参数,默认为1,改为0即可。
HTTP WARNING: HTTP/1.1 403 Forbidden - 5240 bytes in 0.001 second response time
解决办法:
在/var/www/html目录下没有文件,可以随便创建一个index.html文件用于测试。
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
然后就可以yum install rrdtool
解压pnp4nagios-0.6.11
./configure --prefix=/usr/local/nagios/pnp4nagios
make all
make install
make install-webconf
make install-config
make install-init
或者make fullinstall
配置步骤(同步模式-Synchronous Mode)
为pnp4nagios复制一个配置文件
/usr/local/nagios/pnp4nagios/etc 目录下
process_perfdata.cfg配置文件
修改文件nagios.cfg
process_performance_data=1(此参数默认为0)
enable_environment_macros=1
取消下面两个的注释
service_perfdata_command=process-service-perfdata
host_perfdata_command=process-host-perfdata
commands.cfg文件
define command {
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/nagios/pnp4nagios/libexec/process_perfdata.pl
}
define command {
command_name process-host-perfdata
command_line /usr/bin/perl /usr/local/nagios/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
不被处理的服务,需要如下定义
define service {
...
process_perf_data 0
...
}
文件信息
etc/config.php
定义模板templates.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
定义主机host.cfg,设置主机监控绘图,则绘制该主机监控下的所有服务图
define host{
use linux-server,host-pnp
host_name localhost
alias localhost
address 127.0.0.1
}
定义服务,绘制单个图
define service{
use local-service,srv-pnp
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
Popups(弹出窗口、暂时未配置)