Nagios 配置笔记


一、前提:系统、PHPApacheMySQLMail都工作正常,在这不做介绍;
二、需要安装:gccglibcgdgd-developenssl-develhttpd-develper-GDnet-snmp-develphp-pdophp-gdperl-Crypt-DES,为了方便避开烦人的包依赖问题,我直接
yum install httpd*php*net-snmpmysql*glibc*;
需要下载的源码包:
nagios: http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.2.tar.gz
nagios-plugins: http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
nrpe: http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
nagios-snmp-plugins: http://nagios.manubulon.com/nagios-snmp-plugins.1.1.1.tgz
###############################################  开始安装、配置  #####################################################
1、修改/etc/snmpd/snmped.conf,完成后的文件;
[root@Monitor nagios]# cat /etc/snmp/snmpd.conf | grep -v "#"
sec.name  source          community            //去掉此处的#
com2sec notConfigUser  127.0.0.1       public  
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
group          context sec.model sec.level prefix read   write  notif           //去掉此处的#
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat

2、启动snmpd
service snmpd start

3、安装Nagios;
groupadd nagios
useradd -g nagios nagios
passwd nagios

mkdir /usr/local/nagios
chown -R nagios:nagios /usr/local/nagios
chmod 755 /usr/local/nagios/
usermod -G nagios apache    //apachenagios用户加入到nagios组里;
usermod -G nagios nagios

tar zxf nagios-3.2.2.tar.gz

cd nagios-3.2.2
./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/lib --with-gd-inc=/usr/include --enable-event-broker
根据如下提示:
the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type 'make'
without any arguments for a list of all possible options):

make install
- This installs the main program, CGIs, and HTML files

make install-init
- This installs the init script in /etc/rc.d/init.d

make install-commandmode
- This installs and configures permissions on the
directory for holding the external command file

make install-config
- This installs *SAMPLE* config files in /usr/local/nagios/etc
You'll have to modify these sample files before you can
use Nagios.  Read the HTML documentation for more info
on doing this.  Pay particular attention to the docs on
object configuration files, as they determine what/how
things get monitored!

make install-webconf
- This installs the Apache config file for the Nagios
web interface
*** Support Notes *******************************************

If you have questions about configuring or running Nagios,
please make sure that you:

- Look at the sample config files
- Read the HTML documentation
- Read the FAQs online at http://www.nagios.org/faqs

before you post a question to one of the mailing lists.
Also make sure to include pertinent information that could
help others help you.  This might include:

- What version of Nagios you are using
- What version of the plugins you are using
- Relevant snippets from your config files
- Relevant error messages from the Nagios log file
For more information on obtaining support for Nagios, visit:

http://www.nagios.org/support/

依次执行如下操作:
make all
make all install
make install-init               
make install-commandmode
make install-config        
make install-webconfig

4、安装nagios-plugins;
tar zxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --prefix=/usr/local/nagios-plugins
make
make install

安装完成以后在/usr/local/nagios-plugins会产生一个libexec的目录,
将该目录全部移动到/usr/local/nagios目录下即可。
如下:
mv /usr/local/nagios-plugins/libexec /usr/local/nagios/
5、安装nagios-snmp-plugins
tar xzf nagios-snmp-plugins.1.1.1.tgz
cd nagios_plugins
perl -MCPAN -e shell
接着一直回车;
直到提示符变为cpan>时输入:
cpan>install Net::SNMP
完成安装后退出:quit
最后执行./install.sh
  • 1
  • 2
  • 下一页

相关内容