1Appender::RRDs(3) User Contributed Perl Documentation Appender::RRDs(3)
2
3
4
6 Log::Log4perl::Appender::RRDs - Log to a RRDtool Archive
7
9 use Log::Log4perl qw(get_logger);
10 use RRDs;
11
12 my $DB = "myrrddb.dat";
13
14 RRDs::create(
15 $DB, "--step=1",
16 "DS:myvalue:GAUGE:2:U:U",
17 "RRA:MAX:0.5:1:120");
18
19 print time(), "\n";
20
21 Log::Log4perl->init(\qq{
22 log4perl.category = INFO, RRDapp
23 log4perl.appender.RRDapp = Log::Log4perl::Appender::RRDs
24 log4perl.appender.RRDapp.dbname = $DB
25 log4perl.appender.RRDapp.layout = Log::Log4perl::Layout::PatternLayout
26 log4perl.appender.RRDapp.layout.ConversionPattern = N:%m
27 });
28
29 my $logger = get_logger();
30
31 for(10, 15, 20, 25) {
32 $logger->info($_);
33 sleep 1;
34 }
35
37 "Log::Log4perl::Appender::RRDs" appenders facilitate writing data to
38 RRDtool round-robin archives via Log4perl. For documentation on RRD and
39 its Perl interface "RRDs" (which comes with the distribution), check
40 out <http://rrdtool.org>.
41
42 Messages sent to Log4perl's RRDs appender are expected to be numerical
43 values (ints or floats), which then are used to run a "rrdtool update"
44 command on an existing round-robin database. The name of this database
45 needs to be set in the appender's "dbname" configuration parameter.
46
47 If there's more parameters you wish to pass to the "update" method, use
48 the "rrdupd_params" configuration parameter:
49
50 log4perl.appender.RRDapp.rrdupd_params = --template=in:out
51
52 To read out the round robin database later on, use "rrdtool fetch" or
53 "rrdtool graph" for graphic displays.
54
56 Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess
57 <cpan@goess.org>.
58
59 This library is free software; you can redistribute it and/or modify it
60 under the same terms as Perl itself.
61
62
63
64perl v5.12.2 2010-08-31 Appender::RRDs(3)