#
#  RRD Support, uses shared libraries installed with rrdtool
#

package Statusmon::RRDs;

use Statusmon::Statusmon;

@Statusmon::RRDs::ISA = qw(Statusmon::Statusmon);

sub new
{

    my ($this) = @_;
    my  $class = ref($this) || $this;
    my  $self = {};

    bless($self, $class);

    eval { 
	require RRDs;
	$self->add_feature_provider( "rrd" );
    };
    if( $@ ) {
	BigSister::common::log( "notice", "RRDTool's perl module is not present - not using perl bindings" );
    }

    return($self);
}


sub start {
}
    


sub rrd_create {
    my( $self, $file, @args ) = @_;

    print "RRDs::create($file,",join(",",@args),")\n";
    RRDs::create( $file, @args );
    my $status = RRDs::error;
    (print "status code $status\n") if ($status);
    return( $status );
}


sub rrd_update {
    my( $self, $file, @args ) = @_;

    print "RRDs::update($file,",join(",",@args),")\n";
    RRDs::update( $file, @args );
    my $status = RRDs::error;
    (print "status code $status\n") if ($status);
    return( $status );
}


sub rrd_graph {
    my( $self, $file, @args ) = @_;

    print "RRDs::graph($file,",join(",",@args),")\n";
    RRDs::graph( $file, @args );
    my $status = RRDs::error;
    (print "status code $status\n") if ($status);
    return( $status );
}


1;
