Track1Agenda: exercises-smokeping-part2.txt

File exercises-smokeping-part2.txt, 10.8 KB (added by b.candler, 6 years ago)
Line 
1% Network Management & Monitoring
2% Smokeping - Part II
3
45. Add new probes to Smokeping
5------------------------------
6
7The current entry in the Probes file is fine, but if you wish to use additional
8Smokeping checks you can add them in here and you can specify their default
9behavior. You can do this, as well, in the Targets file if you wish.
10
11To add a probe to check for HTTP latency as well as DNS lookup latency,
12edit the Probes file and add the following text TO THE END of that file:
13
14
15~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+ EchoPingHttp
17
18+ DNS
19binary = /usr/bin/dig
20pings = 5
21step = 180
22lookup = www.nsrc.org
23~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24
25
26The DNS probe will look up the IP address of www.nsrc.org using any other open
27DNS server (resolver) you specify in the Targets file. You will see this a bit
28futher on in the exercises.
29
30Now Save and exit from the file and verify that your changes are working:
31
32    # service smokeping reload
33 
34
35
366. Add HTTP latency checks for the classroom PCs
37------------------------------------------------
38
39Edit the Targets file again and go to the end of the file:
40
41        # editor Targets
42
43At the end of the file add:
44
45
46~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47#
48# Local Web server response
49#
50
51+HTTP
52
53menu = Local HTTP Response
54title = HTTP Response Student PCs
55
56++pc1
57
58menu = pc1
59title = pc1 HTTP response time
60probe = EchoPingHttp
61host = pc1.ws.nsrc.org
62
63++pc2
64
65menu = pc2
66title = pc2 HTTP response time
67probe = EchoPingHttp
68host = pc2.ws.nsrc.org
69
70++pc3
71
72menu = pc3
73title = pc3 HTTP response time
74probe = EchoPingHttp
75host = pc3.ws.nsrc.org
76
77++pc4
78
79menu = pc4
80title = pc1 HTTP response time
81probe = EchoPingHttp
82host = pc4.ws.nsrc.org
83~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
85
86You could actually just use the "probe = EchoPingHttp" statement once for pc1,
87and then this would be the default probe until another "probe = " statement is
88seen in the Targets file.
89
90You can add more PC entries if you wish, or you could consider checking the
91latency on remote machines - these are likely to be more interesting. Machines
92such as your own publicly accessible servers are a good choice, or, perhaps other
93web servers you use often (Google, Yahoo, Government pages, stores, etc.?).
94
95For example, consider adding something like this at the bottom of the Targets file:
96
97~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
98#
99# Remote Web server response
100#
101
102+HTTPRemote
103
104menu = Remote HTTP Response
105title = HTTP Response Remote Machines
106
107++google
108
109menu = Google
110title = Google.com HTTP response time
111probe = EchoPingHttp
112host = www.google.com
113
114++nsrc
115
116menu = Network Startup Resource Center
117title = nsrc.org HTTP response time
118probe = EchoPingHttp
119host = nsrc.org
120~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121
122Add your own hosts that you use at your organization to the list of Remote Web Servers.
123
124Once you are done, save and exit from the Targets file and verify your work:
125
126    # service smokeping reload
127               
128       
129       
130
1317. Add DNS latency checks
132-------------------------
133
134At the end of the Targets file we are going to add some entries to verify the
135latency from our location to remote recursive DNS servers to look up an entry
136for nsrc.org. You would likely substitue an important address for your institution
137in the Probes file instead. In addition, you can change the address you are looking
138up inside the Targets file as well. For more information see:
139
140<http://oss.oetiker.ch/smokeping/probe/DNS.en.html>
141
142and
143
144<http://oss.oetiker.ch/smokeping/probe/index.en.html>
145
146Now edit the Targets file again. Be sure to go to the end of the file:
147
148    # cd /etc/smokeping/config.d                        (just to be sure...)
149    # editor Targets
150
151At the end of the file add:
152
153
154~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155#
156# Sample DNS probe
157#
158
159+DNS
160
161probe = DNS
162menu = DNS Latency
163title = DNS Latency Probes
164
165++LocalDNS1
166menu = 10.10.0.241
167title =  DNS Delay for local DNS Server on ns1.ws.nsrc.org
168host = ns1.ws.nsrc.org
169
170++GoogleA
171menu = 8.8.8.8
172title = DNS Latency for google-public-dns-a.google.com
173host = google-public-dns-a.google.com
174
175++GoogleB
176
177menu = 8.8.8.4
178title = DNS Latency for google-public-dns-b.google.com
179host = google-public-dns-b.google.com
180
181++OpenDNSA
182
183menu = 208.67.222.222
184title = DNS Latency for resolver1.opendns.com
185host = resolver1.opendns.com
186
187++OpenDNSB
188
189menu = 208.67.220.220
190title = DNS Latency for resolver2.opendns.com
191host = resolver2.opendns.com
192~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193
194
195Now save the Targets file and exit and verify your work:
196
197    # service smokeping reload
198
199Look at additional Smokeping probes and consider implementing some of
200them if they are useful to your organization:
201
202<http://oss.oetiker.ch/smokeping/probe/index.en.html>
203
204
205
2068. MultiHost graphing
207---------------------
208
209Once you have defined a group of hosts under a single probe type in your
210/etc/smokeping/config.d/Targets file, then you can create a single graph
211that will show you the results of all smokeping tests for all hosts that
212you define. This has the advantage of letting you quickly compare, for
213example, a group of hosts that you are monitoring with the FPing probe.
214
215The MultiHost graph function in Smokeping is extremely picky - pay close
216attention!
217
218To create a MultiHost graph first edit the file Targets:
219
220    # editor Targets
221
222We will create a MultiHost graph for the DNS Latency probes we just added.
223To do this go to the end of the Targets file and add:
224
225
226~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227#
228# Multihost Graph of all DNS latency checks
229#
230
231++MultiHostDNS
232
233menu = MultiHost DNS
234title = Consolidated DNS Responses
235host = /DNS/LocalDNS1 /DNS/GoogleA /DNS/GoogleB /DNS/OpenDNSA /DNS/OpenDNSB
236~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
237
238And, as always, save and exit from the file Targets and test your new configuration.
239
240
241    # service smokeping reload
242
243
244If this fails you almost certainly have an error in the entries. If you cannot figure
245out what the error is (remember to try "tail /var/log/syslog" first!) ask your instructor
246for some help.
247
248You can add MultiHost graphs for any other set of probe tests (FPing, EchoPingHttp)
249that you have configured. You must add the MultiHost entry at the end of a probe section.
250If you don't understand how this works you can ask your instructors for help.
251
252In addition, on the workshop NOC there are sample configuration files available, including
253one for SmokePing that includes multiple MultiHost graph examples.
254
255
2569. Send Smokeping alerts
257------------------------
258
259If you wish to receive an email when an alert condition is met on one of the
260Smokeping checks first do this:
261
262    # cd /etc/smokeping/config.d
263    # editor Alerts
264
265Update the top of the file where it says:
266
267    *** Alerts ***
268    to = alertee@address.somewhere
269    from = smokealert@company.xy
270
271to include a proper "to" and "from" field for your server. Something like:
272
273    *** Alerts ***
274    to = sysadm@localhost
275    from = smokeping-alert@localhost
276
277Now you must update your device entries to include a line that reads:
278
279    alerts = alertName1, alertName2, etc, etc...
280
281For instance, the alert named, "someloss" has already been defined in the file Alerts:
282
283To read about Smokeping alerts and what they are detecting, how to create your own, etc. see:
284
285<http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html>
286
287and at the bottom of the page is a section titled `*** Alerts ***`
288
289To place some alert detection on some of your hosts open the file Targets:
290
291    # editor Targets
292
293and go near the start of the file where we defined our PCs. Just under the "host =" line add
294another line that looks like this:
295
296    alerts = someloss
297
298So, for example, the pc1 entry would look like this:
299
300~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301++pc1
302
303menu = pc1
304title = Virtual Machine 1
305host = pc1.ws.nsrc.org
306alerts = someloss
307~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
308
309If you want to add an alerts option to other hosts go ahead. Once you are done save and
310exit from the Targets file and then verify that your configuration works:
311
312    # service smokeping reload
313
314If any of the hosts that have the "alerts = " option set meet the conditions to set off the
315alert, then an email will arrive to the sysadm user's mailbox on the Smokeping server
316machine (localhost). It's not likely that an alert will be set off for most machines. To
317check you can read the email for the sysadm user by using an email client like "mutt" -
318
319    # apt-get install mutt
320    # su - sysadm                               (changes you to the sysadm user from root)
321    $ mutt
322
323Say yes to mailbox creation when prompted, then see if you have email from the
324smokeping-alerts@localhost user. You probably will not. To exit from Mutt press "q".
325
326To leave the sysadm user shell type:
327
328    $ exit
329    #
330
331
33210. Slave instances - Informational Only
333----------------------------------------
334
335This is a description only for informational purposes in case you wish
336to attempt this type of configuration once the workshop is over.
337
338The idea behind this is that you can run multiple smokeping instances
339at multiple locations that are monitoring the same hosts and/or services
340as your master instance. The slaves will send their results to the
341master server and you will see these results side-by-side with your
342local results. This allows you to view how users outside your network
343see your services and hosts.
344
345This can be a powerful tool for resolving service and host issues that
346may be difficult to troubleshoot if you only have local data.
347
348Graphically this looks this:
349
350~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351
352          [slave 1]     [slave 2]      [slave 3]
353                |             |              |
354                +-------+     |     +--------+
355                        |     |     |
356                        v     v     v
357                        +---------------+
358                        |    master     |
359                        +---------------+
360
361~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
362
363You can see example of this data here:
364
365<http://oss.oetiker.ch/smokeping-demo/>
366
367Look at the various graph groups and notice that many of the graphs
368have multiple lines with the color code chart listing items such as
369"median RTT from mipsrv01" - These are not MultiHost graphs, but rather
370graphs with data from external smokeping servers.
371
372To configure a smokeping master/slave server you can see the documentation
373here:
374
375<http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html>
376
377In addition, a sample set of steps for configuring this is available in
378the file sample-smokeping-master-slave.txt which should be listed as an
379additional reference at the bottom of the Agenda page on your classroom wiki.
380