开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(三)pnp4nagios安装

官网地址:https://docs.pnp4nagios.org/

前面的文章已经说过,pnp4nagios的Broker模式不支持nagios4x,这里采用Bulk Mode模式

1.RRDtool的安装,这里使用的是yum安装
#yum install -y rrdtool*

2.pnp4nagios安装
#tar -zxvf pnp4nagios-0.6.25.tar.gz
#cd pnp4nagios-0.6.25
#./configure --with-rrdtool=/usr/bin/rrdtool  --with-perfdata-dir=/usr/local/nagios/share/perfdata --with-perfdata-spool-dir=/usr/local/nagios/share/spool --with-nagios-user=nagios --with-nagios-group=nagios
#make all
#make install
#make install-config
#make install-init

3.pnp4nagios配置

cd  /usr/local/pnp4nagios/etc  
mv misccommands.cfg-sample  misccommands.cfg  
mv nagios.cfg-sample nagios.cfg  
mv rra.cfg-sample rra.cfg  
cd /usr/local/pnp4nagios/etc/pages/  
mv web_traffic.cfg-sample web_traffic.cfg  
cd ../check_commands  
mv check_all_local_disks.cfg-sample  check_all_local_disks.cfg  
mv check_nrpe.cfg-sample  check_nrpe.cfg  
mv check_nwstat.cfg-sample  check_nwstat.cfg

#重启服务
#service npcd restart

4.修改相关配置文件
(1)修改templates.cfg,增加一个定义PNP的host和service
define host {  
      name       host-pnp  
      register   0  
      action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
      process_perf_data              1  
}  
define service {  
      name       srv-pnp  
      register   0  
      action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$‘ class=‘tips‘ rel=‘/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
      process_perf_data              1  
}

(2)修改nagios.cfg

process_performance_data=1

enable_environment_macros=1

host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata

service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata

host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$

service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$\tSERVICEOUTPUT::$SERVICEOUTPUT$

host_perfdata_file_mode=a

service_perfdata_file_mode=a

host_perfdata_file_processing_interval=15

service_perfdata_file_processing_interval=15

host_perfdata_file_processing_command=process-host-perfdata-file

service_perfdata_file_processing_command=process-service-perfdata-file

(3)修改commands.cfg
增加如下配置
define command{
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}

(4)修改host和service的模版
define host{
       name                   gchost
       use                    host-pnp
       max_check_attempts       1
       normal_check_interval    2
       retry_check_interval     1
       check_period          24x7
       contact_groups        myself_group
       notification_interval  2
       notification_period   24x7
       notification_options   d,u,r
       check_command          check-host-alive
       }
               
define service{
       name                    myself_temp
       use                     srv-pnp
       max_check_attempts      2
       normal_check_interval   2
       retry_check_interval    1
       check_period            24x7
       notification_interval   2
       notification_period     24x7
       notification_options    w,u,c,r
       contact_groups          myself_group
       check_command           check-host-alive
       register                0        
}

(5)apache配置
#vim /etc/httpd/conf/httpd.conf

Alias /pnp4nagios "/usr/local/pnp4nagios/share"  
 
<Directory "/usr/local/pnp4nagios/share">  
    AllowOverride None  
    Order allow,deny  
    Allow from all  
    #  
    # Use the same value as defined in nagios.conf  
    #  
    AuthName "Nagios Access"  
    AuthType Basic  
    AuthUserFile /usr/local/nagios/etc/htpasswd.users
    Require valid-user  
        <IfModule mod_rewrite.c>  
                  #Turn on URL rewriting  
                  RewriteEngine On  
                  Options symLinksIfOwnerMatch  
                  #Installation directory  
                  RewriteBase /pnp4nagios/  
                  #Protect application and system files from being viewed  
                  RewriteRule "^(?:application|modules|system)/" - [F]  
                  #Allow any files or directories that exist to be displayed directly  
                  RewriteCond "%{REQUEST_FILENAME}" !-f  
                  RewriteCond "%{REQUEST_FILENAME}" !-d  
                  #Rewrite all other URLs to index.php/URL  
                  RewriteRule "^.*$" "index.php/$0" [PT]  
        </IfModule>  
</Directory>

