一。 环境:

1. centos 6.4

2. 设置hostname 并且安装好apache

3. 关闭selinux及iptables

二。 安装nagios服务器端:

1. rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2. yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php

3. chkconfig httpd on && chkconfig nagios on

4. service httpd start && service nagios start

5. 设置nagiosadmin密码:

htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

6. 登陆:开浏览器,输入密码,在host里面应该有“localhost”这台机器
         http://{your_ip_address}/nagios

三。 安装pnp4nagios:

1. yum install pnp4nagios rrdtool

四。配置pnp4nagios:

      1,修改nagios.cfg

  1. [root@localhost objects]# vim /etc/nagios/nagios.cfg    //修改以下内容
  2. process_performance_data=1                             //由0改为1
  3. host_perfdata_command=process-host-perfdata            //前面的注释拿掉
  4. service_perfdata_command=process-service-perfdata      //注释拿掉
  5. enable_environment_macros=1                            //如果有注释拿掉

     2,修改commands.cfg

         注释掉原有对process-host-perfdata和process-service-perfdata,重新定义

  1. [root@localhost objects]# vim /etc/nagios/objects/commands.cfg
  2. define command {
  3. command_name    process-service-perfdata
  4. command_line    /usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl
  5. }
  6. define command {
  7. command_name    process-host-perfdata
  8. command_line    /usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl -d HOSTPERFDATA
  9. }

     3、修改配置文件templates.cfg

  1. [root@localhost objects]# vim /etc/nagios/objects/templates.cfg
  2. define host {
  3. name       hosts-pnp
  4. register   0
  5. action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
  6. process_perf_data               1
  7. }
  8. define service {
  9. name       srv-pnp
  10. register   0
  11. action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
  12. process_perf_data               1
  13. }

     4,修改服务器配置文件localhost.cfg

  1. [root@localhost objects]# vim /etc/nagios/localhost.cfg
  2. define host{
  3. use                     linux-server,hosts-pnp
  4. host_name               localhost
  5. alias                   localhost
  6. address                 127.0.0.1
  7. }
  8. define service{
  9. use                             local-service,srv-pnp
  10. host_name                       localhost
  11. service_description             PING
  12. check_command                   check_ping!100.0,20%!500.0,60%
  13. }

上面只是例举了一个,你可以都加一下。

在网上好多关于pnp4nagios的文章,都是要把mv misccommands.cfg-sample misccommands.cfg 生成配置文件,我是yum安装的,安装目录下根本没有sample这样的东西

  1. [root@localhost objects]# tree /etc/pnp4nagios/
  2. /etc/pnp4nagios/
  3. ├── background.pdf
  4. ├── check_commands
  5. │   ├── check_all_local_disks.cfg
  6. │   ├── check_nrpe.cfg
  7. │   └── check_nwstat.cfg
  8. ├── config.php
  9. ├── misccommands.cfg
  10. ├── nagios.cfg
  11. ├── npcd.cfg
  12. ├── pages
  13. │   └── web_traffic.cfg
  14. ├── pnp4nagios_release
  15. ├── process_perfdata.cfg
  16. └── rra.cfg

所在我根本没有配置任何东西。

       5,重启nagios,启动npcd

  1. [root@localhost pnp4nagios]# /etc/init.d/npcd start
  2. [root@localhost pnp4nagios]# /etc/init.d/nagios restart

五。 登陆错误处理:

登陆http://{your_ip_address}/nagios,发现密码认证不对,请修改以下内容:

vi /etc/httpd/conf.d/pnp4nagios.conf

把 AuthUserFile /etc/nagios/passwd 修改为

AuthUserFile /etc/nagios/htpasswd.users

完工,小太阳可以看到,并且点击开来。

六。 配置调试命令

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

[root@nagios-mendian mendian]# /usr/bin/nagios -v /etc/nagios/nagios.cfg

Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config directory '/etc/nagios/mendian'...
Processing object config file '/etc/nagios/mendian/BeiJingXiLu.cfg'...
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 8 services.
Checking hosts...
Warning: Host 'BeiJingXiLu' has no services associated with it!
Checked 2 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 1
Total Errors: 0

