重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
⑴安装完nagios,继续安装pnp,要注意rrdtool的安装。
tar -xvzf pnp-0.4.13.tar.gz
cd pnp-0.4.13
./configure
make all
make install
make install-config
make install-init
---------------------------------------------------------------------------------
FAQ:
*** Configuration summary for pnp 0.4.13 02-19-2009 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Path to rrdtool: /usr/local/bin/rrdtool (Version 1.2.23)
RRDs Perl Modules: *** NOT FOUND ***
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
-----------------------------------------
process_perfdata.pl 安装在 /usr/local/nagios/share/
配置示例文件安装在/usr/local/nagios/libexecs
config.php安装于/usr/local/nagios/etc/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 *
②
vi /usr/local/nagios/etc/pnp/process_perfdata.cfg
....
LOG_FILE = /usr/local/nagios/var/perfdata.log
#
# Loglevel 0=silent 1=normal 2=debug
#
LOG_LEVEL = 2
#先改为2,为debug模式
③
创新互联建站主营润州网站建设的网络公司,主营网站建设方案,手机APP定制开发,润州h5小程序定制开发搭建,润州网站营销推广欢迎润州等地区企业咨询
④
修改etc/nagios.cfg
找到如下几项,去掉注释
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
⑤
⑥nginx下的安全问题,需作如下配置
修改pnp的web服务器配置文件nginx.conf,请注意安全问题,我这里未做安全验证。
㈢测试:
为localhost这台主机在主机图标旁边添加个小太阳标记
vi /usr/local/nagios/etc/nagios.cfg
#为这个主机增加小太阳标记
define host{
use linux-server,host-pnp
host_name localhost
alias localhost
address 127.0.0.1
}
#重新加载配置文件
service nagios reload
如果正确此时就会生成pnp文件
[root@localhost ~]# ls /usr/local/nagios/share/perfdata/localhost/
Current_Load.rrd Current_Users.xml PING.rrd Root_Partition.xml
Current_Load.xml HTTP.rrd PING.xml Swap_Usage.rrd
Current_Users.rrd HTTP.xml Root_Partition.rrd Swap_Usage.xml
打开网页http://localhost/nagios
点击小太阳就可以看到图表,同访问http://localhost/nagios/pnp
FAQ: 注意可能提示这个模块没有安装:
Time/HiRes.pm模块的安装:
①执行以下命令安装该模块。
#perl -MCPAN -e 'install Time::HiRes'
或安装Time-HiRes-1.9707.tar.gz
②如果打开pnp页面提示Hostname is not set,则检查etc/pnp/里的sample文件都更改正确,检查templates.cfg文件中url的正确性,还不行就等等,别太心急了,装完没那么快出图。