安装rrdtools(绘图工具)可能需要的库
一.编译安装rrdtool
yum install -y pango pango-devel freetype freetype-devel libpng libpng-devel gettext gettext-devel libjpeg libjpeg-devel gd gd-devel libxml2 libxml2-devel libiconv libiconv-devel qpixman qpixman-devel glib glib-devel cairo cairo-devel libart*
下载:?M=D
安装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=http://apt.sw.be/RedHat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1
安装相关依赖
[root@localhost]#yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bisonautoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devellibpng-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- laster.tar.gz
# cd pnp-laster
#./configure --with-nagios-user=nagios --with-nagios-group=nagios--with-rrdtool=/opt/rrdtool-1.4.7/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 /pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
define service{
name services-pnp
register 0
action_url /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