summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorabrist <abrist@nagios.com>2014-02-26 17:08:59 (GMT)
committerSven Nierlein <sven@nierlein.de>2014-06-28 20:01:16 (GMT)
commite49973493c4ede24f034dc8e54d988404795ae17 (patch)
treeddc79d115d602b9dc70e839c72504a727c0b893e /plugins
parent79ba1f90dbb9f29871f09bfd6a95cba2ed86ee5d (diff)
downloadmonitoring-plugins-e49973493c4ede24f034dc8e54d988404795ae17.tar.gz
check_dns.c Added a bit more logic to thresholds
Added two if elses to cover when only one threshold is set.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_dns.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index a2a92f4..31a953d 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -242,14 +242,23 @@ main (int argc, char **argv)
242 } 242 }
243 printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time); 243 printf (ngettext("%.3f second response time", "%.3f seconds response time", elapsed_time), elapsed_time);
244 printf (_(". %s returns %s"), query_address, address); 244 printf (_(". %s returns %s"), query_address, address);
245 if ((time_thresholds->warning == NULL) || (time_thresholds->critical == NULL)) { 245 if ((time_thresholds->warning != NULL) && (time_thresholds->critical != NULL)) {
246 printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
247 } else {
248 printf ("|%s\n", fperfdata ("time", elapsed_time, "s", 246 printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
249 TRUE, time_thresholds->warning->end, 247 TRUE, time_thresholds->warning->end,
250 TRUE, time_thresholds->critical->end, 248 TRUE, time_thresholds->critical->end,
251 TRUE, 0, FALSE, 0)); 249 TRUE, 0, FALSE, 0));
252 } 250 } else if ((time_thresholds->warning == NULL) && (time_thresholds->critical != NULL)) {
251 printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
252 FALSE, 0,
253 TRUE, time_thresholds->critical->end,
254 TRUE, 0, FALSE, 0));
255 } else if ((time_thresholds->warning != NULL) && (time_thresholds->critical == NULL)) {
256 printf ("|%s\n", fperfdata ("time", elapsed_time, "s",
257 TRUE, time_thresholds->warning->end,
258 FALSE, 0,
259 TRUE, 0, FALSE, 0));
260 } else
261 printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0, FALSE, 0, TRUE, 0, FALSE, 0));
253 } 262 }
254 else if (result == STATE_WARNING) 263 else if (result == STATE_WARNING)
255 printf (_("DNS WARNING - %s\n"), 264 printf (_("DNS WARNING - %s\n"),