Track2Agenda: 3.4.2.exercises-smokeping-part2.htm

File 3.4.2.exercises-smokeping-part2.htm, 31.9 KB (added by jon, 3 years ago)
Line
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
4  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5  <meta http-equiv="Content-Style-Type" content="text/css" />
6  <meta name="generator" content="pandoc" />
7  <meta name="author" content="Smokeping - Part II" />
8  <title>Network Management &amp; Monitoring</title>
9  <style type="text/css">code{white-space: pre;}</style>
12<body>
14<h1 class="title">Network Management &amp; Monitoring</h1>
15<h2 class="author">Smokeping - Part II</h2>
16</div>
17<div id="TOC">
18<ul>
20<li><a href="#add-http-latency-checks-for-the-classroom-pcs"><span class="toc-section-number">0.2</span> 6. Add HTTP latency checks for the classroom PCs</a></li>
22<li><a href="#multihost-graphing"><span class="toc-section-number">0.4</span> 8. MultiHost graphing</a></li>
24<li><a href="#slave-instances---informational-only"><span class="toc-section-number">0.6</span> 10. Slave instances - Informational Only</a></li>
25</ul>
26</div>
28<p>The current entry in the Probes file is fine, but if you wish to use additional Smokeping checks you can add them in here and you can specify their default behavior. You can do this, as well, in the Targets file if you wish.</p>
29<p>To add a probe to check for HTTP latency as well as DNS lookup latency, edit the Probes file and add the following text TO THE END of that file:</p>
30<pre><code>+ EchoPingHttp
31
32+ DNS
33binary = /usr/bin/dig
34pings = 5
35step = 180
36lookup = www.nsrc.org</code></pre>
37<p>The DNS probe will look up the IP address of www.nsrc.org using any other open DNS server (resolver) you specify in the Targets file. You will see this a bit futher on in the exercises.</p>
38<p>Now Save and exit from the file and verify that your changes are working:</p>
41<p>Edit the Targets file again and go to the end of the file:</p>
42<pre><code># editor Targets</code></pre>
43<p>At the end of the file add:</p>
44<pre><code>#
45# Local Web server response
46#
47
48+HTTP
49
51title = HTTP Response Student PCs
52
53++pc1
54
56title = pc1 HTTP response time
57probe = EchoPingHttp
58host = pc1.ws.nsrc.org
59
60++pc2
61
63title = pc2 HTTP response time
64probe = EchoPingHttp
65host = pc2.ws.nsrc.org
66
67++pc3
68
70title = pc3 HTTP response time
71probe = EchoPingHttp
72host = pc3.ws.nsrc.org
73
74++pc4
75
77title = pc4 HTTP response time
78probe = EchoPingHttp
79host = pc4.ws.nsrc.org</code></pre>
80<p>You could actually just use the &quot;probe = EchoPingHttp&quot; statement once for pc1, and then this would be the default probe until another &quot;probe = &quot; statement is seen in the Targets file.</p>
81<p>You can add more PC entries if you wish, or you could consider checking the latency on remote machines - these are likely to be more interesting. Machines such as your own publicly accessible servers are a good choice, or, perhaps other web servers you use often (Google, Yahoo, Government pages, stores, etc.?).</p>
82<p>For example, consider adding something like this at the bottom of the Targets file:</p>
83<pre><code>#
84# Remote Web server response
85#
86
87+HTTPRemote
88
90title = HTTP Response Remote Machines
91
93
95title = Google.com HTTP response time
96probe = EchoPingHttp
98
99++nsrc
100
101menu = Network Startup Resource Center
102title = nsrc.org HTTP response time
103probe = EchoPingHttp
104host = nsrc.org</code></pre>
105<p>Add your own hosts that you use at your organization to the list of Remote Web Servers.</p>
106<p>Once you are done, save and exit from the Targets file and verify your work:</p>
108    </code></pre>
110<p>At the end of the Targets file we are going to add some entries to verify the latency from our location to remote recursive DNS servers to look up an entry for nsrc.org. You would likely substitue an important address for your institution in the Probes file instead. In addition, you can change the address you are looking up inside the Targets file as well. For more information see:</p>
111<p><a href="http://oss.oetiker.ch/smokeping/probe/DNS.en.html" class="uri">http://oss.oetiker.ch/smokeping/probe/DNS.en.html</a></p>
112<p>and</p>
113<p><a href="http://oss.oetiker.ch/smokeping/probe/index.en.html" class="uri">http://oss.oetiker.ch/smokeping/probe/index.en.html</a></p>
114<p>Now edit the Targets file again. Be sure to go to the end of the file:</p>
115<pre><code># cd /etc/smokeping/config.d            (just to be sure...)
116# editor Targets</code></pre>
117<p>At the end of the file add:</p>
118<pre><code>#
119# Sample DNS probe
120#
121
122+DNS
123
124probe = DNS
126title = DNS Latency Probes
127
128++LocalDNS1
130title =  DNS Delay for local DNS Server on s1.ws.nsrc.org
131host = s1.ws.nsrc.org
132
137
139
143
144++OpenDNSA
145
147title = DNS Latency for resolver1.opendns.com
148host = resolver1.opendns.com
149
150++OpenDNSB
151
153title = DNS Latency for resolver2.opendns.com
154host = resolver2.opendns.com</code></pre>
155<p>Now save the Targets file and exit and verify your work:</p>
157<p>Look at additional Smokeping probes and consider implementing some of them if they are useful to your organization:</p>
158<p><a href="http://oss.oetiker.ch/smokeping/probe/index.en.html" class="uri">http://oss.oetiker.ch/smokeping/probe/index.en.html</a></p>
159<h2 id="multihost-graphing"><span class="header-section-number">0.4</span> 8. MultiHost graphing</h2>
160<p>Once you have defined a group of hosts under a single probe type in your /etc/smokeping/config.d/Targets file, then you can create a single graph that will show you the results of all smokeping tests for all hosts that you define. This has the advantage of letting you quickly compare, for example, a group of hosts that you are monitoring with the FPing probe.</p>
161<p>The MultiHost graph function in Smokeping is extremely picky - pay close attention!</p>
162<p>To create a MultiHost graph first edit the file Targets:</p>
163<pre><code># editor Targets</code></pre>
164<p>We will create a MultiHost graph for the DNS Latency probes we just added. To do this go to the end of the Targets file and add:</p>
165<pre><code>#
166# Multihost Graph of all DNS latency checks
167#
168
169++MultiHostDNS
170
172title = Consolidated DNS Responses
174<p>And, as always, save and exit from the file Targets and test your new configuration.</p>
176<p>If this fails you almost certainly have an error in the entries. If you cannot figure out what the error is (remember to try &quot;tail /var/log/syslog&quot; first!) ask your instructor for some help.</p>
177<p>You can add MultiHost graphs for any other set of probe tests (FPing, EchoPingHttp) that you have configured. You must add the MultiHost entry at the end of a probe section. If you don't understand how this works you can ask your instructors for help.</p>
178<p>In addition, on the workshop NOC there are sample configuration files available, including one for SmokePing that includes multiple MultiHost graph examples.</p>
180<p>If you wish to receive an email when an alert condition is met on one of the Smokeping checks first do this:</p>
181<pre><code># cd /etc/smokeping/config.d
183<p>Update the top of the file where it says:</p>
187<p>to include a proper &quot;to&quot; and &quot;from&quot; field for your server. Something like:</p>
191<p>Now you must update your device entries to include a line that reads:</p>
195<p><a href="http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html" class="uri">http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html</a></p>
196<p>and at the bottom of the page is a section titled <code>*** Alerts ***</code></p>
197<p>To place some alert detection on some of your hosts open the file Targets:</p>
198<pre><code># editor Targets</code></pre>
199<p>and go near the start of the file where we defined our PCs. Just under the &quot;host =&quot; line add another line that looks like this:</p>
201<p>So, for example, the pc1 entry would look like this:</p>
202<pre><code>++pc1
203
205title = Virtual Machine 1
206host = pc1.ws.nsrc.org
208<p>If you want to add an alerts option to other hosts go ahead. Once you are done save and exit from the Targets file and then verify that your configuration works:</p>
210<p>If any of the hosts that have the &quot;alerts = &quot; option set meet the conditions to set off the alert, then an email will arrive to the sysadm user's mailbox on the Smokeping server machine (localhost). It's not likely that an alert will be set off for most machines. To check you can read the email for the sysadm user by using an email client like &quot;mutt&quot; -</p>
211<pre><code># apt-get install mutt
212# su - sysadm               (changes you to the sysadm user from root)
213$mutt</code></pre> 214<p>Say yes to mailbox creation when prompted, then see if you have email from the smokeping-alerts@localhost user. You probably will not. To exit from Mutt press &quot;q&quot;.</p> 215<p>To leave the sysadm user shell type:</p> 216<pre><code>$ exit
217#</code></pre>
218<h2 id="slave-instances---informational-only"><span class="header-section-number">0.6</span> 10. Slave instances - Informational Only</h2>
219<p>This is a description only for informational purposes in case you wish to attempt this type of configuration once the workshop is over.</p>
220<p>The idea behind this is that you can run multiple smokeping instances at multiple locations that are monitoring the same hosts and/or services as your master instance. The slaves will send their results to the master server and you will see these results side-by-side with your local results. This allows you to view how users outside your network see your services and hosts.</p>
221<p>This can be a powerful tool for resolving service and host issues that may be difficult to troubleshoot if you only have local data.</p>
222<p>Graphically this looks this:</p>
223<pre><code>
224          [slave 1]     [slave 2]      [slave 3]
225                |             |              |
226                +-------+     |     +--------+
227                        |     |     |
228                        v     v     v
229                        +---------------+
230                        |    master     |
231                        +---------------+
232</code></pre>
233<p>You can see example of this data here:</p>
234<p><a href="http://oss.oetiker.ch/smokeping-demo/" class="uri">http://oss.oetiker.ch/smokeping-demo/</a></p>
235<p>Look at the various graph groups and notice that many of the graphs have multiple lines with the color code chart listing items such as &quot;median RTT from mipsrv01&quot; - These are not MultiHost graphs, but rather graphs with data from external smokeping servers.</p>
236<p>To configure a smokeping master/slave server you can see the documentation here:</p>
237<p><a href="http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html" class="uri">http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html</a></p>
238<p>In addition, a sample set of steps for configuring this is available in the file sample-smokeping-master-slave.txt which should be listed as an additional reference at the bottom of the Agenda page on your classroom wiki.</p>
239</body>
240</html>