公司的一个项目网站,上线几天就因为磁盘暴满而出了问题,由于其服务器都集中在某一IDC机房内,所以考虑部署套Nagios监控报警系统,考虑到其它项目网站可能有类似需求,所以将其安装过程整理成脚本,方便以后的工作。Nagios服务器自动安装脚本,如下所示(此脚本在Centos5.5|5.6|5.8 x86_64下通过):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
yum
-y install httpd
gcc gcc-c++ glibc glibc-common gd gd-devel useradd nagios groupadd
nagcmd usermod -G
nagcmd nagios usermod -G
nagcmd apache cd /usr/local/src wget
http: //nchc .dl.sourceforge.net /sourceforge/nagios/nagios-3 .0.6. tar .gz wget
http: //nchc .dl.sourceforge.net /sourceforge/nagiosplug/nagios-plugins-1 .4.13. tar .gz wget
http: //prdownloads .sourceforge.net /sourceforge/nagios/nrpe-2 .13. tar .gz tar zxvf
nagios-3.0.6. tar .gz cd nagios-3.0.6 . /configure --with- command -group=nagcmd
--prefix= /usr/local/nagios make all make install make install -init make install -config make install -commandmode make install -webconf cd ../ tar zxvf
nagios-plugins-1.4.13. tar .gz cd nagios-plugins-1.4.13 . /configure --prefix= /usr/local/nagios --with-nagios-user=nagios
--with-nagios-group=nagios make && make install cd ../ tar zxvf
nrpe-2.13. tar .gz cd nrpe-2.13 . /configure make all make install -plugin make install -daemon make install -daemon-config htpasswd
- bc /usr/local/nagios/etc/htpasswd . users nagiosadmin nagiosadmin101 echo " alias nagioscheck=' /usr/local/nagios/bin/nagios - v /usr/local/nagios/etc/nagios .cfg'
" >> /root/ .bashrc source /root/ .bashrc chkconfig
nagios on chkconfig
httpd on service
httpd start service
nagios start |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
useradd nagios cd /usr/local/src wget
http: //nchc .dl.sourceforge.net /sourceforge/nagiosplug/nagios-plugins-1 .4.13. tar .gz wget
http: //prdownloads .sourceforge.net /sourceforge/nagios/nrpe-2 .13. tar .gz tar zxvf
nagios-plugins-1.4.13. tar .gz cd nagios-plugins-1.4.13 . /configure make make install chown nagios:nagios /usr/local/nagios chown -R
nagios:nagios /usr/local/nagios/libexec cd ../ tar zxvf
nrpe-2.13. tar .gz cd nrpe-2.13 . /configure make all make install -plugin make install -daemon make install -daemon-config sed -i 's@allowed_hosts=127.0.0.1@allowed_hosts=114.112.11.11@' /usr/local/nagios/etc/nrpe .cfg /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe .cfg
-d echo "/usr/local/nagios/bin/nrpe
-c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc . local |