[smokeping-users] Using Smokeping to measure uptime in minutes

Don Garrett dgarrett at acm.org
Sun Aug 5 20:28:49 CEST 2012


I have a network with a number of devices that are frequently turned on or
off based on usage (picture lab computers, a television with ethernet,
etc). And I'd like to measure how much time they spend turned on. I'm
already monitoring network performance using smokeping, and pinging the
devices will give enough data so it seemed a natural fit.

I'm having a hard enough time figuring this out that I was considering
building my own tool. I thought I'd ask here if it's reasonable to try to
adapt smokeping for this usage or how to go about it.


What I want:
  Assume if that if a single ping response during a probe, then the device
is up for 5 minutes, otherwise it's down for 5 minutes.

  Store minutes up per hour for the last week;  Viewable for day, week
  Store minutes up per day (with exact day boundaries at midnight) for the
last year; Viewable for last month, year.

I also intend to extract some of this data to embed current on/off values
in a different web page and to help publish weekly usage reports. Below is
a bash CGI test script to pull On/Off values directly out of rrdtool. I'll
want to do something similar for the weekly reports.


#!/bin/bash

RRDTOOL=/usr/bin/rrdtool
TAIL=/usr/bin/tail
CUT=/usr/bin/cut

# This pulls out the number of timeout pings in the last attempt
# to ping the TV. We normally see 0 failures when it's on. Could
# also test for 20 failures to show it's off.
fail_count=`${RRDTOOL} lastupdate /var/lib/smokeping/Local/TV.rrd | \
              ${TAIL} -n 1 | \
              ${CUT} -f 3 -d ' '`

result=0

[ "${fail_count}" == "0" ] && result=1

echo Content-type: text/plain
echo ""
echo "${result}"

-- 
Don
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/smokeping-users/attachments/20120805/43e5a2c3/attachment.htm 


More information about the smokeping-users mailing list