| 1 |
package Classes::HOSTRESOURCESMIB::Component::UptimeSubsystem; |
| 2 |
our @ISA = qw(Monitoring::GLPlugin::SNMP::Item); |
| 3 |
use strict; |
| 4 |
|
| 5 |
sub init { |
| 6 |
my $self = shift; |
| 7 |
my $hrSystemUptime = $self->get_snmp_object('HOST-RESOURCES-MIB', 'hrSystemUptime'); |
| 8 |
$self->{uptime} = $self->timeticks($hrSystemUptime); |
| 9 |
$self->debug(sprintf 'uptime: %s', $self->{uptime}); |
| 10 |
$self->debug(sprintf 'up since: %s', |
| 11 |
scalar localtime (time - $self->{uptime})); |
| 12 |
} |
| 13 |
|
| 14 |
sub check { |
| 15 |
my $self = shift; |
| 16 |
$self->add_info(sprintf 'device is up since %s', |
| 17 |
$self->human_timeticks($self->{uptime})); |
| 18 |
$self->set_thresholds(warning => '15:', critical => '5:'); |
| 19 |
$self->add_message($self->check_thresholds($self->{uptime} / 60)); |
| 20 |
$self->add_perfdata( |
| 21 |
label => 'uptime', |
| 22 |
value => $self->{uptime} / 60, |
| 23 |
places => 0, |
| 24 |
); |
| 25 |
} |
| 26 |
|