nagios+pnp4nagios监控
发布日期:2021-10-26 12:56:34 浏览次数:2 分类:技术文章

本文共 4674 字,大约阅读时间需要 15 分钟。

hot3.png

 

pnp4nagios

一、安装pnp4nagios

①  预安装:rrdtool和perl-Time*

yum install rrdtool perl-Time* -y

②  tar -axvf pnp4nagios-0.6.4.tar.gz –C /usr/local/src/

③  cd /usr/local/src/

④    ./configure --prefix=/usr/local/pnp4nagios \

--with-nagios-user=nagios \

--with-nagios-group=nagios

⑤    make all

make install

make install-webconf

make install-config

make install-init

make fullinstall

二、PNP4Nagios Nagios 整合

   

①   创建配置文件:

cd /usr/local/pnp4nagios/etc

mv   misccommands.cfg-sample  misccommands.cfg

mv   nagios.cfg-sample nagios.cfg

mv npcd.cfg-sample npcd.cfg

mv   process_perfdata.cfg-sample process_perfdata.cfg

mv rra.cfg-sample rra.cfg

cd pages

mv   web_traffic.cfg-sampleweb_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

②修改nagios 配置文件,vi /usr/local/nagios/etc/nagios.cfg,将相应配置修改为以下内容:

process_performance_data=1

host_perfdata_command=process-host-perfdata

service_perfdata_command=process-service-perfdata

修改nagios 配置文件commands.cfg 文件中的process-host-perfdata

process-service-perfdata

# 'process-host-perfdata' command definition

define command{
       command_name   process-host-perfdata
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl
       }
# 'process-service-perfdata' command definition
define command{
       command_name   process-service-perfdata
       command_line   /usr/local/pnp4nagios/libexec/process_perfdata.pl
       }

④将性能图集成到nagiosweb页面,即添加小太阳模版,镶嵌在nagios页面上。

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

define host{

name   host-pnp

register   0

action_url    /pnp4nagios/index.php/graph?host=$HOSTNAME$

}

define service{

name   srv-pnp

register   0

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

}

⑤让PNP4Nagios 显示图形在nagios 的主机中或服务中显示,加入host-pnp

srv-pnp 配置实例(注:一般只需在主机的定义(hosts.cfg)的第一行中加入:

use host-pnp即可)

例:define host {

      use                            host-pnp
      host_name               nagios-server

      alias                        nagios-server

      address                   10.0.0.77

      contact_groups              sagroup

      check_command             check-host-alive

      max_check_attempts        5

      notification_interval     10

      notification_period       24x7

      notification_options      d,u,r

      }

PNP4Nagios Apache 整合:

在apache的配置文件httpd.conf中加上下面这行:

include conf.d/pnp4nagios.conf

⑦所有者:

chown R nagios:nagios  /usr/local/nagios

chown R nagios:nagios  /usr/local/pnp4nagios

重启服务:(即可)

         /etc/init.d/npcd   restart

       /etc/init.d/nagios       restart

常见问题:

---------------------------------------------------------------------

Starting nagios:touch: cannot touch `/usr/local/nagios/var/nagios.log': Permission denied

 done.

解决办法:权限问题,将/usr/local/nagios/var/nagios.log改为chown nagios:nagios问题解决。

---------------------------------------------------------------------

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, root and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Apache/2.2.3 (CentOS) Server at 192.168.1.142 Port 80

解决办法:

http配置错误,与以前的配置同名了,唉!

---------------------------------------------------------------------

checking for SSL headers... configure: error: Cannot find ssl headers

解决办法:yum install openssl-devel

---------------------------------------------------------------------

通过Web访问nagios出现You don't have permission to access /nagios/ on this server提示

安装nagios后,通过web访问nagios时,浏览器提示:You don't have permission to access /nagios/ on this server 

问题分析:提示显示是没有权限,首先检测nagios配置文件,如果nagios配置文件都正确。那可能是因为系统缺少php包,我装了两次都是遇到没有php包。

解决方法:使用yum命令直接安装php包:#yum install php 

安装好后,再重启httpd命令:service httpd restart。

---------------------------------------------------------------------

描述:安装好pnp4nagios后打开pnp4nagios要求你输入用户名密码,始终输入不正确。然后页出现如下错误提示Authorization Required

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

解决办法:是由于在安装pnp4nagios后在/etc/httpd/conf.d里,已经生成pnp4nagios.conf配置文件,配置文件有 AuthUserFile /usr/local/nagios/etc/htpasswd.user参数,与密码文件名一致,

导致,始终无法正确输入用户密码,修改相应的文件名就可以了。唉纠结了半天才发现。

---------------------------------------------------------------------

错误描述:登入pnp4nagios时开启php.ini的magic_quotes_gpc = On,然后出现错误提示: magic_quotes_gpc is deprecated

解决办法:magic_quotes_gpc = Off

---------------------------------------------------------------------

错误描述:service nagios restart

Running configuration check...done.

Stopping nagios: done.

Starting nagios:su: warning: cannot change directory to /dev/null: Not a directory

This account is currently not available.

原因未知,反正可以正常使用程序。

转载于:https://my.oschina.net/fufangchun/blog/87308

转载地址:https://blog.csdn.net/weixin_33782386/article/details/92450781 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:kubernetes V1.6.6 与V1.5配置大变动之问题及解决办法
下一篇:通过SecureCRT连接AWS EC2 Linux

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月04日 03时32分03秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

【Leetcode刷题篇】剑指offer55-平衡二叉树 2019-04-26
【Leetcode刷题篇】leetcode98 判断一棵树是否为二叉搜索树 2019-04-26
Java中arraylist和数组的相互转换 2019-04-26
【Leetcode刷题篇 】leetcode147 对链表进行插入排序 2019-04-26
【Leetcode刷题篇】leetcode148 排序链表 2019-04-26
【面试篇】Java中String、StringBuilder与StringBuffer的区别? 2019-04-26
【面试篇】Java对象的hashCode()相同,equals()一定为true吗? 2019-04-26
【面试篇】Java中static和final关键字的作用是什么? 2019-04-26
【面试篇】Java中接口和抽象类的区别是什么? 2019-04-26
【Java网络编程与IO流】Java中IO流分为几种?字符流、字节流、缓冲流、输入流、输出流、节点流、处理流 2019-04-26
【Java网络编程与IO流】Java中BIO、NIO、AIO的区别是什么? 2019-04-26
【Leetcode刷题篇】leetcode136 只出现一次的数字 2019-04-26
spring boot整合thymeleaf,支持JSP和HTML页面开发 2019-04-26
【Java网络编程与IO流】Spring boot整合SSE实现服务器实时推送流信息 2019-04-26
【Java网络编程与IO流】SpringBoot + WebSocket + Netty实现实时的服务器消息推送 2019-04-26
【Leetcode刷题篇】leetcode141 环形链表II 2019-04-26
【Leetcode刷题篇】leetcode160 相交链表 2019-04-26
【Leetcode刷题篇】leetcode169 多数元素 2019-04-26
【Leetcode刷题篇】leetcode461 汉明距离 2019-04-26
【Leetcode刷题篇】leetcode204 计数质数 2019-04-26