Agenda: exercises-smokeping.txt

File exercises-smokeping.txt, 17.0 KB (added by sysadmin, 6 years ago)
Line 
1Network Management & Monitoring
2Smokeping
3
4
5Exercises
6----------
7
80. Connect to your PC as the sysadm user and start a root shell
9
10
11        $ sudo bash
12        #
13
14
151. Install Smokeping
16--------------------
17
18        # apt-get install smokeping
19
20Then point your web browser at
21
22        http://pcN.ws.nsrc.org/cgi-bin/smokeping.cgi
23
24to check that it is running.
25
26
272. Initial Configuration
28------------------------
29
30        # cd /etc/smokeping/config.d
31        # ls -l
32
33    -rwxr-xr-x 1 root root  578 2010-02-26 01:55 Alerts
34    -rwxr-xr-x 1 root root  237 2010-02-26 01:55 Database
35    -rwxr-xr-x 1 root root  413 2010-02-26 05:40 General
36    -rwxr-xr-x 1 root root  271 2010-02-26 01:55 pathnames
37    -rwxr-xr-x 1 root root  859 2010-02-26 01:55 Presentation
38    -rwxr-xr-x 1 root root  116 2010-02-26 01:55 Probes
39    -rwxr-xr-x 1 root root  155 2010-02-26 01:55 Slaves
40    -rwxr-xr-x 1 root root 8990 2010-02-26 06:30 Targets
41
42The files that you'll need to change, at a minimum, are:
43
44    * Alerts
45    * General
46    * Probes
47    * Targets
48
49Now open the General file (note the first capital letter)
50 
51                # editor General
52
53Change the following lines (DON'T LEAVE THEM INDENTED):
54
55        owner    = NOC
56        contact  = sysadm@localhost
57        mailhost = localhost
58        cgiurl   = http://localhost/cgi-bin/smokeping.cgi
59        # specify this to get syslog logging
60        syslogfacility = local5
61
62Save the file and exit. Now let's restart the Smokeping service to verify
63that no mistakes have been made before going any further:
64
65        # service smokeping stop
66        # service smokeping start
67
68A quicker way to do this is:
69
70                # service smokeping restart
71               
72We'll use this for the rest of the exercises, or we'll just use the "reload" directive as this is
73all you need for Smokeping to see configuration file changes.
74
75Now open the Alerts file (note the first capital letter)
76
77                # editor Alerts
78               
79Change the following lines (DON'T LEAVE THEM INDENTED):
80
81                to = root@localhost
82                from = smokeping-alert@localhost
83               
84Save the file and exit. Restart Smokeping:
85
86                # service smokeping reload
87
88
893. Configure monitoring of devices
90----------------------------------
91
92The majority of your time and work configuring Smokeping will be done in the
93file /etc/smokeping/config.d/Targets.
94       
95For this class please do the following:
96
97Use the default FPing probe to check:
98
99      - all the student NOC PCs
100      - classroom NOC
101      - switches
102      - routers
103     
104You can use the classroom Network Diagram on the classroom wiki to figure out addresses
105for each item, etc.
106
107Create some hierarchy to the Smokeping menu for your checks. For example, the Targets
108file is already partially preconfigured. To start we are going to add some entries to
109this file. Start with:
110
111                # cd /etc/smokeping/config.d
112                # editor Targets
113
114You can take the section from *** Targets *** to the end of the LocalMachine and make it
115look something like this. Feel free to use your own "remark", "menu" text and titles. Note
116that we remove the commented lines "#parents = owner:/Test/James location:/", and the "Alerts"
117line.
118
119NOTE: We strongly recommend that you COPY and PASTE text from these exercises directly in to the
120Targets file. Typing all this by hand will take too long.
121
122The ">>>>>>>>" are not in the file, this indicates start of text, then "<<<<<<<<" is end
123of text:
124
125
126>>>>>>>>
127
128*** Targets ***
129
130probe = FPing
131
132menu = Top
133title = Network Latency Grapher
134remark = Smokeping Latency Grapher for Network Monitoring \
135         and Management Workshop.
136
137+Local
138
139menu = Local Network Monitoring and Management
140title = Local Network
141
142++LocalMachine
143
144menu = Local Machine
145title = This host
146host = localhost
147
148<<<<<<<
149
150
151Now, below the "localhost" we start with the configuration of items for our class.
152We can start simple and add just the first 4 PCs that are in Group 1 as well as an
153entry for our classroom NOC.
154
155>>>>>>>>
156
157#
158# ********* Classroom Servers **********
159#
160
161+Servers
162
163menu = Servers
164title = Network Management Servers
165
166++noc
167
168menu = noc
169title = Workshop NOC
170host = noc
171
172#
173# ******** Student Machines (VMs) ***********
174#
175
176+PCs
177
178menu = Lab PCs
179title = Virtual PCs Network Management
180
181++pc1
182
183menu = pc1
184title = Virtual Machine 1
185host = pc1
186
187
188++pc2
189
190menu = pc2
191title = Virtual Machine 2
192host = pc2
193
194
195++pc3
196
197menu = pc3
198title = Virtual Machine 3
199host = pc3
200
201
202++pc4
203
204menu = pc4
205title = Virtual Machine 4
206host = pc4
207
208<<<<<<<<
209
210
211OK. Let's see if we can get Smokeping to stop and start with the changes we have
212made, so far. Save and exit from the Targets file. Now try doing:
213
214                # service smokeping reload
215
216If you see error messages, then read them closely and try to correct the problem
217in the Targets file. In addition, Smokeping is now sending log message to the file
218/var/log/syslog. You can view what Smokeping is saying by typing:
219
220                # tail /var/log/syslog
221
222If you want to see all smokeping related messages in the file /var/log/syslog you
223can do this:
224
225                # grep smokeping /var/log/syslog
226
227If there are no errors you can view the results of your changes by going to:
228
229                http://pcN.ws.nsrc.org/cgi-bin/smokeping.cgi
230
231When you are ready you can edit the Targets file again and continue to add machines.
232At the bottom of the file you can add the next group of PCs:
233
234
235>>>>>>>>
236
237++pc5
238
239menu = pc5
240title = Virtual Machine 5
241host = pc5
242
243
244++pc6
245
246menu = pc6
247title = Virtual Machine 6
248host = pc6
249
250
251++pc7
252
253menu = pc7
254title = Virtual Machine 7
255host = pc7
256
257
258++pc8
259
260menu = pc8
261title = Virtual Machine 8
262host = pc8
263
264<<<<<<<<
265
266
267Add as many PCs as you want, then Save and exit from the Targets file and verify
268that the changes you have made are working:
269
270                # service smokeping reload
271
272You can continue to view the updated results of your changes on the Smokeping
273web page. It may take up to 5 minutes before graphs begin to appear.
274
275                http://pcN.ws.nsrc.org/cgi-bin/smokeping.cgi
276
277
278
2794. Configure monitoring of routers and switches
280-----------------------------------------------
281
282Once you have configured as many PCs as you want to configure, then it's time to
283add in some entries for the classroom routers and switch(es).
284
285                # cd /etc/smokeping/config.d            (just to be sure :-))
286                # editor Targets
287
288Go to the bottom of the file and add in some entries for routers and switches:
289
290
291>>>>>>>>
292
293#
294# ********** Classroom Backbone Switch *********
295#
296
297+Switches
298
299menu = Switches
300title = Switches Network Management
301
302++sw
303
304menu = sw
305title = Backbone Switch
306host = sw
307
308#
309# ********** Virtual Routers: Cisco 7200 images *********
310#
311
312+Routers
313
314menu = Routers
315title = Virtual and Physical Routers Network Management
316
317++gw
318
319menu = rtr
320title = Gateway Router
321host = rtr
322
323++router1
324
325menu = router1
326title = Virtual Router 1
327host = rtr1
328
329++router2
330
331menu = router2
332title = Virtual Router 2
333host = rtr2
334
335++router3
336
337menu = router3
338title = Virtual Router 3
339host = rtr3
340
341<<<<<<<<
342
343
344If you wish you can continue and add in entries for routers 4 to 6, or up to 9 if there are
345that many in your class. When you are ready Save and Exit from the Targets file and verify
346your work:
347
348                # service smokeping reload
349
350If you want you might consider adding the Wireless Access Point:
351
352                # editor Targets
353
354
355>>>>>>>>
356
357#
358# Classrom Wireless Access Point
359#
360
361++ap1
362
363menu = ap1
364title = Wireless Access Point 1
365host = ap1
366
367<<<<<<<<
368
369Save and Exit from the file and reload the Smokeping service:
370
371                # service smokeping reload
372
373
3745. Add new probes to Smokeping
375------------------------------
376
377The current entry in the Probes file is fine, but if you wish to use additional
378Smokeping checks you can add them in here and you can specify their default
379behavior. You can do this, as well, in the Targets file if you wish.
380
381To add a probe to check for HTTP latency as well as DNS lookup latency add the
382following TO THE END of the Probes file (remember ">>>>" and "<<<<<" are not to be
383included):
384
385                # editor Probes
386
387
388>>>>>>>>
389
390+ EchoPingHttp
391
392+ DNS
393binary = /usr/bin/dig
394pings = 5
395step = 180
396lookup = www.nsrc.org
397
398<<<<<<<<
399
400
401The DNS probe will look up the IP address of www.nsrc.org using any other open
402DNS server (resolver) you specify in the Targets file. You will see this a bit
403futher on in the exercises.
404
405Now Save and exit from the file and verify that your changes are working:
406
407                # service smokeping reload
408 
409
410
4116. Add HTTP latency checks for the classroom PCs
412------------------------------------------------
413
414Edit the Targets file again and go to the end of the file:
415
416        # editor Targets
417
418At the end of the file add:
419
420
421>>>>>>>>
422
423#
424# Local Web server response
425#
426
427+HTTP
428
429menu = Local HTTP Response
430title = HTTP Response Student PCs
431
432++pc1
433
434menu = pc1
435title = pc1 HTTP response time
436probe = EchoPingHttp
437host = pc1
438
439++pc2
440
441menu = pc2
442title = pc2 HTTP response time
443probe = EchoPingHttp
444host = pc2
445
446++pc3
447
448menu = pc3
449title = pc3 HTTP response time
450probe = EchoPingHttp
451host = pc3
452
453++pc4
454
455menu = pc4
456title = pc1 HTTP response time
457probe = EchoPingHttp
458host = pc4
459
460<<<<<<<<
461
462
463You could actually just use the "probe = EchoPingHttp" statement once for pc1,
464and then this would be the default probe until another "probe = " statement is
465seen in the Targets file.
466
467You can add more PC entries if you wish, or you could consider checking the
468latency on remote machines - these are likely to be more interesting. Machines
469such as your own publicly accessible servers are a good choice, or, perhaps other
470web servers you use often (Google, Yahoo, Government pages, stores, etc.?).
471
472For example, consider adding something like this at the bottom of the Targets file:
473
474>>>>>>>>
475
476#
477# Remote Web server response
478#
479
480+HTTPRemote
481
482menu = Remote HTTP Response
483title = HTTP Response Remote Machines
484
485++google
486
487menu = Google
488title = Google.com HTTP response time
489probe = EchoPingHttp
490host = www.google.com
491
492++nsrc
493
494menu = Network Startup Resource Center
495title = nsrc.org HTTP response time
496probe = EchoPingHttp
497host = nsrc.org
498
499<<<<<<<<
500
501Add your own hosts that you use at your organization to the list of Remote Web Servers.
502
503Once you are done, save and exit from the Targets file and verify your work:
504
505                # service smokeping reload
506               
507       
508       
509
5107. Add DNS latency checks
511-------------------------
512
513At the end of the Targets file we are going to add some entries to verify the
514latency from our location to remote recursive DNS servers to look up an entry
515for nsrc.org. You would likely substitue an important address for your institution
516in the Probes file instead. In addition, you can change the address you are looking
517up inside the Targets file as well. For more information see:
518
519        http://oss.oetiker.ch/smokeping/probe/DNS.en.html
520
521and
522
523        http://oss.oetiker.ch/smokeping/probe/index.en.html
524
525Now edit the Targets file again. Be sure to go to the end of the file:
526
527                # cd /etc/smokeping/config.d                    (just to be sure...)
528                # editor Targets
529
530At the end of the file add:
531
532
533>>>>>>>>
534
535#
536# Sample DNS probe
537#
538
539+DNS
540
541probe = DNS
542menu = DNS Latency
543title = DNS Latency Probes
544
545++LocalDNS1
546menu = 10.10.0.250
547title =  DNS Delay for local DNS Server on noc.ws.nsrc.org
548host = noc.ws.nsrc.org
549
550++GoogleA
551menu = 8.8.8.8
552title = DNS Latency for google-public-dns-a.google.com
553host = google-public-dns-a.google.com
554
555++GoogleB
556
557menu = 8.8.8.4
558title = DNS Latency for google-public-dns-b.google.com
559host = google-public-dns-b.google.com
560
561++OpenDNSA
562
563menu = 208.67.222.222
564title = DNS Latency for resolver1.opendns.com
565host = resolver1.opendns.com
566
567++OpenDNSB
568
569menu = 208.67.220.220
570title = DNS Latency for resolver2.opendns.com
571host = resolver2.opendns.com
572
573<<<<<<<<
574
575
576Now save the Targets file and exit and verify your work:
577
578                # service smokeping reload
579
580Look at additional Smokeping probes and consider implementing some of
581them if they are useful to your ogranization:
582
583        http://oss.oetiker.ch/smokeping/probe/index.en.html
584
585
586
5878. MultiHost graphing
588---------------------
589
590Once you have defined a group of hosts under a single probe type in your
591/etc/smokeping/config.d/Targets file, then you can create a single graph
592that will show you the results of all smokeping tests for all hosts that
593you define. This has the advantage of letting you quickly compare, for
594example, a group of hosts that you are monitoring with the FPing probe.
595
596The MultiHost graph function in Smokeping is extremely picky - pay close
597attention!
598
599To create a MultiHost graph first edit the file Targets:
600
601                # editor Targets
602
603We will create a MultiHost graph for the DNS Latency probes we just added.
604To do this go to the end of the Targets file and add:
605
606
607>>>>>>>>
608
609#
610# Multihost Graph of all DNS latency checks
611#
612
613++MultiHostDNS
614
615menu = MultiHost DNS
616title = Consolidated DNS Responses
617host = /DNS/LocalDNS1 /DNS/GoogleA /DNS/GoogleB /DNS/OpenDNSA /DNS/OpenDNSB
618
619<<<<<<<<
620
621And, as always, save and exit from the file Targets and test your new configuration.
622
623
624                # service smokeping reload
625
626
627If this fails you almost certainly have an error in the entries. If you cannot figure
628out what the error is (remember to try "tail /var/log/syslog" first!) ask your instructor
629for some help.
630
631You can add MultiHost graphs for any other set of probe tests (FPing, EchoPingHttp)
632that you have configured. You must add the MultiHost entry at the end of a probe section.
633If you don't understand how this works you can ask your instructors for help.
634
635In addition, on the workshop NOC there are sample configuration files available, including
636one for SmokePing that includes multiple MultiHost graph examples.
637
638
6399. Send Smokeping alerts
640------------------------
641
642If you wish to receive an email when an alert condition is met on one of the
643Smokeping checks first do this:
644
645                # cd /etc/smokeping/config.d
646                # editor Alerts
647
648Update the top of the file where it says:
649
650        *** Alerts ***
651        to = alertee@address.somewhere
652        from = smokealert@company.xy
653
654to include a proper "to" and "from" field for your server. Something like:
655
656        *** Alerts ***
657        to = sysadm@localhost
658        from = smokeping-alert@localhost
659
660Now you must update your device entries to include a line that reads:
661
662        alerts = alertName1, alertName2, etc, etc...
663
664For instance, the alert named, "someloss" has already been defined in the file Alerts:
665
666To read about Smokeping alerts and what they are detecting, how to create your own, etc. see:
667
668        http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html
669
670and at the bottom of the page is a section titled, "*** Alerts ***"
671
672To place some alert detection on some of your hosts open the file Targets:
673
674                # editor Targets
675
676and go near the start of the file where we defined our PCs. Just under the "host =" line add
677another line that looks like this:
678
679        alerts = someloss
680
681So, for example, the pc1 entry would not look like this:
682
683>>>>>>>>
684
685++pc1
686
687menu = pc1
688title = Virtual Machine 1
689host = pc1
690alerts = someloss
691
692<<<<<<<<
693
694If you want to add an alerts option to other hosts go ahead. Once you are done save and
695exit from the Targets file and then verify that your configuration works:
696
697                # service smokeping reload
698
699If any of the hosts that have the "alerts = " option set meet the conditions to set off the
700alert, then an email will arrive to the sysadm user's mailbox on the Smokeping server
701machine (localhost). It's not likely that an alert will be set off for most machines. To
702check you can read the email for the sysadm user by using an email client like "mutt" -
703
704                # apt-get install mutt
705                # su - sysadm                           (changes you to the sysadm user from root)
706                $ mutt
707
708Say yes to mailbox creation when prompted, then see if you have email from the
709smokeping-alerts@localhost user. You probably will not. To exit from Mutt press "q".
710
711To leave the sysadm user shell type:
712
713                $ exit
714                #
715
716
71710. Slave instances - Informational Only
718----------------------------------------
719
720This is a description only for informational purposes in case you wish
721to attempt this type of configuration once the workshop is over.
722
723The idea behind this is that you can run multiple smokeping instances
724at multiple locations that are monitoring the same hosts and/or services
725as your master instance. The slaves will send their results to the
726master server and you will see these results side-by-side with your
727local results. This allows you to view how users outside your network
728see your services and hosts.
729
730This can be a powerful tool for resolving service and host issues that
731may be difficult to troubleshoot if you only have local data.
732
733Graphically this looks this:
734
735          [slave 1]     [slave 2]      [slave 3]
736                |             |              |
737                +-------+     |     +--------+
738                        |     |     |
739                        v     v     v
740                        +---------------+
741                        |    master     |
742                        +---------------+
743
744You can see example of this data here:
745
746http://oss.oetiker.ch/smokeping-demo/
747
748Look at the various graph groups and notice that many of the graphs
749have multiple lines with the color code chart listing items such as
750"median RTT from mipsrv01" - These are not MultiHost graphs, but rather
751graphs with data from external smokeping servers.
752
753To configure a smokeping master/slave server you can see the documentation
754here:
755
756    http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html
757
758In addition, a sample set of steps for configuring this is available in
759the file sample-smokeping-master-slave.txt which should be lisetd as an
760additional reference at the bottom of the Agenda page on your classroom wiki.
761