caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mihamina Rakotomandimby <mihamina@rktmb.org>
To: caml-list@inria.fr, ocaml_beginners@yahoogroups.com
Subject: [Caml-list] ocaml munin plugin example
Date: Tue, 06 Sep 2011 12:16:54 +0300	[thread overview]
Message-ID: <4E65E506.10809@rktmb.org> (raw)

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.

                 reply	other threads:[~2011-09-06  9:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E65E506.10809@rktmb.org \
    --to=mihamina@rktmb.org \
    --cc=caml-list@inria.fr \
    --cc=ocaml_beginners@yahoogroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).