mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-23 06:35:42 +00:00
Merge pull request #38 from iangregory/master
uptime_bsd OpenBSD compatibility
This commit is contained in:
commit
444ccae260
1 changed files with 13 additions and 8 deletions
|
@ -1,15 +1,18 @@
|
||||||
#!/usr/local/bin/perl -w
|
#!/usr/bin/env perl
|
||||||
# -*- perl -*-
|
# -*- perl -*-
|
||||||
# Plugin to monitor number of irqs
|
# Plugin to monitor the system uptime
|
||||||
#
|
#
|
||||||
#%# family=auto
|
#%# family=auto
|
||||||
#%# capabilities=autoconf
|
#%# capabilities=autoconf
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
my %IN;
|
my %IN;
|
||||||
|
|
||||||
my $sysctl = defined($ENV{sysctl}) ? $ENV{sysctl} : '/sbin/sysctl';
|
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 (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf')) {
|
||||||
if ( -x $sysctl ) {
|
if ( -x $sysctl ) {
|
||||||
|
@ -26,12 +29,12 @@ graph_title Uptime
|
||||||
graph_args --base 1000 -l 0
|
graph_args --base 1000 -l 0
|
||||||
graph_vlabel days
|
graph_vlabel days
|
||||||
graph_category system
|
graph_category system
|
||||||
compile.label kernel age
|
compile.label Kernel age
|
||||||
compile.type GAUGE
|
compile.type GAUGE
|
||||||
compile.min 0
|
compile.min 0
|
||||||
compile.max 1000
|
compile.max 1000
|
||||||
compile.draw AREA
|
compile.draw AREA
|
||||||
uptime.label uptime
|
uptime.label Uptime
|
||||||
uptime.type GAUGE
|
uptime.type GAUGE
|
||||||
uptime.min 0
|
uptime.min 0
|
||||||
uptime.max 1000
|
uptime.max 1000
|
||||||
|
@ -47,10 +50,12 @@ $kern=~ /:\s+(.*\S)\s+\w+\@/;
|
||||||
print "Compile: $1\n";
|
print "Compile: $1\n";
|
||||||
$kern=str2time($1);
|
$kern=str2time($1);
|
||||||
|
|
||||||
my $boot=`sysctl -n kern.boottime`;
|
my $boot=`sysctl -n kern.boottime`; # OpenBSD will return seconds from the epoch
|
||||||
$boot=~ / sec = (\d+)/;
|
if ($ostype ne "OpenBSD") {
|
||||||
print "Boot: $1\n";
|
$boot=~ / sec = (\d+)/;
|
||||||
$boot=$1;
|
print "Boot: $1\n";
|
||||||
|
$boot=$1;
|
||||||
|
}
|
||||||
|
|
||||||
my $now=time;
|
my $now=time;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue