Skip to content

Instantly share code, notes, and snippets.

Function GetNetworkData
'Clear total counters
TotalBytesReceivedPerSec = 0
TotalBytesSentPerSec = 0
TotalBytesTotalPerSec = 0
TotalPacketsReceivedPerSec = 0
TotalPacketsSentPerSec = 0
TotalPacketsReceivedDiscarded = 0
TotalPacketsReceivedError = 0
TotalPacketsSentDiscarded = 0
Set colConfs = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objConf in colConfs
strAdapterName = GetAdapterName(objConf.Caption)
strIPAddress = GetMultiString_FromArray(objConf.IPAddress, ", ")
Set colNetAdapters = objWMI.ExecQuery("Select * From Win32_NetworkAdapter WHERE Caption = '" & objConf.Caption & "'")
For Each objAdapter In colNetAdapters
WScript.Echo "Adding monitor for network connection: " & objAdapter.NetConnectionID
'Total Bytes Troughput
Row = 1 : Column = 1
MonitorName = "Total+Bytes+Throughput"
monitorParams = "Total+Bytes+Throughput:Bandwidth:Bandwidth:3:false;"
resultParams = "TotalBytesReceivedPerSec:Received/Sec:N%2FA:2;TotalBytesSentPerSec:Sent/Sec:N%2FA:2;TotalBytesTotalPerSec:Total/Sec:N%2FA:2;"
AddCustMon
'Total Packets/Sec
Row = 1 : Column = 2
MonitorName = "Total+Packets"
@abarnas
abarnas / gist:1320863
Created October 27, 2011 21:01
MonitorDefinition
namespace MonitisTop
{
public class MonitorDefinition
{
private string metric;
private List<string> names;
private List<string> suffixes;
public string Metric { get { return metric; } set { metric = value; } }
public List<string> Names { get { return names; } set { names = value; } }
@abarnas
abarnas / gist:1320858
Created October 27, 2011 21:00
Metric
namespace MonitisTop
{
public class Metric
{
protected Monitor monitor;
private string name;
private string result;
private string suffix;
private int width;
@abarnas
abarnas / gist:1320852
Created October 27, 2011 20:59
GetGlobalMonitor
namespace MonitisTop
{
/// <summary>
/// Global monitor class
/// </summary>
public class GlobalMonitor : Monitor
{
public GlobalMonitor(Agent _agent)
: base(_agent)
{
@abarnas
abarnas / gist:1320844
Created October 27, 2011 20:57
Monitor
namespace MonitisTop
{
/// <summary>
/// Base monitor class
/// </summary>
public class Monitor
{
protected Agent agent;
protected string id;
@abarnas
abarnas / gist:1320841
Created October 27, 2011 20:56
Agent.cs
namespace MonitisTop
{
public class Agent
{
private string id;
private string name;
private int maxMonitorWidth;
private List<Monitor> monitors;
public string Id { get { return id; } set { id = value;} }
@abarnas
abarnas / getFullpageMonitors.vbs
Created October 20, 2011 12:54
getFullpageMonitors
Function GetFullpageMonitors(aObjHttp, aObjAgent, aShowMonitors)
Dim objAgents, xmlAgents
Set objAgents = CreateObject("Scripting.Dictionary")
'Create the dummy Agent object
Set Agent = New class_InternalAgent
Agent.Id = ""
Agent.Name = "FULLPAGE"
url = "http://www.monitis.com/api?version=2&apikey=" & apikey & "&output=xml&action=topFullpage&limit=50&detailedResults=true"
@abarnas
abarnas / funcExternalMonitors.vbs
Created October 14, 2011 21:22
Get External Monitors
Function GetExternalMonitors(aObjHttp, aObjAgents, aShowMonitors)
Dim objAgents, xmlAgents
Set objAgents = CreateObject("Scripting.Dictionary")
'Create the dummy Agent object
Set Agent = New class_InternalAgent
Agent.Id = ""
Agent.Name = "EXTERNAL"
WScript.Echo "Acquiring external monitors..."