/usr/share/cricket/util/rrd-dump is in cricket 1.0.5-20.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | #!/usr/bin/perl -w
# -*- perl -*-
# this is a little script to exercise RRD::File -- useful
# when I was developing it, and possibly useful now too
BEGIN {
my $programdir = (($0 =~ m:^(.*/):)[0] || "./") . "..";
eval "require '$programdir/cricket-conf.pl'";
eval "require '/usr/local/etc/cricket-conf.pl'"
unless $Common::global::gInstallRoot;
$Common::global::gInstallRoot ||= $programdir;
}
use lib "$Common::global::gInstallRoot/lib";
use RRD::File;
my($rrd) = new RRD::File ( -file => $ARGV[0] );
$rrd->open();
if ($rrd->loadHeader()) {
my(@info) = ($rrd->ds_cnt(), $rrd->rra_cnt(), $rrd->pdp_step());
print "Header info: ", join(",", @info), "\n";
} else {
print STDERR "Could not read RRD file: $RRD::File::gErr\n";
exit 1;
};
print "\n";
foreach $i (0 .. $rrd->ds_cnt()-1) {
print "DS $i:\t";
print join(",", %{$rrd->ds_def($i)}), "\n";
}
print "\n";
foreach $i (0 .. $rrd->rra_cnt()-1) {
print "RRA $i:\t";
print join(",", %{$rrd->rra_def($i)}), "\n";
}
print "\n";
print "Live header:\n";
print "\tlast update time: ", $rrd->last_up();
print "\n\n";
foreach $i (0 .. $rrd->ds_cnt()-1) {
print "PDP $i:\t";
print join(",", %{$rrd->pdp($i)}), "\n";
}
print "\n";
print "CDP's:\n";
foreach $i (0 .. $rrd->rra_cnt()-1) {
print "rra=$i\n";
foreach $j (0 .. $rrd->ds_cnt()-1) {
print "\tds=$j:\t";
print join(",", %{$rrd->cdp($rrd->ds_cnt() * $i + $j)}), "\n";
}
}
print "\n";
print "RRA ptrs\n";
foreach $i (0 .. $rrd->rra_cnt()-1) {
print " $i: ", $rrd->rra_ptr($i), "\n";
}
print "\n";
print "Current values\n";
foreach $i (0 .. $rrd->ds_cnt()-1) {
print " $i: ", $rrd->getDSCurrentValue($i), "\n";
}
print "\n";
$rrd->close();
print "Metadata:\n";
$meta = $rrd->getMeta();
my($k);
foreach $k (keys(%{$meta})) {
print "\t$k: $meta->{$k}\n";
# for testing setMeta
# if ($k eq "last-inst") {
# $meta->{$k}++;
# }
}
#$rrd->setMeta($meta);
|