Track4Agenda: 3.4.2.exercises-smokeping-part1.html

File 3.4.2.exercises-smokeping-part1.html, 8.9 KB (added by dean, 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">
3<head>
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 I" />
8  <title>Network Management &amp; Monitoring</title>
9  <style type="text/css">code{white-space: pre;}</style>
10  <link rel="stylesheet" href="./style.css" type="text/css" />
11</head>
12<body>
13<div id="header">
14<h1 class="title">Network Management &amp; Monitoring</h1>
15<h2 class="author">Smokeping - Part I</h2>
16</div>
17<h2 id="exercises">Exercises</h2>
18<p>In this exercise you will install Smokeping and get it to monitor various devices in the class network.</p>
19<p>Since most of the tasks in this exercise require you to be &quot;root&quot;, the first thing you should do is to connect to your PC and start a root shell.</p>
20<pre><code>$ sudo -s
21#</code></pre>
22<h2 id="install-smokeping">1. Install Smokeping</h2>
23<p>smokeping relies on sendmail but we can install both at the same time.</p>
24<pre><code># apt-get install sendmail smokeping</code></pre>
25<p>For Ubuntu 14.04: you need to install a symlink to the apache2 config</p>
26<pre><code># ln -s /etc/smokeping/apache2.conf /etc/apache2/conf-available/smokeping.conf
27# a2enconf smokeping</code></pre>
28<p>Also, the CGI module needs to be enabled in Apache:</p>
29<pre><code># a2enmod cgi</code></pre>
30<p>Finally, reload the Apache configuration:</p>
31<pre><code># service apache2 reload</code></pre>
32<p>Then point your web browser at</p>
33<pre><code>http://pcN.ws.nsrc.org/smokeping/smokeping.cgi</code></pre>
34<p>(replace &quot;pcN&quot; with your own PC) to check that it is running.</p>
35<h2 id="initial-configuration">2. Initial Configuration</h2>
36<pre><code># cd /etc/smokeping/config.d
37# ls -l
38
39-rwxr-xr-x 1 root root  578 2010-02-26 01:55 Alerts
40-rwxr-xr-x 1 root root  237 2010-02-26 01:55 Database
41-rwxr-xr-x 1 root root  413 2010-02-26 05:40 General
42-rwxr-xr-x 1 root root  271 2010-02-26 01:55 pathnames
43-rwxr-xr-x 1 root root  859 2010-02-26 01:55 Presentation
44-rwxr-xr-x 1 root root  116 2010-02-26 01:55 Probes
45-rwxr-xr-x 1 root root  155 2010-02-26 01:55 Slaves
46-rwxr-xr-x 1 root root 8990 2010-02-26 06:30 Targets</code></pre>
47<p>The files that you'll need to change, at a minimum, are:</p>
48<ul>
49<li>Alerts</li>
50<li>General</li>
51<li>Probes</li>
52<li>Targets</li>
53</ul>
54<p>Now open the General file (note the first capital letter)</p>
55<pre><code># editor General</code></pre>
56<p>Change the following lines:</p>
57<pre><code>owner    = NOC
58contact  = sysadm@localhost
59mailhost = localhost
60cgiurl   = http://localhost/smokeping/smokeping.cgi
61# specify this to get syslog logging
62syslogfacility = local5</code></pre>
63<p>Save the file and exit. Now let's restart the Smokeping service to verify that no mistakes have been made before going any further:</p>
64<pre><code># service smokeping stop
65# service smokeping start</code></pre>
66<p>A quicker way to do this is:</p>
67<pre><code># service smokeping restart</code></pre>
68<p>We'll use this for the rest of the exercises, or we'll just use the &quot;reload&quot; directive as this is all you need for Smokeping to see configuration file changes.</p>
69<h2 id="configure-monitoring-of-devices">3. Configure monitoring of devices</h2>
70<p>The majority of your time and work configuring Smokeping will be done in the file /etc/smokeping/config.d/Targets.</p>
71<p>For this class please do the following:</p>
72<p>Use the default FPing probe to check:</p>
73<ul>
74<li>some of the student PCs</li>
75<li>classroom NOC</li>
76<li>switches</li>
77<li>routers</li>
78</ul>
79<p>You can use the classroom Network Diagram on the classroom wiki to figure out addresses for each item, etc.</p>
80<p>Create some hierarchy to the Smokeping menu for your checks. For example, the Targets file is already partially preconfigured. To start we are going to add some entries to this file. Start with:</p>
81<pre><code># cd /etc/smokeping/config.d
82# editor Targets</code></pre>
83<p>You can take the section from <code>*** Targets ***</code> to the end of the LocalMachine and make it look something like this. Feel free to use your own &quot;remark&quot;, &quot;menu&quot; text and titles. Note that we remove the commented lines <code>#parents = owner:/Test/James location:/</code>, and the &quot;Alerts&quot; line.</p>
84<p>NOTE: We strongly recommend that you COPY and PASTE text from these exercises directly in to the Targets file. Typing all this by hand will take too long.</p>
85<pre><code>*** Targets ***
86
87probe = FPing
88
89menu = Top
90title = Network Latency Grapher
91remark = Smokeping Latency Grapher for Network Monitoring \
92         and Management Workshop.
93
94+Local
95
96menu = Local Network Monitoring and Management
97title = Local Network
98
99++LocalMachine
100
101menu = Local Machine
102title = This host
103host = localhost</code></pre>
104<p>Now, below the &quot;localhost&quot; we start with the configuration of items for our class. We can start simple and add just the first 4 PCs that are in Group 1 as well as an entry for our classroom NOC.</p>
105<pre><code>#
106# ********* Classroom Servers **********
107#
108
109+Servers
110
111menu = Servers
112title = Network Management Servers
113
114++noc
115
116menu = noc
117title = Workshop NOC
118host = noc.ws.nsrc.org
119
120#
121# ******** Student Machines (VMs) ***********
122#
123
124+PCs
125
126menu = Lab PCs
127title = Virtual PCs Network Management
128
129++pc1
130
131menu = pc1
132title = Virtual Machine 1
133host = pc1.ws.nsrc.org
134
135
136++pc2
137
138menu = pc2
139title = Virtual Machine 2
140host = pc2.ws.nsrc.org
141
142
143++pc3
144
145menu = pc3
146title = Virtual Machine 3
147host = pc3.ws.nsrc.org
148
149
150++pc4
151
152menu = pc4
153title = Virtual Machine 4
154host = pc4.ws.nsrc.org</code></pre>
155<p>OK. Let's see if we can get Smokeping to stop and start with the changes we have made, so far. Save and exit from the Targets file. Now try doing:</p>
156<pre><code># service smokeping reload</code></pre>
157<p>If you see error messages, then read them closely and try to correct the problem in the Targets file. In addition, Smokeping is now sending log message to the file /var/log/syslog. You can view what Smokeping is saying by typing:</p>
158<pre><code># tail /var/log/syslog</code></pre>
159<p>If you want to see all smokeping related messages in the file /var/log/syslog you can do this:</p>
160<pre><code># grep smokeping /var/log/syslog</code></pre>
161<p>If there are no errors you can view the results of your changes by going to:</p>
162<pre><code>http://pcN.ws.nsrc.org/cgi-bin/smokeping.cgi</code></pre>
163<p>When you are ready you can edit the Targets file again and continue to add machines. At the bottom of the file you can add the next group of PCs:</p>
164<pre><code>++pc5
165
166menu = pc5
167title = Virtual Machine 5
168host = pc5.ws.nsrc.org
169
170
171++pc6
172
173menu = pc6
174title = Virtual Machine 6
175host = pc6.ws.nsrc.org
176
177
178++pc7
179
180menu = pc7
181title = Virtual Machine 7
182host = pc7.ws.nsrc.org
183
184
185++pc8
186
187menu = pc8
188title = Virtual Machine 8
189host = pc8.ws.nsrc.org</code></pre>
190<p>Add as many PCs as you want, then Save and exit from the Targets file and verify that the changes you have made are working:</p>
191<pre><code># service smokeping reload</code></pre>
192<p>You can continue to view the updated results of your changes on the Smokeping web page. It may take up to 5 minutes before graphs begin to appear.</p>
193<pre><code>http://pcN.ws.nsrc.org/cgi-bin/smokeping.cgi</code></pre>
194<h2 id="configure-monitoring-of-routers-and-switches">4. Configure monitoring of routers and switches</h2>
195<p>Once you have configured as many PCs as you want to configure, then it's time to add in some entries for the classroom routers and switch(es).</p>
196<pre><code># cd /etc/smokeping/config.d        (just to be sure :-))
197# editor Targets</code></pre>
198<p>Go to the bottom of the file and add in some entries for routers and switches:</p>
199<pre><code>#
200# ********** Classroom Backbone Switch *********
201#
202
203+Switches
204
205menu = Switches
206title = Switches Network Management
207
208++sw
209
210menu = sw
211title = Backbone Switch
212host = sw.ws.nsrc.org
213
214#
215# ********** Virtual Routers: Cisco 7200 images *********
216#
217
218+Routers
219
220menu = Routers
221title = Virtual and Physical Routers Network Management
222
223++gw
224
225menu = gw
226title = Gateway Router
227host = gw.ws.nsrc.org
228
229++router1
230
231menu = router1
232title = Virtual Router 1
233host = rtr1.ws.nsrc.org
234
235++router2
236
237menu = router2
238title = Virtual Router 2
239host = rtr2.ws.nsrc.org
240
241++router3
242
243menu = router3
244title = Virtual Router 3
245host = rtr3.ws.nsrc.org</code></pre>
246<p>If you wish you can continue and add in entries for routers 4 to 6, or up to 9 if there are that many in your class. When you are ready Save and Exit from the Targets file and verify your work:</p>
247<pre><code># service smokeping reload</code></pre>
248<p>If you want you might consider adding the Wireless Access Point:</p>
249<pre><code># editor Targets</code></pre>
250<pre><code>#
251# Classrom Wireless Access Point
252#
253
254++ap1
255
256menu = ap1
257title = Wireless Access Point 1
258host = ap1.ws.nsrc.org</code></pre>
259<p>Save and Exit from the file and reload the Smokeping service:</p>
260<pre><code># service smokeping reload</code></pre>
261</body>
262</html>