aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Bernd Arnold <wopfel@gmail.com> 2018-06-17 09:36:13 +0200
committerGravatar Bernd Arnold <wopfel@gmail.com> 2018-06-17 09:36:13 +0200
commit37f9b45266acfeb45157d3c27a65979b33c57df7 (patch)
tree87e84bfbbe785fdabe1816a068f588e6ad11fc25
parent28f4d144f286e115eb2502c6c9e130d26eaba441 (diff)
downloadmonitoring-plugins-37f9b45266acfeb45157d3c27a65979b33c57df7.tar.gz
Drop uptime binary call
No need to call /bin/uptime, since the string can be generated with strftime(...).
-rwxr-xr-xplugins-scripts/check_uptime.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl
index 0a13cc0e..ed859ab3 100755
--- a/plugins-scripts/check_uptime.pl
+++ b/plugins-scripts/check_uptime.pl
@@ -143,7 +143,7 @@ $msg .= "uptime is $uptime_seconds seconds. ";
$msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text;
$msg .= "Running for $pretty_uptime. " if $opt_f;
if ( $opt_s ) {
- chomp( my $up_since = `uptime -s` );
+ my $up_since = strftime( "%Y-%m-%d %H:%M:%S", localtime( time - $uptime_seconds ) );
$msg .= "Running since $up_since. ";
}