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