mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Make the uptime_bsd plugin OpenBSD friendly.
This commit is contained in:
parent
921de33575
commit
6272ca0c22
@ -1,15 +1,18 @@
|
||||
#!/usr/local/bin/perl -w
|
||||
#!/usr/bin/env perl
|
||||
# -*- perl -*-
|
||||
# Plugin to monitor number of irqs
|
||||
# Plugin to monitor the system uptime
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my %IN;
|
||||
|
||||
my $sysctl = defined($ENV{sysctl}) ? $ENV{sysctl} : '/sbin/sysctl';
|
||||
my $ostype = `uname -s`;
|
||||
chomp ($ostype);
|
||||
|
||||
if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf')) {
|
||||
if ( -x $sysctl ) {
|
||||
@ -26,12 +29,12 @@ graph_title Uptime
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel days
|
||||
graph_category system
|
||||
compile.label kernel age
|
||||
compile.label Kernel age
|
||||
compile.type GAUGE
|
||||
compile.min 0
|
||||
compile.max 1000
|
||||
compile.draw AREA
|
||||
uptime.label uptime
|
||||
uptime.label Uptime
|
||||
uptime.type GAUGE
|
||||
uptime.min 0
|
||||
uptime.max 1000
|
||||
@ -47,10 +50,12 @@ $kern=~ /:\s+(.*\S)\s+\w+\@/;
|
||||
print "Compile: $1\n";
|
||||
$kern=str2time($1);
|
||||
|
||||
my $boot=`sysctl -n kern.boottime`;
|
||||
$boot=~ / sec = (\d+)/;
|
||||
print "Boot: $1\n";
|
||||
$boot=$1;
|
||||
my $boot=`sysctl -n kern.boottime`; # OpenBSD will return seconds from the epoch
|
||||
if ($ostype ne "OpenBSD") {
|
||||
$boot=~ / sec = (\d+)/;
|
||||
print "Boot: $1\n";
|
||||
$boot=$1;
|
||||
}
|
||||
|
||||
my $now=time;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user