Skip to content

Commit 568fab9

Browse files
committedFeb 3, 2015
nagios.sh
1 parent 2944b2f commit 568fab9

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed
 

‎monitor/nagios/nagios.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# yum 与 apt 版本过低所以需要编译安装
3+
4+
curl -s https://raw.githubusercontent.com/oscm/shell/master/compiler/gcc.sh | bash
5+
6+
cd /usr/local/src
7+
wget http://softlayer-sng.dl.sourceforge.net/project/nagios/nagios-4.x/nagios-4.0.8/nagios-4.0.8.tar.gz
8+
wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz
9+
tar zxf nagios-4.0.8.tar.gz
10+
tar zxf nagios-plugins-2.0.3.tar.gz
11+
12+
cd nagios-4.0.8
13+
./configure --prefix=/srv/nagios-4.0.8
14+
make all
15+
make install && make install-init && make install-commandmode && make install-config
16+
# make install-webconf && make install-exfoliation && make install-classicui
17+
18+
cd /usr/local/src
19+
20+
cd nagios-plugins-2.0.3
21+
./configure --prefix=/srv/nagios-4.0.8 --with-nagios-user=nagios --with-nagios-group=nagios
22+
make && make install
23+
24+
ln -s /srv/nagios-4.0.8 /srv/nagios
25+
useradd -s /sbin/nologin -d /srv/nagios nagios
26+
27+
chkconfig --add nagios
28+
chkconfig nagios on
29+
chkconfig --list nagios

‎monitor/nagios/nrpe.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
yum install -y nrpe nagios-plugins
4+
vi /etc/nagios/nrpe.cfg <<VIM > /dev/null 2>&1
5+
:%s/allowed_hosts=127.0.0.1/allowed_hosts=172.16.1.2/
6+
:wq
7+
VIM
8+
9+
cat >> /etc/nagios/nrpe.cfg <<EOF
10+
11+
#command[check_http]=/usr/lib64/nagios/plugins/check_http -I 127.0.0.1 -p 80 -u http://www.example.com/index.html
12+
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%
13+
command[check_all_disks]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -e
14+
EOF
15+
16+
chkconfig nrpe on
17+
service nrpe start
18+
19+
cat >> cat /etc/services <<EOD
20+
21+
nrpe 5666/tcp # NRPE
22+
EOD
23+
24+
/usr/local/nagios/libexec/check_nrpe -H localhost
File renamed without changes.

0 commit comments

Comments
 (0)
Please sign in to comment.