Agenda: exercises-smokeping.txt

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