| 1 | % Network Management & Monitoring |
|---|
| 2 | % Smokeping - Part II |
|---|
| 3 | |
|---|
| 4 | 5. Add new probes to Smokeping |
|---|
| 5 | ------------------------------ |
|---|
| 6 | |
|---|
| 7 | The current entry in the Probes file is fine, but if you wish to use additional |
|---|
| 8 | Smokeping checks you can add them in here and you can specify their default |
|---|
| 9 | behavior. You can do this, as well, in the Targets file if you wish. |
|---|
| 10 | |
|---|
| 11 | To add a probe to check for HTTP latency as well as DNS lookup latency, |
|---|
| 12 | edit the Probes file and add the following text TO THE END of that file: |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 16 | + EchoPingHttp |
|---|
| 17 | |
|---|
| 18 | + DNS |
|---|
| 19 | binary = /usr/bin/dig |
|---|
| 20 | pings = 5 |
|---|
| 21 | step = 180 |
|---|
| 22 | lookup = www.nsrc.org |
|---|
| 23 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | The DNS probe will look up the IP address of www.nsrc.org using any other open |
|---|
| 27 | DNS server (resolver) you specify in the Targets file. You will see this a bit |
|---|
| 28 | futher on in the exercises. |
|---|
| 29 | |
|---|
| 30 | Now Save and exit from the file and verify that your changes are working: |
|---|
| 31 | |
|---|
| 32 | # service smokeping reload |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | 6. Add HTTP latency checks for the classroom PCs |
|---|
| 37 | ------------------------------------------------ |
|---|
| 38 | |
|---|
| 39 | Edit the Targets file again and go to the end of the file: |
|---|
| 40 | |
|---|
| 41 | # editor Targets |
|---|
| 42 | |
|---|
| 43 | At the end of the file add: |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 47 | # |
|---|
| 48 | # Local Web server response |
|---|
| 49 | # |
|---|
| 50 | |
|---|
| 51 | +HTTP |
|---|
| 52 | |
|---|
| 53 | menu = Local HTTP Response |
|---|
| 54 | title = HTTP Response Student PCs |
|---|
| 55 | |
|---|
| 56 | ++pc1 |
|---|
| 57 | |
|---|
| 58 | menu = pc1 |
|---|
| 59 | title = pc1 HTTP response time |
|---|
| 60 | probe = EchoPingHttp |
|---|
| 61 | host = pc1.ws.nsrc.org |
|---|
| 62 | |
|---|
| 63 | ++pc2 |
|---|
| 64 | |
|---|
| 65 | menu = pc2 |
|---|
| 66 | title = pc2 HTTP response time |
|---|
| 67 | probe = EchoPingHttp |
|---|
| 68 | host = pc2.ws.nsrc.org |
|---|
| 69 | |
|---|
| 70 | ++pc3 |
|---|
| 71 | |
|---|
| 72 | menu = pc3 |
|---|
| 73 | title = pc3 HTTP response time |
|---|
| 74 | probe = EchoPingHttp |
|---|
| 75 | host = pc3.ws.nsrc.org |
|---|
| 76 | |
|---|
| 77 | ++pc4 |
|---|
| 78 | |
|---|
| 79 | menu = pc4 |
|---|
| 80 | title = pc1 HTTP response time |
|---|
| 81 | probe = EchoPingHttp |
|---|
| 82 | host = pc4.ws.nsrc.org |
|---|
| 83 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | You could actually just use the "probe = EchoPingHttp" statement once for pc1, |
|---|
| 87 | and then this would be the default probe until another "probe = " statement is |
|---|
| 88 | seen in the Targets file. |
|---|
| 89 | |
|---|
| 90 | You can add more PC entries if you wish, or you could consider checking the |
|---|
| 91 | latency on remote machines - these are likely to be more interesting. Machines |
|---|
| 92 | such as your own publicly accessible servers are a good choice, or, perhaps other |
|---|
| 93 | web servers you use often (Google, Yahoo, Government pages, stores, etc.?). |
|---|
| 94 | |
|---|
| 95 | For example, consider adding something like this at the bottom of the Targets file: |
|---|
| 96 | |
|---|
| 97 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 98 | # |
|---|
| 99 | # Remote Web server response |
|---|
| 100 | # |
|---|
| 101 | |
|---|
| 102 | +HTTPRemote |
|---|
| 103 | |
|---|
| 104 | menu = Remote HTTP Response |
|---|
| 105 | title = HTTP Response Remote Machines |
|---|
| 106 | |
|---|
| 107 | ++google |
|---|
| 108 | |
|---|
| 109 | menu = Google |
|---|
| 110 | title = Google.com HTTP response time |
|---|
| 111 | probe = EchoPingHttp |
|---|
| 112 | host = www.google.com |
|---|
| 113 | |
|---|
| 114 | ++nsrc |
|---|
| 115 | |
|---|
| 116 | menu = Network Startup Resource Center |
|---|
| 117 | title = nsrc.org HTTP response time |
|---|
| 118 | probe = EchoPingHttp |
|---|
| 119 | host = nsrc.org |
|---|
| 120 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 121 | |
|---|
| 122 | Add your own hosts that you use at your organization to the list of Remote Web Servers. |
|---|
| 123 | |
|---|
| 124 | Once you are done, save and exit from the Targets file and verify your work: |
|---|
| 125 | |
|---|
| 126 | # service smokeping reload |
|---|
| 127 | |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | 7. Add DNS latency checks |
|---|
| 132 | ------------------------- |
|---|
| 133 | |
|---|
| 134 | At the end of the Targets file we are going to add some entries to verify the |
|---|
| 135 | latency from our location to remote recursive DNS servers to look up an entry |
|---|
| 136 | for nsrc.org. You would likely substitue an important address for your institution |
|---|
| 137 | in the Probes file instead. In addition, you can change the address you are looking |
|---|
| 138 | up inside the Targets file as well. For more information see: |
|---|
| 139 | |
|---|
| 140 | <http://oss.oetiker.ch/smokeping/probe/DNS.en.html> |
|---|
| 141 | |
|---|
| 142 | and |
|---|
| 143 | |
|---|
| 144 | <http://oss.oetiker.ch/smokeping/probe/index.en.html> |
|---|
| 145 | |
|---|
| 146 | Now edit the Targets file again. Be sure to go to the end of the file: |
|---|
| 147 | |
|---|
| 148 | # cd /etc/smokeping/config.d (just to be sure...) |
|---|
| 149 | # editor Targets |
|---|
| 150 | |
|---|
| 151 | At the end of the file add: |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 155 | # |
|---|
| 156 | # Sample DNS probe |
|---|
| 157 | # |
|---|
| 158 | |
|---|
| 159 | +DNS |
|---|
| 160 | |
|---|
| 161 | probe = DNS |
|---|
| 162 | menu = DNS Latency |
|---|
| 163 | title = DNS Latency Probes |
|---|
| 164 | |
|---|
| 165 | ++LocalDNS1 |
|---|
| 166 | menu = 10.10.0.241 |
|---|
| 167 | title = DNS Delay for local DNS Server on ns1.ws.nsrc.org |
|---|
| 168 | host = ns1.ws.nsrc.org |
|---|
| 169 | |
|---|
| 170 | ++GoogleA |
|---|
| 171 | menu = 8.8.8.8 |
|---|
| 172 | title = DNS Latency for google-public-dns-a.google.com |
|---|
| 173 | host = google-public-dns-a.google.com |
|---|
| 174 | |
|---|
| 175 | ++GoogleB |
|---|
| 176 | |
|---|
| 177 | menu = 8.8.8.4 |
|---|
| 178 | title = DNS Latency for google-public-dns-b.google.com |
|---|
| 179 | host = google-public-dns-b.google.com |
|---|
| 180 | |
|---|
| 181 | ++OpenDNSA |
|---|
| 182 | |
|---|
| 183 | menu = 208.67.222.222 |
|---|
| 184 | title = DNS Latency for resolver1.opendns.com |
|---|
| 185 | host = resolver1.opendns.com |
|---|
| 186 | |
|---|
| 187 | ++OpenDNSB |
|---|
| 188 | |
|---|
| 189 | menu = 208.67.220.220 |
|---|
| 190 | title = DNS Latency for resolver2.opendns.com |
|---|
| 191 | host = resolver2.opendns.com |
|---|
| 192 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | Now save the Targets file and exit and verify your work: |
|---|
| 196 | |
|---|
| 197 | # service smokeping reload |
|---|
| 198 | |
|---|
| 199 | Look at additional Smokeping probes and consider implementing some of |
|---|
| 200 | them if they are useful to your organization: |
|---|
| 201 | |
|---|
| 202 | <http://oss.oetiker.ch/smokeping/probe/index.en.html> |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | 8. MultiHost graphing |
|---|
| 207 | --------------------- |
|---|
| 208 | |
|---|
| 209 | Once you have defined a group of hosts under a single probe type in your |
|---|
| 210 | /etc/smokeping/config.d/Targets file, then you can create a single graph |
|---|
| 211 | that will show you the results of all smokeping tests for all hosts that |
|---|
| 212 | you define. This has the advantage of letting you quickly compare, for |
|---|
| 213 | example, a group of hosts that you are monitoring with the FPing probe. |
|---|
| 214 | |
|---|
| 215 | The MultiHost graph function in Smokeping is extremely picky - pay close |
|---|
| 216 | attention! |
|---|
| 217 | |
|---|
| 218 | To create a MultiHost graph first edit the file Targets: |
|---|
| 219 | |
|---|
| 220 | # editor Targets |
|---|
| 221 | |
|---|
| 222 | We will create a MultiHost graph for the DNS Latency probes we just added. |
|---|
| 223 | To do this go to the end of the Targets file and add: |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 227 | # |
|---|
| 228 | # Multihost Graph of all DNS latency checks |
|---|
| 229 | # |
|---|
| 230 | |
|---|
| 231 | ++MultiHostDNS |
|---|
| 232 | |
|---|
| 233 | menu = MultiHost DNS |
|---|
| 234 | title = Consolidated DNS Responses |
|---|
| 235 | host = /DNS/LocalDNS1 /DNS/GoogleA /DNS/GoogleB /DNS/OpenDNSA /DNS/OpenDNSB |
|---|
| 236 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 237 | |
|---|
| 238 | And, as always, save and exit from the file Targets and test your new configuration. |
|---|
| 239 | |
|---|
| 240 | |
|---|
| 241 | # service smokeping reload |
|---|
| 242 | |
|---|
| 243 | |
|---|
| 244 | If this fails you almost certainly have an error in the entries. If you cannot figure |
|---|
| 245 | out what the error is (remember to try "tail /var/log/syslog" first!) ask your instructor |
|---|
| 246 | for some help. |
|---|
| 247 | |
|---|
| 248 | You can add MultiHost graphs for any other set of probe tests (FPing, EchoPingHttp) |
|---|
| 249 | that you have configured. You must add the MultiHost entry at the end of a probe section. |
|---|
| 250 | If you don't understand how this works you can ask your instructors for help. |
|---|
| 251 | |
|---|
| 252 | In addition, on the workshop NOC there are sample configuration files available, including |
|---|
| 253 | one for SmokePing that includes multiple MultiHost graph examples. |
|---|
| 254 | |
|---|
| 255 | |
|---|
| 256 | 9. Send Smokeping alerts |
|---|
| 257 | ------------------------ |
|---|
| 258 | |
|---|
| 259 | If you wish to receive an email when an alert condition is met on one of the |
|---|
| 260 | Smokeping checks first do this: |
|---|
| 261 | |
|---|
| 262 | # cd /etc/smokeping/config.d |
|---|
| 263 | # editor Alerts |
|---|
| 264 | |
|---|
| 265 | Update the top of the file where it says: |
|---|
| 266 | |
|---|
| 267 | *** Alerts *** |
|---|
| 268 | to = alertee@address.somewhere |
|---|
| 269 | from = smokealert@company.xy |
|---|
| 270 | |
|---|
| 271 | to include a proper "to" and "from" field for your server. Something like: |
|---|
| 272 | |
|---|
| 273 | *** Alerts *** |
|---|
| 274 | to = sysadm@localhost |
|---|
| 275 | from = smokeping-alert@localhost |
|---|
| 276 | |
|---|
| 277 | Now you must update your device entries to include a line that reads: |
|---|
| 278 | |
|---|
| 279 | alerts = alertName1, alertName2, etc, etc... |
|---|
| 280 | |
|---|
| 281 | For instance, the alert named, "someloss" has already been defined in the file Alerts: |
|---|
| 282 | |
|---|
| 283 | To read about Smokeping alerts and what they are detecting, how to create your own, etc. see: |
|---|
| 284 | |
|---|
| 285 | <http://oss.oetiker.ch/smokeping/doc/smokeping_config.en.html> |
|---|
| 286 | |
|---|
| 287 | and at the bottom of the page is a section titled `*** Alerts ***` |
|---|
| 288 | |
|---|
| 289 | To place some alert detection on some of your hosts open the file Targets: |
|---|
| 290 | |
|---|
| 291 | # editor Targets |
|---|
| 292 | |
|---|
| 293 | and go near the start of the file where we defined our PCs. Just under the "host =" line add |
|---|
| 294 | another line that looks like this: |
|---|
| 295 | |
|---|
| 296 | alerts = someloss |
|---|
| 297 | |
|---|
| 298 | So, for example, the pc1 entry would look like this: |
|---|
| 299 | |
|---|
| 300 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 301 | ++pc1 |
|---|
| 302 | |
|---|
| 303 | menu = pc1 |
|---|
| 304 | title = Virtual Machine 1 |
|---|
| 305 | host = pc1.ws.nsrc.org |
|---|
| 306 | alerts = someloss |
|---|
| 307 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 308 | |
|---|
| 309 | If you want to add an alerts option to other hosts go ahead. Once you are done save and |
|---|
| 310 | exit from the Targets file and then verify that your configuration works: |
|---|
| 311 | |
|---|
| 312 | # service smokeping reload |
|---|
| 313 | |
|---|
| 314 | If any of the hosts that have the "alerts = " option set meet the conditions to set off the |
|---|
| 315 | alert, then an email will arrive to the sysadm user's mailbox on the Smokeping server |
|---|
| 316 | machine (localhost). It's not likely that an alert will be set off for most machines. To |
|---|
| 317 | check you can read the email for the sysadm user by using an email client like "mutt" - |
|---|
| 318 | |
|---|
| 319 | # apt-get install mutt |
|---|
| 320 | # su - sysadm (changes you to the sysadm user from root) |
|---|
| 321 | $ mutt |
|---|
| 322 | |
|---|
| 323 | Say yes to mailbox creation when prompted, then see if you have email from the |
|---|
| 324 | smokeping-alerts@localhost user. You probably will not. To exit from Mutt press "q". |
|---|
| 325 | |
|---|
| 326 | To leave the sysadm user shell type: |
|---|
| 327 | |
|---|
| 328 | $ exit |
|---|
| 329 | # |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | 10. Slave instances - Informational Only |
|---|
| 333 | ---------------------------------------- |
|---|
| 334 | |
|---|
| 335 | This is a description only for informational purposes in case you wish |
|---|
| 336 | to attempt this type of configuration once the workshop is over. |
|---|
| 337 | |
|---|
| 338 | The idea behind this is that you can run multiple smokeping instances |
|---|
| 339 | at multiple locations that are monitoring the same hosts and/or services |
|---|
| 340 | as your master instance. The slaves will send their results to the |
|---|
| 341 | master server and you will see these results side-by-side with your |
|---|
| 342 | local results. This allows you to view how users outside your network |
|---|
| 343 | see your services and hosts. |
|---|
| 344 | |
|---|
| 345 | This can be a powerful tool for resolving service and host issues that |
|---|
| 346 | may be difficult to troubleshoot if you only have local data. |
|---|
| 347 | |
|---|
| 348 | Graphically this looks this: |
|---|
| 349 | |
|---|
| 350 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 351 | |
|---|
| 352 | [slave 1] [slave 2] [slave 3] |
|---|
| 353 | | | | |
|---|
| 354 | +-------+ | +--------+ |
|---|
| 355 | | | | |
|---|
| 356 | v v v |
|---|
| 357 | +---------------+ |
|---|
| 358 | | master | |
|---|
| 359 | +---------------+ |
|---|
| 360 | |
|---|
| 361 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 362 | |
|---|
| 363 | You can see example of this data here: |
|---|
| 364 | |
|---|
| 365 | <http://oss.oetiker.ch/smokeping-demo/> |
|---|
| 366 | |
|---|
| 367 | Look at the various graph groups and notice that many of the graphs |
|---|
| 368 | have multiple lines with the color code chart listing items such as |
|---|
| 369 | "median RTT from mipsrv01" - These are not MultiHost graphs, but rather |
|---|
| 370 | graphs with data from external smokeping servers. |
|---|
| 371 | |
|---|
| 372 | To configure a smokeping master/slave server you can see the documentation |
|---|
| 373 | here: |
|---|
| 374 | |
|---|
| 375 | <http://oss.oetiker.ch/smokeping/doc/smokeping_master_slave.en.html> |
|---|
| 376 | |
|---|
| 377 | In addition, a sample set of steps for configuring this is available in |
|---|
| 378 | the file sample-smokeping-master-slave.txt which should be listed as an |
|---|
| 379 | additional reference at the bottom of the Agenda page on your classroom wiki. |
|---|
| 380 | |
|---|