mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Initial version
This commit is contained in:
parent
253d8ebd1a
commit
e803e46a50
58
plugins/other/uptime_bsd
Executable file
58
plugins/other/uptime_bsd
Executable file
@ -0,0 +1,58 @@
|
||||
#!/usr/local/bin/perl -w
|
||||
# -*- perl -*-
|
||||
# Plugin to monitor number of irqs
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my %IN;
|
||||
|
||||
my $sysctl = defined($ENV{sysctl}) ? $ENV{sysctl} : '/sbin/sysctl';
|
||||
|
||||
if (defined($ARGV[0]) and ($ARGV[0] eq 'autoconf')) {
|
||||
if ( -x $sysctl ) {
|
||||
print "yes\n";
|
||||
}else{
|
||||
print "no (sysctl binary not found)\n";
|
||||
};
|
||||
exit;
|
||||
};
|
||||
|
||||
if (defined($ARGV[0]) and ($ARGV[0] eq 'config')) {
|
||||
print <<EOT ;
|
||||
graph_title Uptime
|
||||
graph_args --base 1000 -l 0
|
||||
graph_vlabel days
|
||||
graph_category system
|
||||
compile.label kernel age
|
||||
compile.type GAUGE
|
||||
compile.min 0
|
||||
compile.max 1000
|
||||
compile.draw AREA
|
||||
uptime.label uptime
|
||||
uptime.type GAUGE
|
||||
uptime.min 0
|
||||
uptime.max 1000
|
||||
uptime.draw AREA
|
||||
EOT
|
||||
exit;
|
||||
}
|
||||
|
||||
use Date::Parse;
|
||||
|
||||
my $kern=`sysctl -n kern.version`;
|
||||
$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 $now=time;
|
||||
|
||||
print "compile.value ",($now-$kern)/60/60/24,"\n";
|
||||
print "uptime.value ",($now-$boot)/60/60/24,"\n";
|
Loading…
Reference in New Issue
Block a user