File: uptime.in

package info (click to toggle)
munin 2.0.76-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,068 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (36 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (12)
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
#!@@PERL@@
# -*- mode: cperl; cperl-indent-level: 8; -*-
#
# Plugin to monitor uptime in Darwin hosts.
#
# Parameters:
#
#       config
#       autoconf
#
#%# family=auto
#%# capabilities=autoconf

use strict;
use warnings;

my $arg = shift();

if (defined($arg) && $arg eq 'config') {
        print("graph_title Uptime
graph_args --base 1000 -l 0
graph_vlabel uptime in days
graph_scale no
graph_category system
uptime.label uptime
uptime.draw AREA
");
        exit;
} elsif (defined($arg) && $arg eq 'autoconf') {
        print "yes\n";
        exit;
}

my $boottime = `/usr/sbin/sysctl kern.boottime`;
$boottime =~ s/.* sec = ([0-9+].*)\,.*/$1/;
printf "uptime.value %.03f\n", (time-$boottime)/86400;