diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-11-11 10:19:29 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-11-11 10:19:29 +0000 |
commit | 8c24fba55cb9df7a6bddcc07fdee64b588f6c1ed (patch) | |
tree | ecf7b91f7555f996cc71aa0a2639575b2633fca1 | |
parent | 48ecd294da3f093c83ca0e0f60ef81cecb35ab42 (diff) | |
download | monitoring-plugins-8c24fba55cb9df7a6bddcc07fdee64b588f6c1ed.tar.gz |
Fixed if only absolute warn/crit set
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@760 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins/check_swap.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 367c720d..b8f82db1 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -40,8 +40,8 @@ int validate_arguments (void); | |||
40 | void print_usage (void); | 40 | void print_usage (void); |
41 | void print_help (void); | 41 | void print_help (void); |
42 | 42 | ||
43 | int warn_percent = 200; | 43 | int warn_percent = 0; |
44 | int crit_percent = 200; | 44 | int crit_percent = 0; |
45 | long unsigned int warn_size = 0; | 45 | long unsigned int warn_size = 0; |
46 | long unsigned int crit_size = 0; | 46 | long unsigned int crit_size = 0; |
47 | int verbose; | 47 | int verbose; |
@@ -233,11 +233,12 @@ int | |||
233 | check_swap (int usp, long unsigned int free_swap) | 233 | check_swap (int usp, long unsigned int free_swap) |
234 | { | 234 | { |
235 | int result = STATE_UNKNOWN; | 235 | int result = STATE_UNKNOWN; |
236 | if (usp >= 0 && usp >= (100.0 - crit_percent)) | 236 | free_swap = free_swap * 1024; /* Convert back to bytes as warn and crit specified in bytes */ |
237 | if (usp >= 0 && crit_percent != 0 && usp >= (100.0 - crit_percent)) | ||
237 | result = STATE_CRITICAL; | 238 | result = STATE_CRITICAL; |
238 | else if (crit_size > 0 && free_swap <= crit_size) | 239 | else if (crit_size > 0 && free_swap <= crit_size) |
239 | result = STATE_CRITICAL; | 240 | result = STATE_CRITICAL; |
240 | else if (usp >= 0 && usp >= (100.0 - warn_percent)) | 241 | else if (usp >= 0 && warn_percent != 0 && usp >= (100.0 - warn_percent)) |
241 | result = STATE_WARNING; | 242 | result = STATE_WARNING; |
242 | else if (warn_size > 0 && free_swap <= warn_size) | 243 | else if (warn_size > 0 && free_swap <= warn_size) |
243 | result = STATE_WARNING; | 244 | result = STATE_WARNING; |