Module: monitoring-plugins Branch: master Commit: 37f9b45266acfeb45157d3c27a65979b33c57df7 Author: Bernd Arnold <wop...@gmail.com> Date: Sun Jun 17 09:36:13 2018 +0200 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=37f9b45
Drop uptime binary call No need to call /bin/uptime, since the string can be generated with strftime(...). --- plugins-scripts/check_uptime.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index 0a13cc0..ed859ab 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. "; }