-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHostTemplate.txt
209 lines (181 loc) · 4.33 KB
/
HostTemplate.txt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
cd /usr/local/nagios/etc/
mkdir mydevice myservices
chown nagios:nagios mydevice/ myservices/
nano /usr/local/nagios/etc/nagios.cfg
cfg_dir=/usr/local/nagios/etc/mydevice
cfg_dir=/usr/local/nagios/etc/myservices
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
systemctl reload nagios
systemctl status nagios
###################
nano mydevice/device.cfg
###################
define host{
name linux-box ;
use generic-host ;
check_period 24x7
check_interval 1
retry_interval 1
max_check_attempts 10
check_command check-host-alive
notification_period 24x7
notification_interval 30
notification_options d,r
contact_groups admins
register 0 ;
}
#####################
#Host-Declearation
#####################
define host{
use linux-box ;
host_name commmon-pc ;
alias windows ;
address 192.168.10.132 ;
}
###################
nano myservices/device.cfg
###################
define service{
use generic-service
host_name commmon-pc
service_description check-host-alive
check_command check-host-alive
}
##################
define hostgroup {
hostgroup_name Dolonchapa
alias Dolonchapa
members Dolonchapa-C01
}
##################
define hostgroup {
hostgroup_name hostgroup name
alias alias name
members
}
define servicegroup {
servicegroup_name service name
alias alias name
}
define servicegroup{
servicegroup_name service name
members hostname,servicename,hostname,servicename,...
}
########################
define host{
use generic-switch
host_name cisco_router
alias cisco_router
address 192.168.10.1
hostgroups switches
}
# Define the switch that we'll be monitoring
define host{
use generic-switch
host_name switch#1
alias switch#1
address 192.168.10.5
hostgroups switches
}
define host{
use generic-switch
host_name switch#2
alias switch#2
address 192.168.11.5
hostgroups switches
parents cisco_router
}
define hostgroup{
hostgroup_name switches
alias Network Switches
members switch#1, switch#2
}
# Define the Nagios Server (NMS)
define host{
use linux-server
host_name UbuntuNagios
alias UbuntuNagios
address 192.168.10.3
}
# Define host for the adjoining PCs
define host{
use linux-server
host_name cclinux
alias cclinux
address 192.168.11.3
parents switch#2
}
define host {
use linux-server
host_name cclinux#2
alias cclinux#2
address 192.168.10.4
parents switch#2
}
#SERVICE DEFINITIONS
# Create a service to PING to switch
define service{
use generic-service
host_name switch#1, switch#2, cclinux, cclinux#2,
UbuntuNagios, cisco_router
service_description PING
check_command check_ping!200.0,20%!600.0,60%
normal_check_interval 5
retry_check_interval 1
}
# Monitor uptime via SNMP
define service{
use generic-service
host_name switch#2
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0
}
# Monitor Port 1 status via SNMP
define service{
use generic-service
host_name switch#1
service_description Port 1 Link Status
check_command check_snmp!-C public -o ifOperStatus.3 -r 1
-H 192.168.10.5
}
# Monitor bandwidth via MRTG logs
define service{
use generic-service
host_name cisco_router
service_description Port 1 Bandwidth Usage
check_command
check_local_mrtgtraf!/var/lib/mrtg/192.168.10.1_2.log!
AVG!1000000,1000000!5000000,5000000!10
}
# Define a service to check for PCs.
define service {
use local-service
host_name cclinux, cclinux#2
service_description Root Partition
check_command check_local_disk!20%!10%!/ }
define service{
use local-service
host_name cclinux, cclinux#2, UbuntuNagios
service_description Current Users
check_command check_local_users!20!50
}
define service{
use local-service
host_name cclinux, cclinux#2
service_description Total Processes
check_command check_local_procs!250!400!RSZDT
}
# Define a service to check the load on the PCs
define service{
use local-service
host_name cclinux, cclinux#2
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
define service {
use local-service
host_name cclinux, cclinux#2, UbuntuNagios
service_description Swap Usage
check_command check_local_swap!20!10
}