/ BLOG / Uptime monitoring, using Munin, on Linux

Since I didn’t come across an existing plugin after a quick google, and nor is there one in the official Munin repository that works on my Debian installations, I thought I’d post my implementation. It’s exceptionally simple, however it might save someone 10 seconds of research and coding in the future.

#!/usr/bin/perl

if ($ARGV[0] and $ARGV[0] eq "config")
{
    print "graph_args --base 1000 -l 0\n";
    print "graph_title Uptime in days\n";
    print "graph_category system\n";
    print "graph_vlabel uptime\n";
    print "uptime.label days\n";
    print "uptime.draw AREA\n";
    exit 0;
}

$uptime = `uptime`;
$uptime =~ /up (.*?) day/;
$up = int($1);

print "uptime.value $up\n";