/usr/share/perl5/MMM/Common/Uptime.pm is in mysql-mmm-common 2.2.1-1.1.
This file is owned by root:root, with mode 0o664.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | package MMM::Common::Uptime;
use strict;
use warnings FATAL => 'all';
use English qw( OSNAME );
use Log::Log4perl qw(:easy);
require Exporter;
our @ISA = qw( Exporter );
our @EXPORT_OK = qw( uptime );
our $VERSION = '0.01';
# FIXME Solaris
if ($OSNAME eq 'linux') {
use constant UPTIME => "/proc/uptime";
}
else {
LOGDIE "Unsupported platform - can't get uptime!";
}
sub uptime {
if ($OSNAME eq 'linux') {
DEBUG "Fetching uptime from ", UPTIME;
open(FILE, UPTIME) || LOGDIE "Unable to get uptime from ", UPTIME;
my $line = <FILE>;
my ($uptime, $idle) = split(/\s+/, $line);
close(FILE);
DEBUG "Uptime is ", $uptime;
return $uptime;
}
LOGDIE "Unsupported platform - can't get uptime!";
}
1;
|