diff options
author | Bernd Arnold <wopfel@gmail.com> | 2018-06-03 18:55:42 (GMT) |
---|---|---|
committer | Bernd Arnold <wopfel@gmail.com> | 2018-06-03 18:55:42 (GMT) |
commit | 554b702f9d65fdfe640f20633543e00cd79d64ac (patch) | |
tree | 1456d78a49af011a3fb3db940f804e23333f9b70 /plugins-scripts | |
parent | 250adb31ef1849adea8b3bd7f66e92df1bbdd431 (diff) | |
download | monitoring-plugins-554b702f9d65fdfe640f20633543e00cd79d64ac.tar.gz |
Fix: uptime_file variable was declared too late
When called with --help, the following error was shown:
Use of uninitialized value $uptime_file in concatenation (.) or string at
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_uptime.pl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index 8c1f3d2..27dc93f 100755 --- a/plugins-scripts/check_uptime.pl +++ b/plugins-scripts/check_uptime.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!@PERL@ -w | 1 | #!/usr/bin/perl -w |
2 | 2 | ||
3 | # check_uptime - check uptime to see how long the system is running. | 3 | # check_uptime - check uptime to see how long the system is running. |
4 | # | 4 | # |
@@ -41,6 +41,8 @@ $ENV{'ENV'}=''; | |||
41 | $PROGNAME = "check_uptime"; | 41 | $PROGNAME = "check_uptime"; |
42 | $state = $ERRORS{'UNKNOWN'}; | 42 | $state = $ERRORS{'UNKNOWN'}; |
43 | 43 | ||
44 | my $uptime_file = "/proc/uptime"; | ||
45 | |||
44 | 46 | ||
45 | # Process arguments | 47 | # Process arguments |
46 | 48 | ||
@@ -54,8 +56,6 @@ if ($status){ | |||
54 | 56 | ||
55 | # Get uptime info from file | 57 | # Get uptime info from file |
56 | 58 | ||
57 | my $uptime_file = "/proc/uptime"; | ||
58 | |||
59 | if ( ! -r $uptime_file ) { | 59 | if ( ! -r $uptime_file ) { |
60 | print "ERROR: file '$uptime_file' is not readable\n"; | 60 | print "ERROR: file '$uptime_file' is not readable\n"; |
61 | exit $ERRORS{"UNKNOWN"}; | 61 | exit $ERRORS{"UNKNOWN"}; |