Jeremy,
I changed my script using your advices. It looks like this now:
::# Define the temp variable 'hostname' @For /f "tokens=1" %%* in ( 'hostname' ) Do @Set "hostname=%%*"
::# Define the temp variables 'Inbound and Outbound' @for /f "tokens=2" %%* in ( 'netstat.exe -e ^| findstr /i "Bytes"' ) do @set "Inbound=%%*" @for /f "tokens=3" %%* in ( 'netstat.exe -e ^| findstr /i "Bytes"' ) do @set "Outbound=%%*"
::# Redirect output to a textfile @> "scripts\netstat" ( rem @echo green %Date% %time% @echo client %hostname%.win32 @echo [netstat] @echo %hostname% %Inbound% %Outbound% )
This .bat script is creating the output: (My servers name is ghostwus)
client ghostwus.win32 [netstat] ghostwus 65057048 3838258240
And indeed the message "reports netstat for an unknown OS" is gone and I got some client data:
[collector:netstat] status ghostwus.netstat client Tue Jun 25 23:17:17 CEST 2013 [netstat] ghostwus 65874964 3838527680
<font color=DarkSlateBlue >Xy-checkwin-2.0.1</font>
But still no graph... :-(
I changed the message output to
client ghostwus.win32 [ifstat] ghostwus 65057048 3838258240
without any success.
On Tue, Jun 25, 2013 at 5:07 AM, Jeremy Laidman <jlaidman at rebel-it.com.au>wrote:
On 25 June 2013 07:03, B-Art Gillis <bacaselo at gmail.com> wrote:
Thank you for your answer but I just saw on the graph that the values are converted to rrd data seem to come from the "do_netstat.c" module.
No, if you want interface statistics then you want ifstat parsed in do_ifstat.c. If you want protocol statistics (layer 3 and above such as TCP and UDP) then you would want a [netstat] section parsed in do_netstat.c. The message example you gave shows interface statistics.
Xymon expects the format to match ifstat_bbwin_exprs[] (defined in do_ifstat.c). This includes an IP address then the in and out byte count. The output of "netstat -e" does not provide an IP address, and it provides much more than just the bytes in and out. You'd have to select the Bytes line and prefix it with an IP address (probably a dummy device name would do also).
Something like:
EthDev 144681781 42531845
Any whitespace can be used as separators (one or more tabs or spaces).
You could probably get away with this:
echo [netstat] & netstat -e | find "Bytes"
This would give "Bytes" as a devicename, but I don't think it would break anything.
You need to prefix this message with the correct "client" message header. If you're sending other client data, this should be included with that message, otherwise one will mask the other.
The client message might look something like this:
client server1.win32 [netstat] Bytes 144681781 42531845
To get Xymon to match against the bbwin match string, you have to report your OS in the message as "bbwin" or "win32". This is probably why you're getting the "reports netstat for an unknown OS" message.
J