Ubuntu下nagios安装pnp4nagios插件

简介:

Ubuntu下nagios安装pnp4nagios插件:


# apt-get install rrdtool

# apt-get install librrds-perl

# apt-get install php5 php5-gd

# tar zxvf  pnp4nagios-0.6.6.tar.gz
# cd pnp4nagios-0.6.6
# /configure --with-nagios-user=nagios --with-nagios-group=nagios
# make all
# make install
# make install-config
# make install-init

# mv sample-config/httpd.conf sample-config/nagiosweb.conf
# cp sample-config/nagiosweb.conf /etc/apache2/conf.d/
# vi /etc/apache2/conf.d/nagiosweb.conf

AuthType /usr/local/nagios/etc/htpasswd   (原为AuthType /usr/local/nagios/etc/htpasswd.users)

:wq

# service apache2 restart


# 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-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

启动npcd服务

# service npcd start


# vi /usr/local/nagios/etc/nagios.cfg  (把前面的注释符"#"去掉)

process_performance_data=1 (原为process_performance_data=0)
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata

:wq

# vi /usr/local/nagios/etc/objects/commands.cfg

# '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
       }

:wq


注:要注释掉原有对process-service-perfdata和process-host-perfdata的定义

为主机添加小太阳图标

# vi /usr/local/nagios/etc/objects/yang.cfg


define host {
use       linux-server
host_name    yang
address      192.168.1.10
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$
}

:wq

为单个服务添加小太阳图标

# vi /usr/local/nagios/etc/objects/yang.cfg

define service {
use        generic-service
host_name   yang
service_description      check_load
check_command       check_nrpe!check_load
normal_check_interval     2
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$

}

:wq



重启 nagios 服务

# service nagios restart



# mv /usr/local/pnp4nagios/share/install.php  /usr/local/pnp4nagios/share/install2.php   (或者直接删除)

注:点击小太阳图标后会出现个测试页面,各项要求都PASS了,会提示你重命名或删除install.php文件,原因不详



# ls /usr/local/pnp4nagios/var/perfdata  (看下面有没有nagios中定义的主机名目录以及目录下面有没有对应服务的rrd文件和xml文件)

注:nagio图像(pnp4nagios)只能显示nagios插件中的服务,以脚本监控的服务不显示图像

本文转自linux博客51CTO博客,原文链接http://blog.51cto.com/yangzhiming/1380537如需转载请自行联系原作者


yangzhimingg

相关文章
|
16天前
|
Ubuntu Linux Python
Linux(15)Ubuntu安装ninja构建工具
Linux(15)Ubuntu安装ninja构建工具
65 0
|
1天前
|
Ubuntu Python
Ubuntu 安装Python3.8
Ubuntu 安装Python3.8
9 0
|
2天前
|
Ubuntu 应用服务中间件 nginx
ubuntu编译安装nginx及安装nginx_upstream_check_module模块
以上是编译安装Nginx和安装 `nginx_upstream_check_module`模块的基本步骤。根据你的需求和环境,你可能需要进一步配置Nginx以满足特定的要求。
15 3
|
4天前
|
资源调度 JavaScript Ubuntu
Yarn介绍及快速安装Debian/Ubuntu Linux
现在,你已经成功安装了Yarn,可以在你的JavaScript项目中使用它来管理依赖。
40 3
|
4天前
|
Ubuntu
Ubuntu20.04安装SNMP服务
至此,你已经成功在Ubuntu 20.04上安装了SNMP服务。你可以使用SNMP工具来监视和管理你的系统,或者将其集成到网络管理系统中。
20 3
|
8天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 20.04 + mysql8 安装以及配置大小写不敏感
Ubuntu 20.04 + mysql8 安装以及配置大小写不敏感
|
8天前
|
缓存 Ubuntu 数据库
ubuntu无法使用apt命令时怎么安装库
无论哪种方法,一旦成功安装了所需的库文件,你应该能够在Ubuntu系统上正常使用它们。如果问题仍然存在,可能需要进一步检查系统的包管理配置和依赖关系问题。
27 0
|
10天前
|
Ubuntu Shell 网络安全
【专栏】如何在 Ubuntu 22.04 上安装 KubeSphere?
【4月更文挑战第28天】在Ubuntu 22.04上安装KubeSphere的指南:确保系统至少有4GB内存和2核CPU,安装Docker和docker-compose。下载安装脚本`curl -sSL https://kubesphere.io/install.sh | bash`,根据提示选择安装选项,等待完成。安装后,通过访问控制台验证安装效果。解决可能出现的错误、网络问题和性能问题,利用KubeSphere提升容器管理效率。本文为顺利安装和使用提供参考。
|
12天前
|
Ubuntu Linux 网络安全
|
12天前
|
Ubuntu 关系型数据库 数据库