Skip to content

Commit ffd53cb

Browse files
committed
upgrade
1 parent 68a3fb6 commit ffd53cb

File tree

6 files changed

+74
-46
lines changed

6 files changed

+74
-46
lines changed

install.sh

-35
Original file line numberDiff line numberDiff line change
@@ -41,38 +41,3 @@ yum update -y
4141
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
4242
rpm -K http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
4343
rpm -i http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
44-
45-
46-
yum install ntp -y
47-
vi /etc/ntp.conf <<VIM > /dev/null 2>&1
48-
:22,24s/^/#/
49-
:25,25s/^/\rserver 172.16.3.51\rserver 172.16.3.52\r/
50-
:wq
51-
VIM
52-
service ntpd start
53-
chkconfig ntpd on
54-
55-
yum install net-snmp -y
56-
vi /etc/snmp/snmpd.conf <<VIM > /dev/null 2>&1
57-
:62,62s/systemview/all/
58-
:85,85s/^#//
59-
:wq
60-
VIM
61-
service snmpd start
62-
chkconfig snmpd on
63-
64-
yum install -y nrpe nagios-plugins
65-
vi /etc/nagios/nrpe.cfg <<VIM > /dev/null 2>&1
66-
:%s/allowed_hosts=127.0.0.1/allowed_hosts=172.16.1.2/
67-
:wq
68-
VIM
69-
70-
cat >> /etc/nagios/nrpe.cfg <<EOF
71-
72-
#command[check_http]=/usr/lib64/nagios/plugins/check_http -I 127.0.0.1 -p 80 -u http://www.example.com/index.html
73-
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 20% -c 10%
74-
command[check_all_disks]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -e
75-
EOF
76-
77-
chkconfig nrpe on
78-
service nrpe start

lang/python/python3.tarball.sh

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
22
cd /usr/local/src
33

4+
yum install -y zlib-devel
5+
46
wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
57

68
tar zxf Python-3.4.2.tgz
@@ -9,6 +11,8 @@ cd Python-3.4.2
911
make -j8
1012
make install
1113

14+
strip /srv/python/bin/python3.4
15+
1216
ln -s /srv/python-3.4.2 /srv/python
1317
ln -s /srv/python/bin/python3 /usr/bin/python3
1418

