diff options
Diffstat (limited to 'plugins-scripts/check_uptime.pl')
-rwxr-xr-x | plugins-scripts/check_uptime.pl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl index f2b47be5..1f844ff6 100755 --- a/plugins-scripts/check_uptime.pl +++ b/plugins-scripts/check_uptime.pl | |||
@@ -107,9 +107,9 @@ if ( $days > 14 ) { | |||
107 | 107 | ||
108 | my $pretty_uptime = ""; | 108 | my $pretty_uptime = ""; |
109 | $pretty_uptime .= sprintf( "%d week%s, ", $weeks, $weeks == 1 ? "" : "s" ) if $weeks; | 109 | $pretty_uptime .= sprintf( "%d week%s, ", $weeks, $weeks == 1 ? "" : "s" ) if $weeks; |
110 | $pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; | 110 | $pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; |
111 | $pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; | 111 | $pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; |
112 | $pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; | 112 | $pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; |
113 | # Replace last occurence of comma with "and" | 113 | # Replace last occurence of comma with "and" |
114 | $pretty_uptime =~ s/, $/ and /; | 114 | $pretty_uptime =~ s/, $/ and /; |
115 | # Always print the seconds (though it may be 0 seconds) | 115 | # Always print the seconds (though it may be 0 seconds) |
@@ -123,16 +123,16 @@ my $state_str = "UNKNOWN"; | |||
123 | my $out_of_bounds_text = ""; | 123 | my $out_of_bounds_text = ""; |
124 | if ( $uptime_seconds > $upper_crit_threshold ) { | 124 | if ( $uptime_seconds > $upper_crit_threshold ) { |
125 | $state_str = "CRITICAL"; | 125 | $state_str = "CRITICAL"; |
126 | $out_of_bounds_text = "Exceeds upper crit threshold"; | 126 | $out_of_bounds_text = "upper crit"; |
127 | } elsif ( $uptime_seconds < $lower_crit_threshold ) { | 127 | } elsif ( $uptime_seconds < $lower_crit_threshold ) { |
128 | $state_str = "CRITICAL"; | 128 | $state_str = "CRITICAL"; |
129 | $out_of_bounds_text = "Exceeds lower crit threshold"; | 129 | $out_of_bounds_text = "lower crit"; |
130 | } elsif ( $uptime_seconds > $upper_warn_threshold ) { | 130 | } elsif ( $uptime_seconds > $upper_warn_threshold ) { |
131 | $state_str = "WARNING"; | 131 | $state_str = "WARNING"; |
132 | $out_of_bounds_text = "Exceeds upper warn threshold"; | 132 | $out_of_bounds_text = "upper warn"; |
133 | } elsif ( $uptime_seconds < $lower_warn_threshold ) { | 133 | } elsif ( $uptime_seconds < $lower_warn_threshold ) { |
134 | $state_str = "WARNING"; | 134 | $state_str = "WARNING"; |
135 | $out_of_bounds_text = "Exceeds lower warn threshold"; | 135 | $out_of_bounds_text = "lower warn"; |
136 | } else { | 136 | } else { |
137 | $state_str = "OK"; | 137 | $state_str = "OK"; |
138 | } | 138 | } |
@@ -140,7 +140,7 @@ if ( $uptime_seconds > $upper_crit_threshold ) { | |||
140 | $msg = "$state_str: "; | 140 | $msg = "$state_str: "; |
141 | 141 | ||
142 | $msg .= "uptime is $uptime_seconds seconds. "; | 142 | $msg .= "uptime is $uptime_seconds seconds. "; |
143 | $msg .= "$out_of_bounds_text. " if $out_of_bounds_text; | 143 | $msg .= "Exceeds $out_of_bounds_text threshold. " if $out_of_bounds_text; |
144 | $msg .= "Running for $pretty_uptime. " if $opt_f; | 144 | $msg .= "Running for $pretty_uptime. " if $opt_f; |
145 | if ( $opt_s ) { | 145 | if ( $opt_s ) { |
146 | chomp( my $up_since = `uptime -s` ); | 146 | chomp( my $up_since = `uptime -s` ); |