Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module for network traffic
#1

Hello,
I would like to know if anyone knows how to monitor traffic network card ( download and upload ) on a Windows client computer.
I tried several options but without success.
Thank you very much.
 Reply
#2
Hi Abel,

Sure. If you take a look on nettraffic.vbs plugin you can modify the code to get detailed information per interface:

' nettraffic.vbs
' Pandora FMS Agent Plugin for Microsoft Windows (All platfforms)
' (c) 2014 Sancho Lerena <[email protected]>
' Returns total bytes in network since bootup and % of network use
' ----------------------------------------------------------------
' usage: cscript //B nettraffic.vbs

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\Root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("select * from Win32_PerfRawData_Tcpip_NetworkInterface ")

BytesSUM = 0

For Each objItem in colItems
bytesTotal = objitem.BytesTotalPersec * 8
BytesSUM = BytesSUM + bytesTotal

Next

Wscript.StdOut.WriteLine "<module>"
Wscript.StdOut.WriteLine "    <name><![CDATA[Network_Usage_Bytes]]></name>"
Wscript.StdOut.WriteLine "    <description><![CDATA[Total network usage in bytes]]></description>"
Wscript.StdOut.WriteLine "    <unit>bytes/sec</unit>"
Wscript.StdOut.WriteLine "    <type>generic_data_inc</type>"
Wscript.StdOut.WriteLine "    <data><![CDATA[" & BytesSUM & "]]></data>"
Wscript.StdOut.WriteLine "</module>"

Wscript.StdOut.flush
' End script

This code get all the traffic from all the interfaces and put all together. In a specific system you can get the information on WMI token "Win32_PerfRawData_Tcpip_NetworkInterface" it returns, totalbytes, send and received in three diferent variables:

uint32 BytesReceivedPerSec;
uint32 BytesSentPerSec;
uint64 BytesTotalPerSec;

This script could be modified to return two modules, one per input and other for output, and/or get only data from one interface.
 Reply
#3

I run the script that you uploaded in http://library.pandorafms.com/index.php?sec=Library&sec2=repository&lng=es&action=view_PUI&id_PUI=617 and no problems on the client computer .
When you insert the plug- in configuration file and restart the agent I do not see the module in pandora .
In the log file does not throw me any problem.
what am I doing wrong?.
this is the line in pandora.conf
[b]module_plugin cscript //B "%PROGRAMFILES%\Pandora_Agent
\util\nic_traffic.vbs"[/b]
Trank you very much.
 Reply
#4
This module returns a generic_data_inc value, this means you need at least two executions to show a value, because it shows the delta (the different between first execution and second), have you waited to see the second execution ?

If not, set the agent in debug mode, and put here the XML file to see what happen.

[quote='abel link' pid='9354' dateline='1467153087']
I run the script that you uploaded in http://library.pandorafms.com/index.php?sec=Library&sec2=repository&lng=es&action=view_PUI&id_PUI=617 and no problems on the client computer .
When you insert the plug- in configuration file and restart the agent I do not see the module in pandora .
In the log file does not throw me any problem.
what am I doing wrong?.
this is the line in pandora.conf
[b]module_plugin cscript //B "%PROGRAMFILES%\Pandora_Agent
\util\nic_traffic.vbs"[/b]
Trank you very much.
[/quote]
 Reply


Users browsing this thread: 1 Guest(s)


(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes