[monitoring-plugins] check_dns: add warning and critical thresholds to ...

Sven Nierlein git at monitoring-plugins.org
Sat Jun 28 22:10:08 CEST 2014


    Module: monitoring-plugins
    Branch: master
    Commit: 79ba1f90dbb9f29871f09bfd6a95cba2ed86ee5d
    Author: Jean-Claude Computing <jeanclaude.computing at gmail.com>
 Committer: Sven Nierlein <sven at nierlein.de>
      Date: Wed Feb 26 17:33:40 2014 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=79ba1f9

check_dns: add warning and critical thresholds to perfdata

---

 plugins/check_dns.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index eebe72c..a2a92f4 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -242,7 +242,14 @@ main (int argc, char **argv)
     }
     printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time);
     printf (_(". %s returns %s"), query_address, address);
-    printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
+    if ((time_thresholds->warning == NULL) || (time_thresholds->critical == NULL)) {
+      printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
+    } else {
+      printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
+                                  TRUE, time_thresholds->warning->end,
+                                  TRUE, time_thresholds->critical->end,
+                                  TRUE, 0, FALSE, 0));
+    }
   }
   else if (result == STATE_WARNING)
     printf (_("DNS WARNING - %s\n"),



More information about the Commits mailing list