Nagios是一个监视系统运行状态和网络信息的监视系统。Nagios能监视所指定的本地或远程主机以及服务,同时提供异常通知功能等。    

安装环境:ubuntu14.04,全是最新的nagios和nagios插件

useradd nagios

编译安装nagios

tar zxf nagios-4.0..tar.gz

cd nagios-4.0.

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

make all

make install

make install-init

make install-commandmode

make install-config

make install-webconf

mv cgi/ /usr/local/nagios/cgi-bin

htpasswd ‐c /usr/local/nagios/etc/htpasswd.users nagiosadmin

编译安装nagios插件

tar zxf nagios-plugins-2.0..tar.gz

cd nagios-plugins-2.0.

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

make

make install

编译安装nrpe(都得装)

NRPE是nagios的一个扩展,它被用于被监控的服务器上,向nagios监控平台提供该服务器的一些本地的情况。例如,cpu负载、内存使用、硬盘使用等等。NRPE可以称为nagios的for linux 客户端。

apt-get install openssl libssl-dev

tar zxf nrpe-2.15

cd nrpe-2.15

./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu

make all

make install-plugin

make install-daemon

make install-daemon-config

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

/usr/local/nagios/libexec/check_nrpe ‐H localhost

NRPE v2.

这就说明check_nrpe连接nrpe daemon是正常的,其他被监控的主机都得这样check_nrpe

监控网络流量check_iftraffic

添加Nrpe.cfg

command[check_iftraffic]=/usr/local/nagios/libexec/check_iftraffic -i eth0 -w  -c  -b  -u m

服务定义

define service{

         use                          generic-service

         host_name                    localhost

         service_description          iftraffic

         check_command               check_nrpe!check_iftraffic

}

提示unable to read output的, 被控机的/tmp下有个traffic_ifeth*,把他的属主改成nagios就可以了

Pnp4nagios安装

pnp4nagios是基于RRD轮循(环状)数据库中所提供的综合信息,以可视化图形的方式呈现给用户的一款nagios插件

apt-get install rrdtool librrds-perl

tar zxf pnp4nagios-0.6..tar.gz

cd pnp4nagios-0.6.

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

make all

make install

make install-webconf

make install-config

make install-init

配置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 pages/

mv web_traffic.cfg-sample web_traffic.cfg

可以开启process_perfdata debug模式修改/usr/local/pnp4nagios/etc/process_perfdata.cfg

LOG_LEVEL = 

会在/usr/local/pnp4nagios/var/perfdata.log显示错误日志,方便查找原因

貌似Synchronous Mode在nagios4.x有bug,日志显示一直找不到nagios环境,但是看官方文档更改enable_environment_macros=1应该影响开启nagios环境。

Bulk配置

修改nagios.cfg

process_performance_data=

#

# service performance data

#

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

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

service_perfdata_file_mode=a

service_perfdata_file_processing_interval=

service_perfdata_file_processing_command=process-service-perfdata-file

#

# host performance data #

#

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

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

host_perfdata_file_mode=a

host_perfdata_file_processing_interval=

host_perfdata_file_processing_command=process-host-perfdata-file

修改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

}

重启nagios,然后就出图了。

一般使用的是默认模板,可以根据不同需求自定义模板temple

Nagios网页界面之Visual Shell

Nagios 提供的网页界面是自带的CGI程序,目前只提供英文语言,如果动手修改其排版,或者汉化核心CGI程序(C语言),则每一次版本更新都需要进行更改,这将是非常繁锁的工作。为了解决这个问题,我们可以通过读取Nagios监控系统的状态信息,即var/status.dat文件,根据其中的字段值来重新设计显示界面。

Nagios Visual shell (Vshell)是一个使用PHP编写的轻量级开源Nagios网页前端,输出的XHTML+CSS代码可以通过W3C标准验证。个人认为,Vshell的界面配色很一般,看一会儿就是会觉得很辛苦,以后的版本还需要加强美工。

apt-get install php-apc

V-Shell takes advantage of the Alternative PHP Cache system (APC), which is of particular importance if you are managing a large installation.

You may need to increase your PHP 'memory_limit' setting in your system's php.ini file if you're using APC.  For large systems try a setting as high as 256-512MB.

wget http://assets.nagios.com/downloads/exchange/nagiosvshell/vshell.tar.gz

tar zxf vshell.tar.gz

cd vshell

修改install.php

define('TARGETDIR',"/usr/local/vshell");

define('APACHECONF',"/etc/httpd/conf.d");       (centos)

define('APACHECONF',"/etc/apache2/conf.d");   (ubuntu)

chmod +x install.php

./install.php

