diff options
author | mdavranche <mdavranche@erine.email> | 2020-08-18 15:37:38 -0400 |
---|---|---|
committer | mdavranche <mdavranche@erine.email> | 2020-08-18 15:37:38 -0400 |
commit | 11af74de386ba7c02d5d0e53f2500b5029a4537d (patch) | |
tree | 1897f0757880b69933a01a362867f2df7ff148c5 | |
parent | cadac85e12d48d662ff39bfc9f5feb5601af1485 (diff) | |
download | monitoring-plugins-11af74de386ba7c02d5d0e53f2500b5029a4537d.tar.gz |
check_swap: Handle cached swap
-rw-r--r-- | plugins/check_swap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 0ff0c770..ce3f1d7f 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -133,7 +133,7 @@ main (int argc, char **argv) | |||
133 | xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent); | 133 | xasprintf (&status, "%s [%.0f (%d%%)]", status, dskfree_mb, 100 - percent); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFre]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) { | 136 | else if (sscanf (input_buffer, "%*[S]%*[w]%*[a]%*[p]%[TotalFreCchd]%*[:] %f %*[k]%*[B]", str, &tmp_mb)) { |
137 | if (verbose >= 3) { | 137 | if (verbose >= 3) { |
138 | printf("Got %s with %f\n", str, tmp_mb); | 138 | printf("Got %s with %f\n", str, tmp_mb); |
139 | } | 139 | } |
@@ -142,7 +142,10 @@ main (int argc, char **argv) | |||
142 | dsktotal_mb = tmp_mb / 1024; | 142 | dsktotal_mb = tmp_mb / 1024; |
143 | } | 143 | } |
144 | else if (strcmp ("Free", str) == 0) { | 144 | else if (strcmp ("Free", str) == 0) { |
145 | dskfree_mb = tmp_mb / 1024; | 145 | dskfree_mb = dskfree_mb + tmp_mb / 1024; |
146 | } | ||
147 | else if (strcmp ("Cached", str) == 0) { | ||
148 | dskfree_mb = dskfree_mb + tmp_mb / 1024; | ||
146 | } | 149 | } |
147 | } | 150 | } |
148 | } | 151 | } |