fjqzyc 发表于 2019-1-17 09:12:54

nagios 监控笔记(一)

Nagios监控主机笔记(一)
参考资料
http://sery.blog.运维网.com
http://blog.myspace.cn/yangbo0015/category/500769.aspx
nagios 监控目的
             即时了解服务器运行状况,服务运行情况,通过mail、手机短信、声音报警通知管理员,以便处理问题。

一、nagios 监控分为二个部份:
      1)、nagios服务器端(以下简称server端)
server端所需软件包: Apache、nagios-3.0.6、nrpe-2.8.1、nagios-plugins-1.4.13、sendmail、nagios-mysql-plugins、nagios-mysql-plugins-0.3.tar.gz、perl等


      2)、监控服务器端(以下简称client端)
client端所需软件包:
nrpe-2.8.1、nagios-plugins-1.4.13等
nagios、nagios-plugins、nrpe下载地址http://www.nagios.org/download/
nagios是一款开源的监控软件,能够对网络内的主机和硬件设备进行状态监控。
功能:
   1. 状态监控
   2. 预警报告
   3. 集中,规模化管理
   4. web可视化显示方式
   5. 自定义shell脚本或插件实现更多的功能
   官方网站 http://www.nagios.org
NRPE是nagios的一个扩展,它被用于被监控的服务器上,向nagios监控平台提供该服务器的一些本地的情况。例如,cpu负载、内存使用、硬盘使用等等。
nagios-plugins是nagios监控服务器的插件
nagios-mysql-plugins、nagios-mysql-plugins 是监控mysql服务器的插件
二、nagios服务器的安装
   1)、nagios安装
root@nagios#useradd nagios -s /sbin/nologin
mkdir /usr/local/nagios
tar zxvf nagios-3.0.6
cd nagios
./configure –prefix=/usr/local/nagios ----with-nagios-user=nag ios --with-nagios-group=nagios   
make all
make install   
make install-commandmode
make install-config



2)、Apache安装与配置
       tar zxvf httpd-2.2.8.tar.gz
cd httpd-2.2.8
./configure    --prefix=/usr/local/apache   
make
make install


            配置nagios如下
在apache的配置httpd.conf中加入
include conf/nagios.conf
nagios.conf内容如下
NameVirtualHost *:80

   ServerName localhost
   DirectoryIndex index.html index.php
   Alias /nagios/cgi-bin /usr/local/nagios/sbin
   
       AuthType Basic
       Options ExecCGI
       AddHandler cgi-script cgi pl
       AllowOverride None
       Order allow,deny
       Allow from all
#       AuthName "Nagios Access"
#      AuthUserFile /usr/local/nagios/etc/htpasswd
#       Require valid-user
   

    Alias /nagios /usr/local/nagios/share
   
      AuthType Basic
      Options None
      AllowOverride None
      Order allow,deny
      Allow from all
#      AuthName "nagios Access"
#   AuthUserFile /usr/local/nagios/etc/htpasswd
#      Require valid-user
   



创建http验证用户htpasswd文件,用户名为test,密码可以随便设置
root@nagios#htpasswd -c /usr/local/nagios/etc/htpasswd test
New password:
Re-type new password:
Adding password for user test

          3)、nagios-plugins安装
tar zxvf nagios-plugins-1.4.13
cd nagios-plugins
./configure --prefix=/usr/local/nagios
#安装目录选择/usr/local/nagios,因为该目录下的libexec目录下的插件是nagios监控所需要的
make && make install


4)、检查远程服务器nrpe 连接,可显示版本号。如果能正确显示版本号,说明nrpe 服务能正常连接.
/usr/local/nrpe/libexec/check_nrpe -H 192.168.1.22
NRPE v2.12


三、client服务端的安装与配置
      1)、nagios-plugins安装
root@client#mkdir /usr/local/nagios
tar zxvf nagios-plugins-1.4.13   
cd nagios-plugins   
./configure --prefix=/usr/local/nagios
make && make install


      2)、nrpe安装
root@client#mkdir /usr/local/nrpe
tar zxvf nrpe-2.8.1
cd nagios
./configure --prefix=/usr/local/nrpe
make && make install

    3)、windows客户端的安装nsclient
下载nsclient包 下载地址:http://sourceforge.net/projects/nscplus
nsclient_201.zip
解压包到c:\nsclient
打开cmd命令行提示符输入:
c:
cd c:\nsclient
pNSClient.exe /install
net start nsclient
安装完成





附件:http://down.运维网.com/data/2352400

页: [1]
查看完整版本: nagios 监控笔记(一)