ITPub博客

首页 > 数据库 > Oracle > nagios snmp 安装记录

nagios snmp 安装记录

原创 Oracle 作者:denglt 时间:2015-01-21 11:39:10 0 删除 编辑


1、安装依赖的包

  (1) yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp
  (2) service httpd start
 
2、创建用户

 [root@namenode httpd]# useradd nagios
 [root@namenode httpd]# passwd nagios
 
 [root@namenode httpd]# groupadd nagcmd
 [root@namenode httpd]# usermod -a -G nagcmd nagios
 [root@namenode httpd]# usermod -a -G nagcmd apache 
 
3、安装Nagios Core Service
 cd /opt/
 wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz
 tar xzf nagios-4.0.8.tar.gz
 cd nagios-4.0.8
 ./configure --with-command-group=nagcmd
  注意:可以使用--prefix=/opt/nagios 设置nagios的安装路径(默认安装在/usr/local/nagios)
 make all
 make install
 make install-init
 make install-config
 make install-commandmode
 

 Now use below command to setup apache configuration for Nagios installation.
[root@namenode nagios-4.0.8]# make install-webconf                                                                                                          
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf # make install-webconf                                                     
                                                                                
*** Nagios/Apache conf file installed ***  

[root@namenode conf.d]# pwd
/etc/httpd/conf.d
[root@namenode conf.d]# ll
总用量 16
-rw-r--r--  1 root root 982 1月  15 16:01 nagios.conf


4、配置Apache权限

[root@namenode etc]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin                                    
New password:                                                                   
Re-type new password:                                                           
Adding password for user nagiosadmin                                                                                                                          
[root@namenode etc]# more htpasswd.users                                        
nagiosadmin:SdUBSyZ7jQUA.  

注:输入的密码:nagiosadmin


 
 重启httpd
 service httpd restart

5、安装nagios plugins

wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
tar xzf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
 ./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
 
 检查插件:
 [root@namenode /]#  /usr/local/nagios/libexec/check_ping -H www.baidu.com -w 100.0,10% -c 100.0,30% -p 10 -t 2
PING OK - Packet loss = 0%, RTA = 31.42 ms|rta=31.417000ms;100.000000;100.000000;0.000000 pl=0%;10;30;0


6、验证和启动 nagios
 
[root@namenode /]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 8 services.
        Checked 1 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 1 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0 


  service nagios start
 
 配置自动启动
 chkconfig --add nagios
 chkconfig nagios on
 chkconfig httpd on             
 
7、通过web访问Nagios

curl http://172.16.108.210/nagios                                       


8、插件下没有check_snmp

 yum install net-snmp-devel net-snmp-perl  net-snmp-python net-snmp-utils
 
 再安装nagios plugins后,可以在插件目录上看到check_snmp
 
 [root@namenode libexec]# ./check_snmp -H 172.16.108.212 -C public -o .1.3.6.1.2.1.1.4.0
SNMP OK - "Root <root@localhost> (configure /etc/snmp/snmp.local.conf)" |
./check_snmp -h


9、验证check_snmp
 在212启动snmpd
 [root@namenode ~]# /usr/local/nagios/libexec/check_snmp -H 172.16.108.212 -C public -o .1.3.6.1.4.1.2021.4.3.0
 SNMP OK - 4194296 | iso.3.6.1.4.1.2021.4.3.0=4194296
 [root@namenode ~]# snmpget -c public 172.16.108.212 .1.3.6.1.4.1.2021.4.3.0 -v1
 UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 4194296 kB
 [root@namenode ~]#

注意:如果执行有错误,检查212上的/etc/snmp/snmpd.conf是否开放了对应的OID权限。如下:
#       name           incl/excl     subtree         mask(optional)
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1

view    systemview    included   .1.3.6.1.4.1


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/195110/viewspace-1409167/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 记HBase集群安装
请登录后发表评论 登录
全部评论

注册时间:2010-11-04

  • 博文量
    118
  • 访问量
    702884