diff --git a/plugins/bsd/uptime_bsd b/plugins/bsd/uptime_bsd index 898a1a09..98f80792 100755 --- a/plugins/bsd/uptime_bsd +++ b/plugins/bsd/uptime_bsd @@ -48,7 +48,7 @@ use Date::Parse; my $kern=`sysctl -n kern.version`; $kern=~ /:\s+(.*\S)\s+\w+\@/; #print "Compile: $1\n"; -$kern=str2time($1); +$kern= $1 ? str2time($1) : undef; my $boot=`sysctl -n kern.boottime`; # OpenBSD will return seconds from the epoch if ($ostype ne "OpenBSD") { @@ -59,5 +59,5 @@ if ($ostype ne "OpenBSD") { my $now=time; -print "compile.value ",($now-$kern)/60/60/24,"\n"; +print "compile.value ",($now-$kern)/60/60/24,"\n" if $kern; print "uptime.value ",($now-$boot)/60/60/24,"\n";