Agenda: exercises-smokeping.txt

File exercises-smokeping.txt, 11.1 KB (added by admin, 9 years ago)
Line 
1Registry Operations Curriculum
2Smokeping
3
4Notes:
5------
6* Commands preceded with "$" imply that you should execute the command as
7  a general user - not as root.
8* Commands preceded with "#" imply that you should be working as root.
9* Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>")
10  imply that you are executing commands on remote equipment, or within
11  another program.
12
13Exercises
14----------
15
160. Log in to your PC or open a terminal window as the sysadmin user.
17
18Once you are logged in you can continue with these exercises.
19
201. Install Smokeping
21
22        $ sudo apt-get install smokeping
23
24        (Probably already installed on your machines)
25       
26
272. Initial Configuration
28
29        $ cd /etc/smokeping/config.d
30        $ ls -l
31
32        -rwxr-xr-x 1 root root  578 2010-02-26 01:55 Alerts
33        -rwxr-xr-x 1 root root  237 2010-02-26 01:55 Database
34        -rwxr-xr-x 1 root root  413 2010-02-26 05:40 General
35        -rwxr-xr-x 1 root root  271 2010-02-26 01:55 pathnames
36        -rwxr-xr-x 1 root root  859 2010-02-26 01:55 Presentation
37        -rwxr-xr-x 1 root root  116 2010-02-26 01:55 Probes
38        -rwxr-xr-x 1 root root  155 2010-02-26 01:55 Slaves
39        -rwxr-xr-x 1 root root 8990 2010-02-26 06:30 Targets
40 
41        The files you need to touch (at a minimum) are:
42
43        * Alerts
44        * General
45        * Probes
46        * Targets
47
48        Edit Alerts
49
50        $ sudo vi Alerts
51
52        Update the top of the file where it says:
53
54                *** Alerts ***
55                to = alertee@address.somewhere
56                from = smokealert@company.xy
57
58        to include a proper "to" and "from" field for your server.
59        Something like:
60
61                *** Alerts ***
62                to = sysadmin@localhost
63                from = smokeping-alert@localhost
64
65        If you were going to create tickets from Smokeping alerts
66        the "to" address would be an alias for the ticketing system.
67        We will do this a bit later.
68
69        Add a new alert for later use:
70
71                +rttbadstart
72                type = rtt
73                # in milliseconds
74                pattern = ==S,==U
75                priority = 1
76                comment = offline at startup
77
78        * "==S, ==U" means "at Startup" and "not Up"
79        * "priority = 1" means if multiple alerts are defined for a host
80          and multiple alerts match one the one with the highest priority
81          is executed.
82
83        Now save the file and exit, then edit the file General:
84
85        $ sudo vi General
86
87         Change the following lines:
88
89                owner
90                contact
91                cgiurl
92                mailhost
93
94        Something like this should work:
95
96                owner    = AROC Class User
97                contact  = sysadmin@localhost
98                cgiurl   = http://localhost/cgi-bin/smokeping.cgi
99                mailhost = localhost
100
101        Now save the file and exit, then edit the file Probes:
102
103        $ sudo vi Probes
104
105        The current entry in Probes is fine, but if you wish to
106        use additional Smokeping checks you can add them in here
107        and you can specify their default behavior. You can do
108        this, as well, in the Targets file if you wish.
109
110        Here is an example of a Probes file that would specify
111        what to use to check for HTTP and DNS latency as well as
112        the FPing probe that is used for ping latency:
113
114                *** Probes ***
115
116                + FPing
117
118                binary = /usr/bin/fping
119
120                + EchoPingHttp
121
122                + DNS
123                binary = /usr/bin/dig
124                pings = 5
125                step = 180
126                lookup = www.nsrc.org
127
128        Go ahead and update your Probes file with this information.
129        Then save the file and exit. And, now let's restart the
130        Smokeping service to verify that no mistakes have been made
131        before going any further:
132
133        $ sudo /etc/init.d/smokeping stop
134        $ sudo /etc/init.d/smokeping start
135
136        You could, also do:
137
138        $ sudo /etc/init.d/smokeping restart
139
140        or
141
142        $ sudo /etc/init.d/smokeping reload
143
144        to reload configuration changes. This should work in most
145        cases.
146
147        Due to potential problems in the smokeping init script we recommend using:
148
149        $ sudo /etc/init.d/smokeping stop
150        $ sudo /etc/init.d/smokeping start
151
152        instead of the "restart" option
153
154
1553. Configure monitoring of devices
156
157        The majority of your time and work configuring Smokeping
158        will be done in the file /etc/smokeping/config.d/Targets.
159       
160        For this class please do the following:
161
162        Use the FPing probe to check:
163          - all the student NOC PCs
164          - classroom NOC
165          - switches
166          - routers:
167         
168        You can use the classroom Network Diagram on the classroom wiki (http://noc/) to
169        figure out addresses for each item, etc.
170
171        Create some hierarchy to the Smokeping menu for your
172        checks. Such as:
173
174                PCs
175                Routers
176                Switches
177
178        Add a check for HTTP latency for all the classroom PCs.
179        This will mean adding another category, such as:
180
181                HTTP Servers
182
183        If you have time consider checking some machines that are
184        external to our classroom and the conference.
185
186        Look at additional Smokeping probes and consider implementing
187        some of them:
188
189        http://oss.oetiker.ch/smokeping/probe/index.en.html
190
191        As trying to explain all syntactical details of how the file
192        /etc/smokeping/config.d/Targets is used would require several
193        pages we will go through some examples in class, and you can
194        refer to the Smokeping configuration files that are in use on
195        the classroom NOC box by going to:
196
197        http://noc/configs/etc/smokeping
198        http://noc/configs/etc/smokeping/config.d
199
200        Review these files and try to do all the suggested steps from above.
201
2024. Add DNS Latency Checks
203
204        You can check either or both internal or external names using
205        the DNS latency probe.
206
207        Add a menu hierarchy for DNS Latency. Check an external address
208        (nsrc.org) and an internal address (noc). This will look something
209        like this (in Targets):
210
211        $ sudo vi /etc/smokeping/config.d/Targets
212
213                ++ DNS
214                probe = DNS
215                menu = External DNS Check
216                title = DNS Latency
217
218                +++ nsrc
219                host = nsrc.org
220
221
222                +++ noc
223                host = noc.aroc
224
225        Exit and save your changes to the file Targets.
226
227        Restart Smokeping to see the changes:
228
229        $ sudo /etc/init.d/smokeping stop
230        $ sudo /etc/init.d/smokeping start
231
232       
2335. Send Smokeping alerts to our Request Tracker Net queue
234
235        We've already set this up in RT and in /etc/aliases. You just
236        need to point Smokeping alerts to our RT instance. Edit the file
237        Alerts:
238
239        $ sudo vi /etc/smokeping/config.d/Alerts
240
241        And change:
242
243                to = sysadmin@localhost
244
245        to
246
247                to = net@localhost
248
249        Now whenever Smokeping sends an alert email with that alert text
250        will arrive to the Net queue in Request Tracker.
251
252        Next, be sure you have alerts defined for some of your Targets.
253        You can either turn on alerts by defining alerts for a probe in
254        the /etc/smokeping/config.d/Probes file, or by individual Targets
255        entries.
256
257        In our case let's edit the Targets file and turn on alerts for our
258        DNS Latency checks. In addition, if you add a DNS latency check for
259        a host that does not exist, then we can see a ticket being created
260        in RT.
261
262        $ sudo vi /etc/smokeping/config.d/Targets
263
264        Find the following section in the file:
265
266                ++ DNS
267                probe = DNS
268                menu = External DNS Check
269                title = DNS Latency
270
271                +++ nsrc
272                host = nsrc.org
273
274
275                +++ noc
276                host = noc.aroc
277
278        And, add the following host after "+++ noc"
279
280                +++ noexist
281                host = does.not.exist
282                alerts = rttbadstart
283
284        Save and exit from the file, then restart smokeping:
285
286        $ sudo /etc/init.d/smokeping stop
287        $ sudo /etc/init.d/smokeping start
288
289        You will see an error message on the screen:
290
291                WARNING: Hostname 'does.not.exist' does currently not resolve to
292                an IPv6 or IPv4 address
293
294        This is to be expected as the host "does.not.exist" is not a valid
295        host. But, Smokeping still starts, and the rttbadstart Alert will
296        now send email to the Net queue for Request Tracker. If you open a
297        web browser to your RT instance:
298
299        http://MyMachine/rt/
300
301        and log in as "sysadmin" you will see a new ticket in the home screen
302        that has a subject of:
303
304        "[SmokeAlert] rttbadstart is active on
305        AROC.DNSProbe.RT-test"
306       
307
3086. MultiHost Graphs
309
310        Once you have defined a group of hosts under a single probe type in your
311        /etc/smokeping/config.d/Targets file, then you can create a single graph
312        that will show you the results of all smokeping tests for all hosts that
313        you define. This has the advantage of letting you quickly compare, for
314        example, a group of hosts that you are monitoring with the FPing probe.
315
316        The MultiHost graph functional in Smokeping is extremely picky - pay close
317        attention.
318
319        To create a MultiHost graph first edit the file Targets:
320
321        $ sudo vi Targets
322
323        If you had a section for the FPing probe defined that looked like this
324        (this is an example only - your Targets file may look different):
325
326                + Local
327                menu = Local
328                title = Local Network
329
330                ++ LocalMachine
331                menu = Local Machine
332                title = This host
333                host = localhost
334
335                ++ pc1
336                menu = pc1
337                title = pc1
338                host = pc1
339
340                ++ pc2
341                menu = pc2
342                title = pc2
343                host = pc2
344
345                ++ pc3
346                menu = pc3
347                title = pc3
348                host = pc3
349
350        Right now smokeping displays the results of the FPing probe for each
351        host defined in separate graphs. If you wish to see the results in a
352        single graph with multiple lines, then you would do this after the last
353        FPing probe host definition:
354
355                + MultiHostPCs
356                menu = MultiHost Ping
357                title = Consolidated Ping Response Time
358                host = /Local/LocalMachine /Local/pc1 /Local/pc2 \
359                       /Local/pc3
360
361        Note how  you can have multiple lines for the "host" entry by using the
362        "\" character to indicate another line.
363
364        Now save and exit the file Targets and restart smokeping:
365
366        $ sudo /etc/init.d/smokeping stop
367        $ sudo /etc/init.d/smokeping start
368
369        You should see a new graph under the "MultiHost Ping" menu in your
370        smokeping web interface. This graph will have different color lines
371        for each host you have defined.
372
373
3747. Slave instances
375
376        This is a description only for informational purposes in case you wish
377        to attempt this type of configuration once the workshop is over.
378
379        The idea behind this is that you can run multiple smokeping instances
380        at multiple locations that are monitoring the same hosts and/or services
381        as your master instance. The slaves will send their results to the
382        master server and you will see these results side-by-side with your
383        local results. This allows you to view how users outside your network
384        see your services and hosts.
385
386        This can be a powerful tool for resolving service and host issues that
387        may be difficult to troubleshoot if you only have local data.
388
389        Graphically this looks this:
390
391                  [slave 1]     [slave 2]      [slave 3]
392                        |             |              |
393                        +-------+     |     +--------+
394                                |     |     |
395                                v     v     v
396                                +---------------+
397                                |    master     |
398                                +---------------+
399
400        You can see example of this data here:
401
402        http://oss.oetiker.ch/smokeping-demo/
403
404        Look at the various graph groups and notice that many of the graphs
405        have multiple lines with the color code chart listing items such as
406        "median RTT from mipsrv01" - These are not MultiHost graphs, but rather
407        graphs with data from external smokeping servers.
408
409        To configure a smokeping master/slave server you can see the documentation
410        here:
411
412        http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html
413
414        In addition, a sample set of steps for configuring this is available in
415        the file sample-smokeping-master-slave.txt.
416