caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocaml munin plugin example
@ 2011-09-06  9:16 Mihamina Rakotomandimby
  0 siblings, 0 replies; only message in thread
From: Mihamina Rakotomandimby @ 2011-09-06  9:16 UTC (permalink / raw)
  To: caml-list, ocaml_beginners

Hi all,

A quick and dirty Munin plugin I currently use to monitor my traffic 
consumption: http://is.gd/2tUKFM

I have a limited plan (3GB) on an USB 3G stick (ppp0 interface), better 
to monitor it.

I store the ppp0 RX and TX traffic in a SQLite3 database in a 5 min 
basis with a cron:

*/5 *  *   *   * \
     sqlite3 /home/mihamina/accouting \
    "INSERT INTO ifconfig VALUES(NULL, DATETIME('NOW')  \
      $(/sbin/ifconfig ppp0 | sed 's/:/ /g' \
    | awk '/RX bytes/{print ",", $3, "," ,$8, ")"}')"

Need to store the counters in a persistent way because when 
deconnecting/reconnecting, counters reset.

I realized later there was an easier way by parsing /proc/net/dev 
instead of parsing ifconfig output. I'll switch to that later.

I'll blog it later too... :-)

-- 
RMA.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-06  9:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-06  9:16 [Caml-list] ocaml munin plugin example Mihamina Rakotomandimby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).