[monitoring-plugins] Improving output when swap space has zero size

Jan Wagner git at monitoring-plugins.org
Sun Oct 19 23:10:08 CEST 2014


 Module: monitoring-plugins
 Branch: master
 Commit: 441913dcb700cb92b8a0448b813d60fccc436bc8
 Author: Jan Wagner <waja at cyconet.org>
   Date: Sun Oct 19 22:58:47 2014 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=441913d

Improving output when swap space has zero size

---

 plugins/check_swap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/check_swap.c b/plugins/check_swap.c
index 4a573c7..63c9505 100644
--- a/plugins/check_swap.c
+++ b/plugins/check_swap.c
@@ -349,6 +349,9 @@ main (int argc, char **argv)
 
 	/* if total_swap_mb == 0, let's not divide by 0 */
 	if(total_swap_mb) {
+		if(total_swap_mb == 0) {
+			status = "- Swap is either disabled, not present, or of zero size. ";
+		}
 		percent_used = 100 * ((double) used_swap_mb) / ((double) total_swap_mb);
 	} else {
 		percent_used = 100;



More information about the Commits mailing list