[Nagiosplug-devel] [ nagiosplug-Bugs-1296296 ] check_nwstat does not return correct values since 1.4

SourceForge.net noreply at sourceforge.net
Wed Sep 21 04:26:01 CEST 2005


Bugs item #1296296, was opened at 2005-09-20 12:21
Message generated for change (Comment added) made by sullivand
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1296296&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: General plugin execution
Group: Release (specify)
Status: Open
Resolution: None
Priority: 7
Submitted By: David Sullivan (sullivand)
Assigned to: Ton Voon (tonvoon)
Summary: check_nwstat does not return correct values since 1.4

Initial Comment:
check_nwstat seems to be majorly broken since 1.4
returning only the default initialised value of the
variable requested instead of the actual value. The
plugin with version 1.3.1 works correctly.
I've tried the most recent version (1.4.2) and it still
exhibits the same behaviour:

support:~#
/usr/local/src/nagios-plugins-1.4.2/plugins/check_nwstat
-p 9999 -o -H server -v "ABENDS" -c 1 -o
NetWare 5.60.5: 0 abended threads
support:~#
/usr/local/src/nagios-plugins-1.3.1/plugins/check_nwstat
-p 9999 -o -H server -v "ABENDS" -c 1 -o
NetWare 5.60.5: 1 abended threads


support:~#
/usr/local/src/nagios-plugins-1.4.2/plugins/check_nwstat
-p 9999 -o -H server -v "LOAD5" -w 70 -c 90
NetWare 5.60.5: Load OK - Up , 5-min load average = 0%
support:~#
/usr/local/src/nagios-plugins-1.3.1/plugins/check_nwstat
-p 9999 -o -H server -v "LOAD5" -w 70 -c 90
NetWare 5.60.5: Load problem - Up 48 days 1 hours 49
minutes, 5-min load average = 74%


A packet trace is attached showing that the plugin
connects to the service and requests the Netware
Version, then when it re-uses the same socket for the
variable requested it sends the request but immediately
closes the connection without waiting for a response
from mrtgext.

I might be able to set up an accessable netware server
to test this plugin if this is necessary but that would
take a day or two to setup.

----------------------------------------------------------------------

>Comment By: David Sullivan (sullivand)
Date: 2005-09-21 12:23

Message:
Logged In: YES 
user_id=1348152

I've added code closing the socket before each use which has 
done the trick. I've tested that it works for the variables 
ABENDS, LOAD5, CBUFF and VPF and they all produce 
correct output.

The diff is attached to this bug

David

----------------------------------------------------------------------

Comment By: Ton Voon (tonvoon)
Date: 2005-09-21 11:29

Message:
Logged In: YES 
user_id=664364

David,

It looks like check_nwstat.c was changed from 1.13 to 1.14 to reuse the 
connection (see http://cvs.sourceforge.net/viewcvs.py/nagiosplug/
nagiosplug/plugins/check_nwstat.c?rev=1.30&view=log and the diff 
between 1.14 and 1.13).

Unfortunately, there's not much information on why it was changed.

Gerd Mueller supplied a patch (1235879) that includes lots of close(sd) 
and my_tcp_connect, so it sounds like that could be right line to go 
down.

As I'm working in the dark on this, I would prefer to receive a diff -u 
patch that you have verified will work so I can apply to CVS. I'm happy 
to discuss how to do this offline with you.

Ton

----------------------------------------------------------------------

Comment By: David Sullivan (sullivand)
Date: 2005-09-20 14:24

Message:
Logged In: YES 
user_id=1348152

Ah, a bit more digging on my part through the mrtgext code
indicates that the assumption that the connection can be
re-used ( as 1.4 was modified to do ) is just wrong. From
the comments in the sourcecode for mrtgext.c
(http://shrunk.net/7a5dea59-forge.novell.com) :

// read in the tcp stream until we get a \n, a line length of
// 1024 or a TCP Timeout.

After mrtgext sees the first command and \n it will do no more.

Adding:

close(sd); 
my_tcp_connect (server_address, server_port, &sd);

liberally all over the code confirms this and essentially
takes it back to how it behaved in 1.3, this seems like an
easy fix though I only know a little C I can create a patch
if you want.


----------------------------------------------------------------------

Comment By: Ton Voon (tonvoon)
Date: 2005-09-20 12:31

Message:
Logged In: YES 
user_id=664364

David,

Thanks for your report. Unfortunately, I don't think anyone on the team 
has access to a Netware server. If you create a patch, I'll visually 
inspect it and will apply to the latest plugins.

It would be great if you could create a test case as well for it (see the 
other test cases in plugins/t).

Ton

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1296296&group_id=29880




More information about the Devel mailing list