ubuntu14.04下安装Naigos和pnp4nagios的更多相关文章

  1. Ubuntu14.04下安装Hadoop2.5.1 (单机模式)

    本文地址:http://www.cnblogs.com/archimedes/p/hadoop-standalone-mode.html,转载请注明源地址. 欢迎关注我的个人博客:www.wuyudo ...

  2. 二、Ubuntu14.04下安装Hadoop2.4.0 (伪分布模式)

    在Ubuntu14.04下安装Hadoop2.4.0 (单机模式)基础上配置 一.配置core-site.xml /usr/local/hadoop/etc/hadoop/core-site.xml ...

  3. Ubuntu14.04下安装Flash Player

    Ubuntu14.04下安装Flash Player youhaidong@youhaidong:~$ sudo apt-get install flashplugin-nonfree [sudo] ...

  4. Ubuntu14.04下 安装p4c

    参考: Github p4c README Ubuntu14.04下 安装p4c 这里提供一个直接安装p4c的脚本:install_p4c.sh. 1.git clone下来p4c: $ git cl ...

  5. Ubuntu14.04下安装Libsvm,并使用Libsvm

    (1)Ubuntu14.04下安装Libsvm 转载:https://blog.csdn.net/katrinawj/article/details/78915874 一.下载: 网址:http:// ...

  6. ubuntu14.04下安装ffmpeg

    ubuntu14.04下安装ffmpeg 一.安装各种依赖包 1.yasm(libx264需要依赖yasm) sudo apt-get install yasm 2.libx264 sudo apt- ...

  7. ubuntu14.04下安装cudnn5.1.3,opencv3.0,编译caffe及配置matlab和python接口过程记录

    已有条件: ubuntu14.04+cuda7.5+anaconda2(即python2.7)+matlabR2014a 上述已经装好了,开始搭建caffe环境. 1. 装cudnn5.1.3,参照: ...

  8. 在Ubuntu14.04下安装Docker CE(1) - repository篇

    从2017年3月开始,Docker开始分为社区版本和企业版,也就是Docker CE和Docker EE, 原来Ubuntu14.04下,通过sudo apt-get install docker.i ...

  9. ubuntu14.04下安装爬虫工具scrapy

    scrapy是目前准备要学习的爬虫框架,其在ubuntu14.04下的安装过程如下: ubuntu14.04下默认安装了2.7的python以及setuptools,若未安装,可通过下面指令安装: s ...

随机推荐

  1. VS2013 MVC Web项目使用内置的IISExpress支持局域网内部机器(手机、PC)访问、调试

    VS2013内置了IISExpress.做asp.net MVC的web项目开发时,Ctrl+F5和F5启动项目运行(后者是调试模式)的同时都会打开IISExpress,事实上本机对该web项目走的就 ...

  2. FP-Tree算法的实现

    在关联规则挖掘领域最经典的算法法是Apriori,其致命的缺点是需要多次扫描事务数据库.于是人们提出了各种裁剪(prune)数据集的方法以减少I/O开支,韩嘉炜老师的FP-Tree算法就是其中非常高效 ...

  3. codeforces 664A Complicated GCD

    水题..[a,b]区间数的最大公约数. a==b输出a 否则输出1 #include<cstdio> #include<cstring> #include<iostrea ...

  4. E297: Write error in swap file解决方法

    vi打开配置文件后显示E297: Write error in swap file,检查磁盘发现磁盘满了.使用du –max-depth=1 | sort –n –r 查找大文件所在位置并删除.

  5. 费用提前计算相关的DP(BZOJ2037,POJ3042,ZOJ3469)

    在刷ZeroClock大神的区间DP专辑,遇见了ZOJ3469,完全不无从下手,然后有人说是论问题,推荐看徐源盛<对一类动态规划问题的研究>这篇论文,果断得膜拜了下,感觉好神奇,可以把未来 ...

  6. Recommended add-ons/plugins for Microsoft Visual Studio [closed]

    SmartPaster - (FREE) Copy/Paste code generator for strings AnkhSvn - (FREE) SVN Source Control Integ ...

  7. 常用apt cli

    常用的APT命令参数:  apt-cache search package 搜索包  apt-cache show package 获取包的相关信息,如说明.大小.版本等  sudo apt-get ...

  8. 尝试获取TextBox_TextChanged事件订阅列表过程

    项目中有用到动态事件绑定[多种事件],由于可触发多次绑定,所以想获取订阅列表来判断是否已绑定事件,从而避免问题! 查找相关资料得知Delegate的GetInvocationList方法可以获取委托的 ...

  9. javascript如何判断一个对象是否是窗口

    <!DOCTYPE html> <html> <head> </head> <body> <script type="tex ...

  10. UNITY 打包安卓APK

    1,安装JDK.这个直接下就行了. 2,安装android sdk相关.这个比较蛋疼,官网是被墙的.有些网站的包还是需要访问墙外下载的.关键是找对那个能用的包(对我来说就是不FQ). http://p ...