Преглед изворни кода

check_dns: add warning and critical thresholds to perfdata

Jean-Claude Computing пре 12 година
родитељ
комит
9f90d12b8b
1 измењених фајлова са 8 додато и 1 уклоњено
  1. 8 1
      plugins/check_dns.c

+ 8 - 1
plugins/check_dns.c

@@ -322,7 +322,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"),