monitor/nagios/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Nagios
2+
=====
3+
This is a group of installation script, it can achieve fast initialization of your server.
4+
5+
Install Nagios Core
6+
-----
7+
https://raw.githubusercontent.com/oscm/shell/master/monitor/nagios/nagios.sh
8+
9+
Install Nrpe
10+
-----
11+
# Centos6
12+
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
13+
# Centos7
14+
yum localinstall -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-5.noarch.rpm
15+
16+
yum update -y
17+
18+
https://raw.githubusercontent.com/oscm/shell/master/monitor/nagios/nrpe.sh
19+
20+
Donations
21+
---------
22+
We accept tips through [Gittip][tip].
23+
24+
[![Gittip](http://img.shields.io/gittip/Homebrew.svg)](https://www.gittip.com/netkiller/)

monitor/nagios/nagios.sh

+19-4
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,23 @@ define command{
100100
# 'notify-service-by-sms' command definition
101101
define command{
102102
command_name notify-service-by-sms
103-
command_line /srv/sms/alert $CONTACTPAGER$ "Service: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $SHORTDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$"
103+
command_line /srv/sms/alert $CONTACTPAGER$ "State: $SERVICESTATE$\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nTime: $SHORTDATETIME$\nInfo:\n$SERVICEOUTPUT$"
104104
}
105+
106+
# 'check_http' command definition
107+
define command{
108+
command_name check_http_url
109+
command_line $USER1$/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -u '$ARG1$'
110+
}
111+
define command{
112+
command_name check_http_url_string
113+
command_line $USER1$/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -u '$ARG1$' -s '$ARG2$'
114+
}
115+
define command{
116+
command_name check_http_status
117+
command_line $USER1$/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -e '$ARG1$'
118+
}
119+
105120
EOD
106121

107122
cat > /srv/nagios-4.0.8/etc/servers/hostgroups.cfg <<'EOD'
@@ -180,7 +195,7 @@ define host{
180195
notification_period 24x7
181196
notification_interval 120
182197
notification_options d,u,r
183-
contact_groups admins
198+
contact_groups admins, technology
184199
register 0
185200
}
186201
@@ -192,11 +207,11 @@ define service{
192207
max_check_attempts 3
193208
normal_check_interval 1
194209
retry_check_interval 1
195-
;contact_groups admins, technology
210+
contact_groups admins, technology
196211
register 0
197212
}
198213
EOD
199-
# check_interval * normal_check_interval = 检查次数
214+
# check_interval * normal_check_interval = 检查次数
200215

201216
cat > /srv/nagios-4.0.8/etc/servers/timeperiods.cfg <<'EOD'
202217
define timeperiod{

monitor/nagios/nrpe.sh

+25-7
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,41 @@ nagios-plugins-mailq \
1010
nagios-plugins-procs \
1111
nagios-plugins-swap \
1212
nagios-plugins-users \
13-
nagios-plugins-mysql
13+
nagios-plugins-tcp \
14+
nagios-plugins-time \
15+
nagios-plugins-http \
16+
nagios-plugins-openmanage
17+
1418
#nagios-plugins-dig \
1519
#nagios-plugins-dns \
16-
1720
#nagios-plugins-ntp \
1821
#nagios-plugins-smtp \
1922
#nagios-plugins-snmp \
2023
#nagios-plugins-ssh \
21-
#nagios-plugins-tcp \
22-
24+
#nagios-plugins-mysql \
25+
2326

2427
cp /etc/nagios/nrpe.cfg{,.original}
28+
29+
# CentOS 6.5
30+
#vim /etc/nagios/nrpe.cfg <<VIM > /dev/null 2>&1
31+
#:%s/dont_blame_nrpe=0/dont_blame_nrpe=1/
32+
#:210,214s/command/#command/
33+
#:wq
34+
#VIM
35+
36+
# CentOS 6.6
2537
vim /etc/nagios/nrpe.cfg <<VIM > /dev/null 2>&1
26-
:%s/allowed_hosts=127.0.0.1/allowed_hosts=172.16.1.2/
2738
:%s/dont_blame_nrpe=0/dont_blame_nrpe=1/
2839
:210,214s/command/#command/
2940
:wq
3041
VIM
42+
#:%s/allowed_hosts=127.0.0.1/allowed_hosts=172.16.1.2/
43+
echo "include_dir=/etc/nagios/nrpe.d/" >> /etc/nagios/nrpe.cfg
44+
mkdir /etc/nagios/nrpe.d/
3145

32-
cat > /etc/nrpe.d/nrpe.cfg <<'EOF'
46+
#cat > /etc/nrpe.d/plugins.cfg <<'EOF'
47+
cat > /etc/nagios/nrpe.d/plugins.cfg <<'EOF'
3348
command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w $ARG1$ -c $ARG2$
3449
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
3550
command[check_all_disks]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -e
@@ -38,7 +53,10 @@ command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
3853
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s Z
3954
command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$
4055
command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
41-
command[check_procs_args]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -C $ARG3$
56+
command[check_procs_command]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -C $ARG3$
57+
command[check_tcp]=/usr/lib64/nagios/plugins/check_tcp -w $ARG1$ -c $ARG2$ -H $ARG3$ -p $ARG4$
58+
command[check_http]=/usr/lib64/nagios/plugins/check_http -w $ARG1$ -c $ARG2$ -H $ARG3$ -p $ARG4$
59+
command[check_log]=/usr/lib64/nagios/plugins/check_log -F $ARG1$ -O /tmp/$ARG1$.old -q $ARG2$
4260
4361
EOF
4462

os/centos7.sh

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ yum install -y telnet wget rsync vim-enhanced
77
#rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
88
yum localinstall -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-5.noarch.rpm
99

10+
curl -s https://raw.githubusercontent.com/oscm/shell/master/os/ntpd/ntp.sh | bash
11+
1012
yum update -y
1113

1214
cat >> /etc/security/limits.d/20-nofile.conf <<EOF

0 commit comments

Comments
 (0)