nagios&pnp4nagios--yum 安装的更多相关文章

  1. Nagios+pnp4nagios+rrdtool 安装配置nagios被监控端NRPE配置(二)

    NRPE监控插件基础 NRPE总共由两部分组成: (1).check_nrpe插件,运行在监控主机上. (2).NRPE daemon,运行在远程的linux主机上(通常就是被监控机) 整个的监控过程 ...

  2. Nagios+pnp4nagios+rrdtool 安装配置nagios(一)

    基于的软件版本 Apache-2.0.63  php-5.3.2 nagios-3.2.3  nagios-plugins-1.4.15  rrdtool-1.4.5 nrpe-2.12 pnp4na ...

  3. Nagios+pnp4nagios+rrdtool 安装配置为nagios添加自定义插件(三)

    nagios博大精深,可以以shell.perl等语句为nagios写插件,来满足自己监控的需要.本文写mysql中tps.qps的插件,并把收集到的结果以图形形式展现出来,这样输出的结果就有一定的要 ...

  4. 通过yum安装Nagios

    通过yum安装Nagios 2012年04月05日 ⁄ Nagios ⁄ 暂无评论   QQ空间新浪微博腾讯微博人人网更多3   前提先自行安装好Apache+php 测试环境主监控机:CentOS ...

  5. Nagios的基本安装配置

    //////////////////////nagios//////////////////////nagios原理:http://www.linuxidc.com/Linux/2013-11/927 ...

  6. Linux CentOS 6.5 yum安装MongoDB的操作

    安装MongoDB的方法有很多种,可以源代码安装,在CentOS也可以用yum源安装的方法.由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法.64位CentOS下的安装步骤如下: 1.准 ...

  7. 1. Nagios和 NagiosQL安装及配置

    目录 1. Nagios 和 NagiosQL简介 2. Nagios+NagiosQL搭建环境说明 3. Nagios.Nagios-plugins和NagiosQL的安装 4. 配置NagiosQ ...

  8. LDAP-openldap服务部署和测试(YUM安装)

    1. 概述2. 服务端部署过程2.1 软件包说明2.2 部署过程2.3 配置过程3. 测试4. 生成LDIF格式文件4.1 安装migrationtools工具4.2 用migrationtools生 ...

  9. nagios服务端安装

    系统环境:操作系统:CentOS-5.7 x86_64Apache版本: Apache-2.2.22Nagios版本: nagios-3.3.1GD库: gd-2.0.33 2.安装前准备:2.1.安 ...

  10. nagios 插件ndoutils 安装配置

    nagios 插件ndoutils 安装配置 原文地址:http://www.cnblogs.com/caoguo/p/5022645.html # Nagios install ndoutils # ...

随机推荐

  1. PHP 魔术方法 __clone __toString(五)

    __clone() - 当对象克隆的时候自动加载此方法 __toString() - 当对象需要echo打印输出的时候自动加载此方法 __clone() <?php class example{ ...

  2. 【基于spark IM 的二次开发笔记】第一天 各种配置

    [基于spark IM 的二次开发笔记]第一天 各种配置 http://juforg.iteye.com/blog/1870487 http://www.igniterealtime.org/down ...

  3. Python urllib2 模块学习笔记

    2015.3.6  urllib2的使用方法大致如下 # 定制Handler处理函数 opener = urllib2.build_opener(ProxyHandler, HTTPHandler) ...

  4. .NET基础之深度复制和浅度复制

    之前一直没有搞清楚深度复制和浅度复制的区别到底在哪里,今天彻底把这个东西弄懂了,写出来与到家共勉. 如果大家不懂值类型和引用类型的区别,请先看http://www.cnblogs.com/Autumo ...

  5. 3、WPF学习之-布局

    一.基础知识 1.所有WPF布局容器都派生自System.Windows.Controls.Panel抽象类的面板: 2.WPF种核心布局面板有StackPanel(栈面板).WrapPanel(环绕 ...

  6. Xubuntu下Mentohust认证(校园网用户)

    对于路由器上网到用户来说,自动分配IP上网。 对于校园网用户,首先下载mentohust_0.3.4-1_i386.deb,双击安装程序 然后在命令窗口中输入sudo -s 密码:user来获得roo ...

  7. Perl内置变量速查表

    [ 文件句柄 ] $| 如果非零, 则在对当前选定的文件执行写或打印操作后强制清除缓冲区 $% 当前选中文件句柄的当前页码 $= 当前选中文件句柄的当前页面长度 $- 当前选中文件句柄的页面剩余长度 ...

  8. K2 Blackpearl 4.6.8 安装步骤详解

    由于某些原因,我幼小的心灵受到了很大的创伤,倍感世态之炎凉,久久不能愈合,也因此很久没再接触K2 Blackpearl了.偶然来了兴趣,想整个K2的环境,闲暇之余了解其新功能,温故知新,也希望从中能讨 ...

  9. iOS开发学习路线图

    很多初学iOS开发的人会经常问:“我想学iOS应该从何入手呢?”.作为一个做了2年多各种iOS开发的程序员,只想写写自己的一些心得体会,好和体验与不好的体验.写的不好,请多包涵.希望能起到抛砖引玉的作 ...

  10. POJ 2516 最小费用最大流

    每一种货物都是独立的,分成k次最小费用最大流即可! 1: /** 2: 因为e ==0 所以 pe[v] pe[v]^1 是两条相对应的边 3: E[pe[v]].c -= aug; E[pe[v]^ ...