NAGIOS+CACTI服务器安装
NAGIOS+CACTI服务器安装Nagios服务端安装
============================
1.解决perl插件编译安装问题
echo 'export LC_ALL=C' >> /etc/profile
source /etc/profile
echo $LC_ALL
2.安装必须软件
yum -y install gcc glibc glibc-common gdgd-devel httpd php* mysql*
3.添加nagios和httpd用户
/usr/sbin/useradd nagios
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
groups nagios
groups apache
4.启动lamp服务
vim /etc/httpd/conf/httpd.conf +402
/etc/init.d/httpd start
chkconfig httpd --level 3 on
vim /etc/httpd/conf/httpd.conf+276
#注意修改ServerName 127.0.0.1:80避免apache启动报错
5.编译安装nagios
cd /soft
wget http://soft.local.com/nagios-3.5.1.tar.gz
tar zxf nagios-3.5.1.tar.gz
cd nagios
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config
6.安装nagios的web配置文件和建立登录用户
cd /soft/nagios
make install-webconf
#在nagios的软件解压目录里面执行
7.修改nagios的登录密码
htpasswd -cb /usr/local/nagios/etc/htpasswd.users yjb007 123456
8.启用sendmail服务
yum -y install sendmail
/etc/init.d/sendmail start
chkconfig sendmail --level 3 on
9.安装nagios服务端插件
yum -y install perl-CPAN
cd /soft
wget http://soft.local.com/nagios-plugins-1.4.16.tar.gz
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules
make
make install
10.开机启动nagios
chkconfig --level 3 nagios on
11.检查nagios的配置文件语法
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
/etc/init.d/nagios checkconfig
vim /etc/init.d/nagios +177
12.启动nagios
/etc/init.d/nagios start
ps -ef | grep nagios
13.服务端安装nrpe,因为nagios是主动查询报警
cd /soft
wget http://soft.local.com/nrpe-2.12.tar.gz
tar zxf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
ll /usr/local/nagios/libexec/check_nrpe
14.配置nagios.cfg
-------------------------------------
vim /usr/local/nagios/etc/nagios.cfg +34
cfg_dir=/usr/local/nagios/etc/objects/services
#目录下面的.cfg文件全部生效
#注释掉所有cfg_file=
15.修改vim ../cgi.cfg
sed -i s#nagiosadmin#yjb007#g /usr/local/nagios/etc/cgi.cfg
16.重载nagios
/etc/init.d/nagios reload
17.Nagios出图配置:PNP出图-服务器端
---------------------------------------------
yum -y install zlib zlib-devel freetype freetype-devel gd gd-devel cairo pango
cd /soft
wget http://soft.local.com/libart_lgpl-2.3.17.tar.gz
tar zxf libart_lgpl-2.3.17.tar.gz
cd libart_lgpl-2.3.17
./configure
make
make install
/bin/cp -r /usr/local/include/libart-2.0/ /usr/include/
cd /soft
wget http://soft.local.com/rrdtool-1.2.14.tar.gz
tar zxf rrdtool-1.2.14.tar.gz
cd rrdtool-1.2.14
./configure --prefix=/usr/local/rrdtool --disable-python --disable-tcl
make
make install
ll /usr/local/rrdtool/bin/
cd /soft
wget http://soft.local.com/pnp-0.4.14.tar.gz
tar zxf pnp-0.4.14.tar.gz
cd pnp-0.4.14
./configure--with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata=/usr/local/nagios/share/perfdata
make all
make install
make install-config
make install-init
#检测安装成功与否,出图数据脚本,安装完毕
ll /usr/local/nagios/libexec/process_perfdata.pl
18.配置nagios出图配置
--------------------------------------------
vim /usr/local/nagios/etc/nagios.cfg +831
process_performance_data=1
#修改成1,存储监控数据
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata
#将这两行取消注释
19.图形界面地址
http://192.168.1.18/nagios/pnp/index.php
CACTI安装配置
----------------------------------------------------------
客户端安装snmp
1.yum -y install net-snmp*
ll /etc/snmp/snmpd.conf
2.默认配置文件
cat >/etc/snmp/snmpd.conf
页:
[1]