Nagios图形化Pnp 安装和配置 ZT

运维 系统运维
我们在为自己监控实施时,就会用到Nagios,他的具体安装在上篇文章中已经介绍过了,本文来看看Nagios图形化Pnp 安装和配置 ZT

Nagios图形化Pnp 安装和配置 ZT 具体过程如下:

  ⑴安装完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模式

  ③

  修改etc/objects/templates.cfg增加新命令(增加小太阳标记)

  #在use的后面添加"host-pnp"即可让监控图上的主机名称旁边增加一个小太阳的标记,点击此标记即可查看pnp图片。

  define host {

  name host-pnp

  register 0

  action_url /nagios/pnp/index.php?host=$HOSTNAME$

  process_perf_data 1

  }

  #还可以在service栏添加srv-pnp,添加后会在相应的栏内增加小太阳。

  define service {

  name srv-pnp

  register 0

  action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$

  process_perf_data 1

  }

  ④

  修改etc/nagios.cfg

  找到如下几项,去掉注释

  process_performance_data=1

  host_perfdata_command=process-host-perfdata

  service_perfdata_command=process-service-perfdata

  ⑤

  修改commands.cfg

  # 'process-host-perfdata' command definition

  define command{

  command_name process-host-perfdata

  command_line /usr/local/nagios/libexec/process_perfdata.pl

  }

  # 'process-service-perfdata' command definition

  define command{

  command_name process-service-perfdata

  command_line /usr/local/nagios/libexec/process_perfdata.pl

  }

  ⑥nginx下的安全问题,需作如下配置

  修改pnp的web服务器配置文件nginx.conf,请注意安全问题,我这里未做安全验证。

  location /pnp/ {

  root /usr/local/nagios/share/;

  location ~ .*\.php?$

  {

  #fastcgi_pass unix:/tmp/php-cgi.sock;

  fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  include fcgi.conf;

  }

  }

  如果开启了open_basedir还需修改php.ini

  open_basedir =

  "/opt/htdoc:/opt/php/lib/php:/tmp/session:/tmp/upload:/usr/local/nagios/share/pnp:/usr/local/nagios/etc/pnp:/usr/local/nagios/share/perfdata:/usr/local/rrdtool/bin/rrdtool

#p#

  ㈢测试:

  为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的正确性,还不行就等等,别太心急了,装完没那么快出图。

仔细的把文章阅读后,我们掌握了Nagios图形化Pnp 安装和配置 ZT 。

【编辑推荐】

责任编辑:赵鹏 来源: 网络转载
相关推荐

2010-05-31 12:22:13

Nagios pnp

2010-05-31 10:22:31

Nagios pnp

2010-05-31 11:10:37

Nagios pnp

2012-09-28 10:19:32

IBMdw

2010-06-09 17:07:56

Nagios pnp

2011-05-10 13:30:07

2012-06-07 10:00:45

Blockly编程语言

2022-02-15 09:19:55

Ubuntu 20.Grub2Linux

2011-03-25 17:06:55

Nagios插件plugins

2009-06-27 18:35:00

LinuxNFS图形化

2011-08-22 12:25:02

nagios

2011-03-31 16:05:18

Redhat配置nagios

2010-10-12 09:19:29

Navicat

2021-07-03 08:30:16

工具KongaK8S

2021-12-14 15:50:43

Gaphor建模工具开源

2016-08-03 15:25:32

Ubuntu 16.0网络监测Etherape

2011-04-06 15:46:55

MySQL图形化

2011-03-31 16:05:18

Redhat配置nagios

2011-03-28 09:49:44

nagioscheck_http

2011-11-08 21:45:29

Linux 流量监控
点赞
收藏

51CTO技术栈公众号