summaryrefslogtreecommitdiffstats
path: root/plugins/check_swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_swap.c')
-rw-r--r--plugins/check_swap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 94f41a55..e0c246db 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "common.h"
30#ifdef HAVE_DECL_SWAPCTL 31#ifdef HAVE_DECL_SWAPCTL
31# ifdef HAVE_SYS_PARAM_H 32# ifdef HAVE_SYS_PARAM_H
32# include <sys/param.h> 33# include <sys/param.h>
@@ -83,6 +84,11 @@ int main(int argc, char **argv) {
83 84
84 swap_result data = get_swap_data(config); 85 swap_result data = get_swap_data(config);
85 86
87 if (data.errorcode != STATE_OK) {
88 puts("SWAP UNKNOWN - Failed to retrieve Swap usage");
89 exit(STATE_UNKNOWN);
90 }
91
86 double percent_used; 92 double percent_used;
87 /* if total_swap_mb == 0, let's not divide by 0 */ 93 /* if total_swap_mb == 0, let's not divide by 0 */
88 if (data.metrics.total != 0) { 94 if (data.metrics.total != 0) {