⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rrds.pm

📁 rrdtool
💻 PM
字号:
package RRDs;use strict;use vars qw(@ISA $VERSION);@ISA = qw(DynaLoader);require DynaLoader;$VERSION=1.2012;bootstrap RRDs $VERSION;1;__END__=head1 NAMERRDs - Access RRDtool as a shared module=head1 SYNOPSIS  use RRDs;  RRDs::error  RRDs::last ...  RRDs::info ...  RRDs::create ...  RRDs::update ...  RRDs::updatev ...  RRDs::graph ...  RRDs::fetch ...  RRDs::tune ...  RRDs::times(start, end)=head1 DESCRIPTION=head2 Calling SequenceThis module accesses RRDtool functionality directly from within perl. Thearguments to the functions listed in the SYNOPSIS are explained in the regularRRDtool documentation. The commandline call rrdtool update mydemo.rrd --template in:out N:12:13gets turned into RRDs::update ("mydemo.rrd", "--template", "in:out", "N:12:13");Note that --template=in:outis also valid.The RRDs::times function takes two parameters:  a "start" and "end" time.These should be specified in the B<AT-STYLE TIME SPECIFICATION> formatused by RRDtool.  See the B<rrdfetch> documentation for a detailedexplanation on how to specify time.=head2 Error HandlingThe RRD functions will not abort your program even when they can not makesense out of the arguments you fed them.The function RRDs::error should be called to get the error statusafter each function call. If RRDs::error does not return anythingthen the previous function has completed its task successfully. use RRDs; RRDs::update ("mydemo.rrd","N:12:13"); my $ERR=RRDs::error; die "ERROR while updating mydemo.rrd: $ERR\n" if $ERR;=head2 Return ValuesThe functions RRDs::last, RRDs::graph, RRDs::info, RRDs::fetch and RRDs::timesreturn their findings.B<RRDs::last> returns a single INTEGER representing the last update time. $lastupdate = RRDs::last ...B<RRDs::graph> returns an pointer to an ARRAY containing the x-size and y-size of thecreated image and results of the PRINT arguments. ($averages,$xsize,$ysize) = RRDs::graph ... print "Imagesize: ${xsize}x${ysize}\n"; print "Averages: ", (join ", ", @$averages);B<RRDs::info> returns a pointer to a hash. The keys of the hashrepresent the property names of the RRD and the values of the hash arethe values of the properties.   $hash = RRDs::info "example.rrd"; foreach my $key (keys %$hash){   print "$key = $$hash{$key}\n"; }B<RRDs::updatev> also returns a pointer to hash. The keys of the hashare concatenated strings of a timestamp, RRA index, and data source name foreach consolidated data point (CDP) written to disk as a result of thecurrent update call. The hash values are CDP values.B<RRDs::fetch> is the most complex ofthe pack regarding return values. There are 4 values. Two normalintegers, a pointer to an array and a pointer to a array of pointers.  my ($start,$step,$names,$data) = RRDs::fetch ...   print "Start:       ", scalar localtime($start), " ($start)\n";  print "Step size:   $step seconds\n";  print "DS names:    ", join (", ", @$names)."\n";  print "Data points: ", $#$data + 1, "\n";  print "Data:\n";  foreach my $line (@$data) {    print "  ", scalar localtime($start), " ($start) ";    $start += $step;    foreach my $val (@$line) {      printf "%12.1f ", $val;    }    print "\n";  }B<RRDs::times> returns two integers which are the number of seconds sinceepoch (1970-01-01) for the supplied "start" and "end" arguments, respectively.See the examples directory for more ways to use this extension.=head1 NOTEIf you are manipulating the TZ variable you should also call the posixsfunction tzset to initialize all internal state of the library for properlyoperating in the timezone of your choice. use POSIX qw(tzset); $ENV{TZ} = 'CET';    POSIX::tzset();     =head1 AUTHORTobias Oetiker E<lt>oetiker@ee.ethz.chE<gt>=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -