summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5c36290)
raw | patch | inline | side by side (parent: 5c36290)
author | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 20 Nov 2002 11:28:50 +0000 (11:28 +0000) | ||
committer | Karl DeBisschop <kdebisschop@users.sourceforge.net> | |
Wed, 20 Nov 2002 11:28:50 +0000 (11:28 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@218 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_dig.c | patch | blob | history |
diff --git a/plugins/check_dig.c b/plugins/check_dig.c
index ba9ff0df1bdbd71bdc9682a88b9f38888de68514..975986da6275bbcef2cbd41d38736f0ca3d8fb36 100644 (file)
--- a/plugins/check_dig.c
+++ b/plugins/check_dig.c
if (child_stderr == NULL)
printf ("Could not open stderr for %s\n", command_line);
- output = strscpy (output, "");
-
while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
/* the server is responding, we just got the host name... */
/* If we get anything on STDERR, at least set warning */
result = max_state (result, STATE_WARNING);
printf ("%s", input_buffer);
- if (!strcmp (output, ""))
+ if (strlen (output) == 0)
strscpy (output, 1 + index (input_buffer, ':'));
}
/* close the pipe */
if (spclose (child_process)) {
result = max_state (result, STATE_WARNING);
- if (!strcmp (output, ""))
- strscpy (output, "nslookup returned error status");
+ if (strlen (output) == 0)
+ strscpy (output, "dig returned error status");
}
(void) time (&end_time);
+ if (output == NULL || strcmp (output, "") == 0 || strlen (output) == 0 || strspn (output, " \t\r\n") == strlen (output))
+ strscpy (output, " Probably a non-existent host/domain");
+
if (result == STATE_OK)
printf ("DNS ok - %d seconds response time (%s)\n",
(int) (end_time - start_time), output);
else if (result == STATE_WARNING)
- printf ("DNS WARNING - %s\n",
- !strcmp (output,
- "") ? " Probably a non-existent host/domain" : output);
+ printf ("DNS WARNING - %s\n", output);
else if (result == STATE_CRITICAL)
- printf ("DNS CRITICAL - %s\n",
- !strcmp (output,
- "") ? " Probably a non-existent host/domain" : output);
+ printf ("DNS CRITICAL - %s\n", output);
else
- printf ("DNS problem - %s\n",
- !strcmp (output,
- "") ? " Probably a non-existent host/domain" : output);
+ printf ("DNS problem - %s\n", output);
return result;
}