[Nagiosplug-devel] Wrong perfdata check_swap.c

matthias.flittner at nethinks.com matthias.flittner at nethinks.com
Tue Dec 12 09:43:07 CET 2006


These plugin puts wrong perfdata. I have patched it:

The maths auf warning and critical are wrong. 



Index: plugins/check_swap.c
===================================================================
--- plugins/check_swap.c        (revision 2)
+++ plugins/check_swap.c        (working copy)
@@ -334,10 +334,10 @@
                        state_text (result),
                        (100 - percent_used), (int) free_swap_mb, (int) 
total_swap_mb, status);

-       puts (perfdata ("swap", (long) free_swap_mb, "MB",
-                       TRUE, (long) max (warn_size_bytes/(1024 * 1024), 
warn_percent/100.0*total_swap_mb),
-                       TRUE, (long) max (crit_size_bytes/(1024 * 1024), 
crit_percent/100.0*total_swap_mb),
-                       TRUE, 0,
+       puts (perfdata ("swap", (long) total_swap_mb-free_swap_mb, "MB",
+                       TRUE, total_swap_mb-((long) max 
(warn_size_bytes/(1024 * 1024),(warn_percent/100.0*total_swap_mb))),
+                       TRUE, total_swap_mb-((long) max 
(crit_size_bytes/(1024 * 1024),(crit_percent/100.0*total_swap_mb))),
+                       TRUE, 0,
                        TRUE, (long) total_swap_mb));

        return result;



Now the perfdata is clean.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20061212/1e2d3aa6/attachment.html>


More information about the Devel mailing list