From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p869LHZD017251 for ; Tue, 6 Sep 2011 11:21:23 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiECAKjlZU7ZRrJZkWdsb2JhbABCl3mFRoEciUYUAQEBAQkLCwcUBSGBSD19NAJADQwIAQGHcagOkG2GagSHZYtJhQ+EbgGBPoVU X-IronPort-AV: E=Sophos;i="4.68,337,1312149600"; d="scan'208";a="118514319" Received: from slow3-v.mail.gandi.net ([217.70.178.89]) by mail1-smtp-roc.national.inria.fr with ESMTP; 06 Sep 2011 11:21:22 +0200 X-WhiteListed: mail was accepted with no delay X-WhiteListed: mail was accepted with no delay X-WhiteListed: mail was accepted with no delay X-WhiteListed: mail was accepted with no delay Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by slow3-v.mail.gandi.net (Postfix) with ESMTP id AEBFF3A689; Tue, 6 Sep 2011 11:16:59 +0200 (CEST) X-Originating-IP: 41.190.237.66 Received: from [192.168.0.111] (unknown [41.190.237.66]) (Authenticated sender: out@rktmb.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id BEFB71720A6; Tue, 6 Sep 2011 11:16:57 +0200 (CEST) Message-ID: <4E65E506.10809@rktmb.org> Date: Tue, 06 Sep 2011 12:16:54 +0300 From: Mihamina Rakotomandimby User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110801 Thunderbird/6.0 MIME-Version: 1.0 To: caml-list@inria.fr, ocaml_beginners@yahoogroups.com Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] ocaml munin plugin example 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.