home January 01, 2017

Smokeping


Latency Statistics Graphing

Smokeping is a program that looks the the latency of the connection between your servers and multiple remote hosts.

SmokePing is a deluxe latency measurement tool. It can measure, store and display latency, latency distribution and packet loss. SmokePing uses RRDtool to maintain a longterm data-store and to draw pretty graphs, giving up to the minute information on the state of each network connection.

Smokeping is based on RRDtool. Check out our RRDtool tutorial and graph examples if you would like to make your own fully custom graphs.

Can you show me an example of the report?

Sure. You can see an example report of what the moneyslow.com config will generate here: Smokeping Example Report.

Looking at the configuration file

The configuration file will tell Smokeping what kind or reports we want generated. It will specify the location the resulting html pages will go and in what format. In this exercise we will be asking Smokeping for a general report for an internal machine and for a few external machines. Every report type is enabled in the example config file so you can get an idea of what you want to use.

Please take some time and look the config file now. Make sure to change the example URL's to the ones you want to use. All of the directives are fully commented.

#######################################################
###  moneyslow.com  smokeping/conf   BEGIN
#######################################################

### General - define your email options, html
### directories and urls
owner    = smokeping
contact  = root@localhost
mailhost = localhost
sendmail = /usr/sbin/sendmail
imgcache = /var/www/htdocs/smokeping
imgurl   = /smokeping
pagedir  = /var/www/htdocs/smokeping
datadir  = /var/db/smokeping
piddir   = /var/run/smokeping
cgiurl   = http://YOUR_HOST.com/smokeping/smokeping.cgi
smokemail = /etc/smokeping/smokemail
tmail    = /etc/smokeping/tmail
syslogfacility = local0

### Alerts - specify who email alerts will go to 
to = root@localhost
from = smokealert@localhost

### Alert Conditions - At what point will mail be sent?
### Here we are saying that if any host is at no
### packets loss (100% = good) and then going down to
### more than 50% packet loss for at lease 2 sequential
### checks then send out an alert email to the
### recipients listed above.
+bigloss
type = loss
pattern = <100%,>50%,>50%
comment = host not responding

### Database - smokeping is set to ping 20 times
### per 5 minute (300 second) interval. The following
### shows consfn mrhb steps total which is the
### resolution of the database. 
step     = 300
pings    = 20

# consfn mrhb steps total
AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720

### Presentation -This what the report pages will
### look like and where they will be placed
template = /etc/smokeping/basepage.html

## The generalized first page graph
+ overview
width = 700
height = 80
range = 3d

## Wen you click on the general graph this is
## the size of the detail graphs
+ detail
width = 700
height = 80
unison_tolerance = 2
nodata_color = cccccc

## How many graphs and at what time
## period do you want?
"Last 3 Hours"    3h
"Last 30 Hours"   30h
"Last 10 Days"    10d
"Last 400 Days"   400d

## Colors for loss
++ loss_colors

1    00ff00  "<1"
3    0000ff  "<3"
1000 ff0000  ">=3"

## Colors for uptime
++ uptime_colors

3600     00ff00   "<1h"
86400    0000ff   "<1d"
604800   ff0000   "<1w"
1000000000000 ffff00 ">1w"

### Probes - The is where we define we want to
### use icmp through fping. We also need to tell
### smokeping where fling resides
+ FPing
binary = /usr/local/sbin/fping

*** Targets - What machines are we going to ping?

## use the probe FPing
probe = FPing

## name the html page the following
menu = Top
title = SmokePing Network Latency Grapher
remark = SmokePing Network Latency Grapher

## Our top network tree is "+ Network"
## Notice the single "+"
+ Network
menu = Our Network
title = Our Network

## Sub network machine 
## Notice the two "++" which means it is under "+ Network"
++ Internal_Machine
title = Internal_Machine Box
host = internal_machine.domain.lan
alerts = bigloss

## Sub network machine 
## Notice the two "++" which means it is under "+ Network"
++ Border Router
title = Border Router of ISP
host = isp_router.isp.com
alerts = bigloss

## Sub network machine 
## Notice the two "++" which means it is under "+ Network"
++ Geographic Close 
title = one_jump_outside_isp.somehost.com (One Hop or so)
host = somehost.com
alerts = bigloss

## Sub network machine 
## Notice the two "++" which means it is under "+ Network"
++ Geographically Further Away
title = perhaps_a_hundred_miles_away.fartherhost.com (A Few Hops)
host = fartherhost.com
alerts = bigloss

## Sub network machine 
## Notice the two "++" which means it is under "+ Network"
++ Other Side of The Country
title = other_side_of_the_country.com (Many Hops)
host = other_side_of_the_country.com
alerts = bigloss

#######################################################
###  moneyslow.com  smokeping/conf   END
#######################################################

Starting the install

Step 1: Install Smokeping v2.x or greater from package or from source. The dependencies you will need are Fping and RRDTool. Make sure you have everything installed including the dependencies before continuing. For the example we are using the Smokeping package from OpenBSD which is v2.0, fping v2.4 and rrdtool v1.0.

Step 2: Place the conf file from above into the /etc/smokeping/conf. You should backup the default conf file the package places there for future reference if you want to.

Take some time and look through the config file and familiarize yourself with the options. We tried to make sure all of the used options we fully documented to make it easier for future reference.

Step 3: Smokeping will save the report html pages in the web directory of your choice specified by "pagedir" and "imgcache". For our example we placed all of the files in "/var/www/htdocs/smokeping" so our web server can access them. Make sure your directory exists before executing Webalizer for the first time.

Executing the daemon

Step 4: The daemon for Smokeping will run in the background and ping the hosts specified in the config file. To start the daemon now manually you can execute "/usr/local/bin/smokeping". The daemon will ping hosts on its own schedual and save the data to /var/db/smokeping.

Put the following into your /etc/rc.local to start smokeping on boot.

## smokeping
if [ -x /usr/local/bin/smokeping ]; then
   install -d -o _smokeping /var/run/smokeping
   echo -n ' smokeping'; /usr/local/bin/smokeping >> /dev/null 2>&1
fi

Generating Graphs

Step 5: Smokeping will generate new html report pages when executed with the "--static" argument. The best way to run it is from a cron job. In this example we will have Smokeping run once every hour to make our reports.

This is an example of the crontab you can use.

#minute (0-59)
#|   hour (0-23)
#|   |    day of the month (1-31)
#|   |    |   month of the year (1-12)
#|   |    |   |   day of the week (0-6 with 0=Sun)
#|   |    |   |   |   commands
#|   |    |   |   |   |
#### Smokeping Latency Stats
10   *    *   *   *   /usr/local/bin/smokeping --static=/var/www/htdocs/smokeping/ >> /dev/null 2>&1

In Conclusion

Now that Smokeping is active you should be able to point your web browser to your web server and look in the /smokeping url directory. If you have any problems or you notice your reports are incomplete then check the following Q&A to see if your questions is answered.

Questions?

Smokeping runs, but the graphs show nothing!Make sure to give smokping time to collect data after it is first installed. Perhaps 15 minutes or so before you can see anything. If you did give Smokeping time you need to make sure the command runs without errors. For example, if fping is not in the place specified in the config file then smokeping will fail.

Are their any other modules I can add to Smokeping?Yes there are. Please check on the Smokeping Modules Page.

Are their any other probes I can add to Smokeping?Yes, at last count there were as many as 40 additional probes. Please check on the Smokeping Probs Page.