+sub rrd_update(@) {
+ my @args = @_;
+
+ if ($use_rrds == 1) {
+ RRDs::update(@args);
+ $rrd_result = RRDs::error;
+ } else {
+ $rrd_result = system("rrdtool", "update", @args);
+ }
+}
+
+sub rrd_graph(@) {
+ my @args = @_;
+ my @rrd_out = ();
+
+ if ($use_rrds == 1) {
+ @rrd_out = RRDs::graph(@args);
+ $rrd_result = RRDs::error;
+ } else {
+ my $rrd_stdout;
+
+ open(RRDFD, '-|', 'rrdtool', 'graph', @args);
+ while(<RRDFD>) {
+ chomp;
+ $rrd_stdout = $_;
+ }
+ close(RRDFD);
+ $rrd_result = $?;
+ if ($rrd_result == 0) {
+ push @rrd_out, 0;
+ push @rrd_out, split(/x/, $rrd_stdout);
+ }
+ }
+
+ return @rrd_out;
+}
+