[monitoring-plugins] Drop uptime binary call
Bernd Arnold <[email protected]> Thu, 26 Jul 2018 07:40:16 +0200 (CEST)
| Newsgroups | gmane.network.nagios.cvs |
|---|---|
| Message-ID | <20180726054016.3D4CF20084DC__13828.4400142313$1532583518$gmane$org@orwell.monitoring-plugins.org> |
Module: monitoring-plugins Branch: master Commit: 37f9b45266acfeb45157d3c27a65979b33c57df7 Author: Bernd Arnold <[email protected]> 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. "; }