(6)复制鼠标悬停图标显示
cp /usr/local/src/pnp4nagios-0.6.25/contrib/ssi/* /usr/local/nagios/share/ssi/

到这里就可以检测nagios配置文件无误后重启nagios观看效果

#/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

#/etc/init.d/nagios restart

#/etc/init.d/httpd restart

附上nagios启动之后可能会遇到的问题以及解决办法以供参考

1.点击图标按钮如果出现如下提示,执行

#rm -rf  /usr/local/pnp4nagios/share/install.php

2.点击图标按钮如果出现如下提示,执行

#chown -R tong:tong  /var/lib/php

时间: 2024-10-01 22:45:00

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(三)pnp4nagios安装的相关文章

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(一)介绍

以nagios为核心.伴以多款开源软件来进行的整合部署,从而实现监控信息图形化.web页面定义监控配置.监控信息存储.图形化监控主机和服务等一系列功能的解决方案. pnp4nagios是基于RRD轮循(环状)数据库中所提供的综合信息,以可视化图形的方式呈现给用户的一款nagios插件:nconf是基于PHP使用户通过web页面实现对nagios各项属性进行配置,诸如模板定义.添加修改监控的主机/服务等操作:ndoutils可以导出nagios通过SNMP捕获到的当前和历史数据并存储到MySQL数

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(五)cacti安装

1.安装LAMP环境这里就不做介绍,网上一堆的相关文档,还有很多牛人写的自动化安装脚本 2.安装rrdtoolyum install cairo-devel libxml2-devel pango pango-devel rrdtool –y 3.安装SNMP操作系统一般自带SNMP,如果没有即安装 yum -y install net-snmp net-snmp-libs net-snmp-utils 4.安装Cacti (1)下载Cacti#wget http://www.cacti.net

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(七)nagios+cacti整合

nagios和cacti的安装请参考之前的文章安装,这里介绍二者如何整合在一起. ndoutils将nagios的监控数据写入数据库 cacti则将ndoutil插件写入数据库的数据展示在页面上,因为数据写入数据库会因为各种因素延时,所以有时候nagios自身的页面有的监控项已经告警,但是cacti页面可能还是正常状态. 所以这套方案的核心还是nagios,所有监控和故障通知都由nagios完成,cacti只是担任web管理页面. 1.修改数据库结构 mysql> use nagios; mys

开源监控解决方案Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(八)nconf安装

nconf提供WEB界面,管理nagios配置,其将nagios配置文件放入数据库,用户做相应修改后点击生成配置文件,Nconf会从数据库中将配置写入配置文件.所以最后nagios的配置还是以文件的形式存在,这是相对与nagioSQL本人比较喜欢Nconf的原因,其次Nconf还提供了静态文件的修改页面. 一.初始化数据库mysql> create database nconf default character set utf8;mysql> grant all privileges on

Nagios+Cacti+PNP4Nagios+NConf+NDOUtils+Nagvis(一)nagios安装

1.nagios安装 groupadd nagios useradd -g nagios nagios mkdir -p /usr/local/nagios/ passwd nagios tar -xvf nagios-4.0.8.tar.gz cd nagios-4.0.8 ./configure --prefix=/usr/local/nagios/ --with-command-group=nagios --with-nagios-user=nagios --with-nagios-gro

开源监控解决方案:Cacti部署实录

[[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm  [[email protected] ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm [[email protected] ~]# yum install -y httpd php php-mysql php-gd libjpeg libjpeg-devel libpng libpng-devel  [[emai

开源监控之nagios初步使用及进阶

开源监控之nagios初步使用及进阶

开源监控解决方案:ICINGA(Nagios)监控Linux

[[email protected] ~]# useradd nagios [[email protected] ~]# tar zxvf nagios-plugins-2.2.1.tar.gz [[email protected] ~]# cd nagios-plugins-2.2.1 [[email protected] nagios-plugins-2.2.1]# ./configure --prefix=/usr/local/nagios --with-cgiurl=/nagios/cg

开源监控解决方案:ICINGA(Nagios)监控MYSQL Database

[[email protected] ~]# tar zxvf DBI-1.637.tar.gz [[email protected] ~]# cd DBI-1.637 [[email protected] DBI-1.637]# perl Makefile.PL [[email protected] DBI-1.637]# make all [[email protected] DBI-1.637]# make install [[email protected] ~]# tar zxvf D