一、前提:系統、PHP、Apache、MySQL、Mail都工作正常,在這不做介紹;
二、需要安裝:gcc、glibc、gd、gd-devel、openssl-devel、httpd-devel、per-GD、net-snmp-devel、php-pdo、php-gd、perl-Crypt-DES,為了方便避開煩人的包依賴問題,我直接
yum install httpd*、php*、net-snmp、mysql*、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 //將apache、nagios用戶加入到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;