2 # Parameters understood:
5 # autoconf (optional - used by munin-config)
7 # Magic markers - optional - used by installation scripts and
11 #%# capabilities=autoconf
15 use Time
::Local
qw(timegm);
16 my $sql = "select fulldate from cpanstats where id=(select max(id) from cpanstats)";
17 my($pgdbh,$pgsth,$pgmaxid,$nextid);
18 $pgdbh = DBI
->connect("dbi:Pg:dbname=analysis") or die "Could not connect to 'analysis': $DBI::err";
19 $pgsth = $pgdbh->prepare($sql);
21 my($fulldate) = $pgsth->fetchrow_array;
22 my($y,$mon,$d,$h,$min) = $fulldate =~ /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/;
24 my $pgepoch = timegm
(0,$min,$h,$d,$mon,$y);
25 my $age = time - $pgepoch;
26 die "Seems like somebody is doing postprocessing: fulldate=$fulldate, age=$age > 1M" if $age > 1_000_000
;
28 if ($ARGV[0] eq "autoconf"){
39 if ( $ARGV[0] eq "config" ){
41 graph_title time since maxid in cpanstats
45 graph_info Age of highest record in DB
46 graph_category cpantesters
61 printf "maxidage.value %d\n", $age;
66 # cperl-indent-level: 4
67 # indent-tabs-mode: nil
69 # vim:sw=4:ts=8:sta:et