summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-11-15 15:10:50 +0100
committerLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2024-11-15 15:10:50 +0100
commitbb88e38a345c90465386d9eb746ea704c7343e80 (patch)
tree4fbb7e68a2401def20404db754c529015721011f
parent16075bd2854b2f450483cd3287738855992c18c7 (diff)
downloadmonitoring-plugins-bb88e38a345c90465386d9eb746ea704c7343e80.tar.gz
check_swap stuff: Error out if meminfo file can not be opened
-rw-r--r--plugins/check_swap.d/swap.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/check_swap.d/swap.c b/plugins/check_swap.d/swap.c
index ba8c6439..2fe4544f 100644
--- a/plugins/check_swap.d/swap.c
+++ b/plugins/check_swap.d/swap.c
@@ -69,6 +69,13 @@ swap_result getSwapFromProcMeminfo(char proc_meminfo[]) {
69 swap_result result = {0}; 69 swap_result result = {0};
70 result.errorcode = STATE_UNKNOWN; 70 result.errorcode = STATE_UNKNOWN;
71 71
72 if (meminfo_file_ptr == NULL) {
73 // failed to open meminfo file
74 // errno should contain an error
75 result.errorcode = STATE_UNKNOWN;
76 return result;
77 }
78
72 uint64_t swap_total = 0; 79 uint64_t swap_total = 0;
73 uint64_t swap_used = 0; 80 uint64_t swap_used = 0;
74 uint64_t swap_free = 0; 81 uint64_t swap_free = 0;