package Statusmon::test;

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

#
# this class is instantiated using the configuration
# in adm/bsmon.cfg, e.g.:
#
#	test	+perf argument1="blablabla" argument2="lasjdklf"
#	test	argument1="xxx"


sub new
{

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

    bless($self, $class);

    # I want to receive "perf" events
    $self->register( "perf" );
    # ... and I want to get my run() method called every 10 minutes
    $self->sched_frequency(10);

    return($self);
}


#
# start() is invoked exactly once after setting up all the arguments
# listed in bsmon.cfg but before event() or run() is called for the first
# time
sub start {
    my( $self ) = @_;

    print "we were called with argument1=".($self->getarg("argument1"))."\n";
}
    
#
# this procedure is called for each event we have registered for
# (or we *were* registered for via config file)
sub event {
    my( $self, $cmd ) = @_;

    return unless( $cmd->{"cmd"} eq "perf" );
    my $key, $val;
    while( ($key,$val) = each %$cmd ) {
	print "$key=$val\n";
    }
    print "\n";
}


#
# this method is invoked every sched_frequency minutes
# (defaults to 5 minutes). Of course run() need not
# necessarily be present ...
sub run {
    my( $self ) = @_;

    print "\x07housekeeping time ...\n\n\\n";
}
