Version française
Home     About     Download     Resources     Contact us    
Browse thread
Using Ocaml as wrapper for RRD
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Using Ocaml as wrapper for RRD

Hello,


On Fri, Apr 15, 2005 at 10:49:31AM +0200, Johann Spies wrote:
> Are there any libraries available to enable Ocaml programs/scripts as
> wrappers for RRD (like those for Python, Perl and PHP)?

Well, not a real general wrapper, but in a program that I wrote and that
I rewrite from scratch to have a more sophisticated functionality, I
also want to add code that creates RRD-tool output.
Maybe it would make sense to do it as a library. But this is not planned
now.


The program I mentioned was a sendmail-loganalyzer and it goes through
a whole sendmail-logfile and creates outputs like these:


========================================================================
SENDMAIL-Log analyzed:
Time duration of entries: Apr 27 10:20:40 -- Apr 28 10:21:22
------------------------------------------------------------------
SENT 35782
RELAYED 572
SPAM 31733
VIRUS 1367
DSN 353
DEFERRED 5
ACCESS_DENIED_RBL 2131
REJECT_BLACKLIST 1653
REJECT_OTHERS 6846
USER_UNKNOWN 534
RETURN_TO_SENDER 27
TIMEOUT 444
ERR_COLLECT 52
DISCARDED 187
INFO_ONLY 10
DID_NOT_ISSUE_MAIL 4474
ETRN 144
MESSAGE_REPEATED 1
========================================================================
SENDMAIL-Log analyzed:
Time duration of entries: Apr 20 12:41:24 -- Apr 21 11:42:35
------------------------------------------------------------------
SENT 28917
RELAYED 508
SPAM 28844
VIRUS 1010
DSN 279
DEFERRED 4
ACCESS_DENIED_RBL 1485
REJECT_BLACKLIST 1355
REJECT_OTHERS 5101
USER_UNKNOWN 1620
RETURN_TO_SENDER 56
TIMEOUT 391
ERR_COLLECT 163
DISCARDED 214
INFO_ONLY 43
DID_NOT_ISSUE_MAIL 3734
___UNKNOWN_TYPE___ : Apr 20 13:25:52 gnu mimedefang[21060]: MIMEDefang-2.48, mi_rd_cmd: read returned -1: Connection rese
t by peer 1
ETRN 138
MESSAGE_REPEATED 1
========================================================================


It is an Ocaml program with some hundreds lines of code (including
many dead code segments and a lot of comments and many empty lines)
which reads in *a complete* sendmail-logfile and throws out the above-like
stuff.

The new version (had started the project, but did not worked on it very often)
of this program will be able to read in the maillogs-files (normally two files,
which will be both read, if the logrotation has renamed the files) and
does it analyze not necessarily as a complete file.... it will be able
to read in the necessary data for time intervalls, so that one can say:
give me the maillogs-data for every 15 minutes or every hours.

And it is intended to then write the results in an rrd-like format,
or maybe even database creation and such stuff will be done by the
program.

Because of the verbose comments in the files and some dead code
eve in this version, the code base has now about 700 lines.
It's not completed, but I can throw out a lot of stuff.

I didn't included the RRD-code right now, so this is something that
will be added late on.

But the rrd-interface is already planned.


Maybe this is not what you are looking for, but you asked for RRDtool and
that is something that is at least intended to use in this sendmai-oganalyzer.


> 
> If not, what would be the recommended route using Ocaml to create
> time-related graphs.

IMHO rrdtool is cool. And if you have a patient way of living (or if
you are interested in sponsoring me ;-)) then your problem will be solved very quickly. :)

Regards,
    Oliver Bandel




> 
> Regards
> Johann
> -- 
> Johann Spies          Telefoon: 021-808 4036
> Informasietegnologie, Universiteit van Stellenbosch
> 
>      "And they questioned Him, saying "...Is it lawful for  
>       us to pay taxes to Caesar, or not? ...And He said to 
>       them "...render to Caesar the things that are  
>       Caesar's, and to God the things that are God's."      
>                       Luke 20:21,22,25 
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs