check_dig not working as expected (plugins 1.4.15)
Benjamin KRAFT
benj at dotnul.com
Mon Apr 25 13:52:58 CEST 2011
Hello,
Well, unless I'm very wrong, check_dns doesn't permit to choose what type of record you want to query (eg. using -q=MX nslookup command line option).
Kind regards,
Benjamin
Le 25 avr. 2011 à 03:37, Yueh-Hung Liu a écrit :
> use check_dns
>
>
> On Sun, Apr 24, 2011 at 9:45 PM, Benjamin KRAFT <benj at dotnul.com> wrote:
>> Hello,
>>
>> I just wanted to pop-out if nobody already did that check_dig doesn't behave like it should on my centos machine.
>>
>> I was trying to validate the fact that my authoritative server at 80.92.90.249 resolves my website to the corresponding ip address, like this :
>>
>> [root at nagg ns1]# /usr/local/nagios/libexec/check_dig -H 80.92.90.249 -l www.dotnul.com -a 78.46.96.219 -A "+tcp"
>> DNS OK - 0.009 seconds response time (www.dotnul.com. 3600 IN A 78.46.96.219)|time=0.009035s;;;0.000000
>>
>> That's ok - but I noticed when I misspasted the expected return IP address, that the check returns OK if I put the address of the queried server as expected result.
>>
>> [root at nagg ns1]# /usr/local/nagios/libexec/check_dig -H 80.92.90.249 -l www.dotnul.com -a 80.92.90.249 -A "+tcp"
>> DNS OK - 0.006 seconds response time (;; SERVER: 80.92.90.249#53(80.92.90.249))|time=0.006368s;;;0.000000
>>
>> The return of the dig query is :
>>
>> [root at nagg ns1]# dig www.dotnul.com @80.92.90.249 +tcp
>>
>> ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 <<>> www.dotnul.com @80.92.90.249 +tcp
>> ;; global options: printcmd
>> ;; Got answer:
>> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1842
>> ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 0
>>
>> ;; QUESTION SECTION:
>> ;www.dotnul.com. IN A
>>
>> ;; ANSWER SECTION:
>> www.dotnul.com. 3600 IN A 78.46.96.219
>>
>> ;; AUTHORITY SECTION:
>> dotnul.com. 86400 IN NS ether.dotnul.org.
>> dotnul.com. 86400 IN NS hypnos.dotnul.org.
>> dotnul.com. 86400 IN NS tanathos.dotnul.org.
>>
>> ;; Query time: 1 msec
>> ;; SERVER: 80.92.90.249#53(80.92.90.249)
>> ;; WHEN: Sun Apr 24 13:44:12 2011
>> ;; MSG SIZE rcvd: 122
>>
>> By having an eye on nagios-plugins-1.4.15/plugins/check_dig.c, it looks like the following code is involved :
>>
>> for(i = 0; i < chld_out.lines; i++) {
>> /* the server is responding, we just got the host name... */
>> if (strstr (chld_out.line[i], ";; ANSWER SECTION:")) {
>>
>> /* loop through the whole 'ANSWER SECTION' */
>> for(; i < chld_out.lines; i++) {
>> /* get the host address */
>> if (verbose)
>> printf ("%s\n", chld_out.line[i]);
>>
>> if (strstr (chld_out.line[i], (expected_address == NULL ? query_address : expected_address)) != NULL) {
>> msg = chld_out.line[i];
>> result = STATE_OK;
>>
>> /* Translate output TAB -> SPACE */
>> t = msg;
>> while ((t = strchr(t, '\t')) != NULL) *t = ' ';
>> break;
>> }
>> }
>>
>> if (result == STATE_UNKNOWN) {
>> msg = (char *)_("Server not found in ANSWER SECTION");
>> result = STATE_WARNING;
>> }
>>
>> /* we found the answer section, so break out of the loop */
>> break;
>> }
>> }
>>
>> Shouldn't the command stop reading any following line beginning with ";; " after finding the ANSWER section instead of searching a match in everything until end of chld_out ?
>>
>> Kind regards,
>>
>> Benjamin
>>
>>
>> ------------------------------------------------------------------------------
>> Fulfilling the Lean Software Promise
>> Lean software platforms are now widely adopted and the benefits have been
>> demonstrated beyond question. Learn why your peers are replacing JEE
>> containers with lightweight application servers - and what you can gain
>> from the move. http://p.sf.net/sfu/vmware-sfemails
>> _______________________________________________
>> Nagios-users mailing list
>> Nagios-users at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/nagios-users
>> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
>> ::: Messages without supporting info will risk being sent to /dev/null
>>
>
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been
> demonstrated beyond question. Learn why your peers are replacing JEE
> containers with lightweight application servers - and what you can gain
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been
demonstrated beyond question. Learn why your peers are replacing JEE
containers with lightweight application servers - and what you can gain
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list