Skip to content

Commit f975a92

Browse files
committed
nagios
1 parent 2c9dcaf commit f975a92

File tree

5 files changed

+1964
-0
lines changed

5 files changed

+1964
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Quick-Installation-NAGIOS
2+
https://github.com/X-Mars/Quick-Installation-NAGIOS
3+
##nagios安装脚本
4+
5+
###脚本作者:火星小刘 web:www.huoxingxiaoliu.com email:xtlyk@163.com
6+
7+
本代码为交互代码,个别地方需要手动输入。
8+
9+
####报警邮箱设置方法如下
10+
11+
```bash
12+
vi /etc/mail.rc
13+
添加你的发件邮箱地址已经smtp,如下
14+
set [email protected] smtp=smtp.163.com set [email protected] smtp-auth-password=000000 smtp-auth=login
15+
可以通过一下命令测试
16+
echo "Hello World" | mail [email protected]
17+
```
18+
19+
####更新日志
20+
2015.12.07
21+
1. nagios-4.0.8 升级到 nagios-4.1.1
22+
2. nagios-plugins-2.0.3 升级到 nagios-plugins-2.1.1
23+
3. pnp4nagios-0.6.24 升级到 pnp4nagios-0.6.25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
###############################################################################
2+
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.0.8
3+
#
4+
#
5+
# NOTES: This config file provides you with some example command definitions
6+
# that you can reference in host, service, and contact definitions.
7+
#
8+
# You don't need to keep commands in a separate file from your other
9+
# object definitions. This has been done just to make things easier to
10+
# understand.
11+
#
12+
###############################################################################
13+
14+
15+
################################################################################
16+
#
17+
# SAMPLE NOTIFICATION COMMANDS
18+
#
19+
# These are some example notification commands. They may or may not work on
20+
# your system without modification. As an example, some systems will require
21+
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
22+
#
23+
################################################################################
24+
25+
26+
# 'notify-host-by-email' command definition
27+
define command{
28+
command_name notify-host-by-email
29+
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
30+
}
31+
32+
# 'notify-service-by-email' command definition
33+
define command{
34+
command_name notify-service-by-email
35+
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
36+
}
37+
38+
39+
40+
41+
42+
################################################################################
43+
#
44+
# SAMPLE HOST CHECK COMMANDS
45+
#
46+
################################################################################
47+
48+
49+
# This command checks to see if a host is "alive" by pinging it
50+
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
51+
# average time to produce a critical error.
52+
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
53+
54+
# 'check-host-alive' command definition
55+
define command{
56+
command_name check-host-alive
57+
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
58+
}
59+
60+
61+
62+
63+
################################################################################
64+
#
65+
# SAMPLE SERVICE CHECK COMMANDS
66+
#
67+
# These are some example service check commands. They may or may not work on
68+
# your system, as they must be modified for your plugins. See the HTML
69+
# documentation on the plugins for examples of how to configure command definitions.
70+
#
71+
# NOTE: The following 'check_local_...' functions are designed to monitor
72+
# various metrics on the host that Nagios is running on (i.e. this one).
73+
################################################################################
74+
75+
# 'check_local_disk' command definition
76+
define command{
77+
command_name check_local_disk
78+
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
79+
}
80+
81+
82+
# 'check_local_load' command definition
83+
define command{
84+
command_name check_local_load
85+
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
86+
}
87+
88+
89+
# 'check_local_procs' command definition
90+
define command{
91+
command_name check_local_procs
92+
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
93+
}
94+
95+
96+
# 'check_local_users' command definition
97+
define command{
98+
command_name check_local_users
99+
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
100+
}
101+
102+
103+
# 'check_local_swap' command definition
104+
define command{
105+
command_name check_local_swap
106+
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
107+
}
108+
109+
110+
# 'check_local_mrtgtraf' command definition
111+
define command{
112+
command_name check_local_mrtgtraf
113+
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
114+
}
115+
116+
117+
################################################################################
118+
# NOTE: The following 'check_...' commands are used to monitor services on
119+
# both local and remote hosts.
120+
################################################################################
121+
122+
# 'check_ftp' command definition
123+
define command{
124+
command_name check_ftp
125+
command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
126+
}
127+
128+
129+
# 'check_hpjd' command definition
130+
define command{
131+
command_name check_hpjd
132+
command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
133+
}
134+
135+
136+
# 'check_snmp' command definition
137+
define command{
138+
command_name check_snmp
139+
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
140+
}
141+
142+
143+
# 'check_http' command definition
144+
define command{
145+
command_name check_http
146+
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
147+
}
148+
149+
150+
# 'check_ssh' command definition
151+
define command{
152+
command_name check_ssh
153+
command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
154+
}
155+
156+
157+
# 'check_dhcp' command definition
158+
define command{
159+
command_name check_dhcp
160+
command_line $USER1$/check_dhcp $ARG1$
161+
}
162+
163+
164+
# 'check_ping' command definition
165+
define command{
166+
command_name check_ping
167+
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
168+
}
169+
170+
171+
# 'check_pop' command definition
172+
define command{
173+
command_name check_pop
174+
command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
175+
}
176+
177+
178+
# 'check_imap' command definition
179+
define command{
180+
command_name check_imap
181+
command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
182+
}
183+
184+
185+
# 'check_smtp' command definition
186+
define command{
187+
command_name check_smtp
188+
command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
189+
}
190+
191+
192+
# 'check_tcp' command definition
193+
define command{
194+
command_name check_tcp
195+
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
196+
}
197+
198+
199+
# 'check_udp' command definition
200+
define command{
201+
command_name check_udp
202+
command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
203+
}
204+
205+
206+
# 'check_nt' command definition
207+
define command{
208+
command_name check_nt
209+
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
210+
}
211+
212+
213+
214+
################################################################################
215+
#
216+
# SAMPLE PERFORMANCE DATA COMMANDS
217+
#
218+
# These are sample performance data commands that can be used to send performance
219+
# data output to two text files (one for hosts, another for services). If you
220+
# plan on simply writing performance data out to a file, consider using the
221+
# host_perfdata_file and service_perfdata_file options in the main config file.
222+
#
223+
################################################################################
224+
225+
226+
define command{
227+
command_name process-service-perfdata-file
228+
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
229+
}
230+
define command{
231+
command_name process-host-perfdata-file
232+
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
233+
}
234+
235+
# 'check_nrpe ' command definition
236+
237+
define command{
238+
239+
command_name check_nrpe
240+
241+
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
242+
243+
}

0 commit comments

Comments
 (0)