安装rrdtools(绘图工具)可能需要的库
一.编译安装rrdtool
yum install cairo pango libart_lgpl libart_lgpl-devel zlib zlib-devel freetype freetype-devel
安装rrdtools
./configure
make
make install
二.yum简单安装rrdtool方法:
[root@localhost]# cd /etc/yum.repos.d/
[root@localhost]# vim dag.repo
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=
gpgcheck=1
gpgkey=
enabled=1
安装相关依赖
[root@localhost]#yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel
[root@localhost]# yum install -y rrdtool perl-rrdtool rrdtool-devel
安装PNP
# tar xvf pnp-0.4.13.tar.gz
# cd pnp-0.4.13
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-rrdtool=/usr/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata
# make all
# make install
# make install-config
# make install-init
配置PNP
# cd /usr/local/nagios/etc/pnp/
# cp process_perfdata.cfg-sample process_perfdata.cfg
# cp npcd.cfg-sample npcd.cfg
# cp rra.cfg-sample rra.cfg
# chown -R nagios.nagios /usr/local/nagios/etc/pnp/
修改process_perfdata.cfg文件
# vim /usr/local/nagios/etc/pnp/process_perfdata.cfg修改如下:
LOG_FILE = /usr/local/nagios/var/perfdata.log
LOG_LEVEL = 2 (debug)
修改Nagios配置文件
1.增加小太阳图标
修改templates.cfg,增加一个定义PNP的host和service。修改后的内容如下:
define host{
name hosts-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
define service{
name services-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
process_perf_data 1
}
修改nagios.cfg,找到以下几项,去掉注释。修改后的信息如下:
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
修改commands.cfg
define command{
command_name process-host-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
define command{
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
修改hosts.cfg和services.cfg
hosts.cfg
define host{
use linux-server,hosts-pnp
host_name www-syj
alias www-syj
address 192.168.1.60
}
define host{
use linux-server,hosts-pnp
host_name 111-syj
alias 111-syj
address 192.168.1.111
}
define hostgroup{
hostgroup_name sa-servers
alias sa servers
members www-syj,111-syj
}
servers.cfg
###########################www-syj###########################
define service{
use local-service,services-pnp
host_name www-syj
service_description check-swap
check_command check_nrpe!check_swap
}
define service{
use local-service,services-pnp
host_name www-syj
service_description check-load
check_command check_nrpe!check_load
}
define service{
use local-service,services-pnp
host_name www-syj
service_description check-users
check_command check_nrpe!check_users
}
测试PNP功能
# service nagios restart
如果配置正确,此时就会生成相应的主机的PNP文件。
如图所示:
阅读(2580) | 评论(0) | 转发(0) |