成都创新互联网站制作重庆分公司

nagios结合pnp4nagios图表-创新互联

nagios结合pnp4nagios图表

成都创新互联公司主营南岳网站建设的网络公司,主营网站建设方案,APP应用开发,南岳h5微信平台小程序开发搭建,南岳网站营销推广欢迎南岳等地区企业咨询

安装rrdtool

网址:https://www.oetiker.ch/en/oss/projects/

cd /usr/local/src

wgethttp://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz

tar -zxvf rrdtool.tar.gz

cd rrdtool-1.4.9/

yum install -y pango*               #./configure依赖的包

yum install –y perl-ExtUtils-CBuilderperl-ExtUtils-MakeMaker    #make需要的包

./configure --prefix=/usr/local/rrdtool

make

make install

注意nagios4.x和nagios3.x跟pnp4nagios兼容问题

安装pnp4nagios

官网:http://www.pnp4nagios.org/

网址:http://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.25.tar.gz

cd /usr/local/src/

wgethttp://jaist.dl.sourceforge.net/project/pnp4nagios/PNP-0.6/pnp4nagios-0.6.25.tar.gz

tar -zxvf pnp4nagios-0.6.25.tar.gz

cd pnp4nagios-0.6.25

yum install perl-Time-HiRes                      #./configure需要的包

./configure –h                                               #查看pnp4nagios默认安装在哪里

./configure --with-nagios-user=nagios--with-nagios-group=nagios --with-rrdtool=/usr/local/rrdtool/bin/rrdtool--with-perfdata-dir=/usr/local/nagios/share/perfdata

make all

make install

make install-config

make install-init

cd /usr/local/pnp4nagios/etc/

mv misccommands.cfg-sample misccommands.cfg

mv nagios.cfg-sample nagios.cfg

mv rra.cfg-sample rra.cfg

cd pages/

mv web_traffic.cfg-sample web_traffic.cfg

cd/usr/local/pnp4nagios/etc/check_commands/

mv check_all_local_disks.cfg-samplecheck_all_local_disks.cfg

mv check_nrpe.cfg-sample check_nrpe.cfg

mv check_nwstat.cfg-sample check_nwstat.cfg

本实验pnp4nagios的模式为bulk with npcd,相关配置如下

vim /usr/local/nagios/etc/nagios.cfg

#修改或打开

process_performance_data=1

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

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

host_perfdata_file_template=[HOSTPERFDATA]\t$TIMET$\t$HOSTNAME$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$

service_perfdata_file_template=[SERVICEPERFDATA]\t$TIMET$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$

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

# process_performance_data=1    表示启用nagios性能数据输出

vim/usr/local/nagios/etc/objects/commands.cfg

#把原来的process-host-perfdata、process-service-perfdata注释,添加

define command{

   command_name   process-service-perfdata-file

   command_line   /bin/mv/usr/local/pnp4nagios/var/service-perfdata/usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$

}

define command{

 command_name   process-host-perfdata-file

 command_line   /bin/mv/usr/local/pnp4nagios/var/host-perfdata/usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$

}

vim /usr/local/nagios/etc/objects/templates.cfg

#添加

define host {

       name      host-pnp

       register  0

       action_url/pnp4nagios/share/index.php/graph?host=$HOSTNAME$&srv=_HOST_

       process_perf_data              1

}

define service {

       name      srv-pnp

       register  0

       action_url/pnp4nagios/share/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$

       process_perf_data              1

}

#这里应该注意apache配置文件,有的要修改vim/usr/local/apache2/conf/httpd.conf

把DocumentRoot "/usr/local/apache2/ htdocs"修改为DocumentRoot"/usr/local"

下面是我另一个主机,没有改apache2配置文件

define host {

       name      hosts-pnp

       register  0

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

       process_perf_data              1

}

define service {

       name      srv-pnp

       register  0

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

       process_perf_data              1

}

vim /usr/local/nagios/include/xiaojun.cfg

define host{

       use                    linux-server,host-pnp

       host_name              115.28.76.154

       alias                  141

       address                115.28.76.154

       }

define service{

       use                    generic-service,srv-pnp

       host_name              115.28.76.154

       service_description    check_ping

       check_command          check_ping!100.0,20%!200.0,50%

       max_check_attempts 5

       normal_check_interval 1

}

/etc/init.d/nagios start

/usr/local/apache2/bin/apachectl start

/etc/init.d/npcd start

#启动后在/usr/local/nagios/share/perfdata会产生相应主机的pnp文件

#如果有错就打开日式debug模式

vim/usr/local/pnp4nagios/etc/process_perfdata.cfg

#修改

LOG_LEVEL = 2

/etc/init.d/nagios restart

出现

nagios结合pnp4nagios图表

解决方法:

mv /usr/local/pnp4nagios/share/install.php/usr/local/pnp4nagios/share/install.php.bak

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻名称:nagios结合pnp4nagios图表-创新互联
本文地址:http://cxhlcq.com/article/phgii.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部