Skip to content

Instantly share code, notes, and snippets.

@abarnas
abarnas / VBScriptInclude.vbs
Created October 11, 2011 17:35
Using VBScript Include Files
Sub Include(strFilename)
On Error Resume Next
Dim oFSO, f, s
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(strFilename) Then
Set f = oFSO.OpenTextFile(strFilename)
s = f.ReadAll
f.Close
ExecuteGlobal s
@abarnas
abarnas / MonitisTopClasses.vbs
Created October 12, 2011 18:00
Monitis Top Class Definitions
Class class_Metric
Public Name
Public Metric
Public Result
Public Suffix
Public Width
Private Sub Class_Initialize
Name = ""
Metric = ""
@abarnas
abarnas / getInternalAgents.vbs
Created October 12, 2011 21:05
Monitis Top GetInternalAgents
Function GetInternalAgents(aObjHttp, aObjAgents, aShowMonitors, aShowProcesses)
Dim objAgents, xmlAgents
Set objAgents = CreateObject("Scripting.Dictionary")
'Retrieve the list of agents
url = "http://www.monitis.com/api?action=agents&apikey=" + apiKey + "&output=xml"
aObjHttp.open "GET", url, False
aObjHttp.send
'Parse response
@abarnas
abarnas / getGlobalMonitors.vbs
Created October 12, 2011 21:10
Monitis Top Get Global Monitors
Function GetGlobalMonitors(aObjHttp, oNames, aObjAgent, aShowMonitors)
Dim oName
For Each oName in oNames
If oName.NodeName <> "#text" And oName.NodeName <> "process" And _
SupportedMonitors.Exists(LCase(oName.NodeName)) And _
aShowMonitors.Exists(LCase(oName.NodeName)) Then
' Create new monitor object
@abarnas
abarnas / getProcessMonitor.vbs
Created October 12, 2011 21:12
Monitis Top GetProcessMonitor
Function GetProcessMonitors(aObjHttp, oNames, aObjAgent, aShowProcesses)
url = "http://www.monitis.com/api?version=2&apikey=" & apikey & "&output=xml&action=topProcessByCPUUsage&limit=50&detailedResults=true"
aObjHttp.open "GET", url, False
aObjHttp.send
Set oRes = CreateObject("Microsoft.XMLDOM")
oRes.async = False
oRes.LoadXML(aObjHttp.responseText)
@abarnas
abarnas / ShowInternalAgentsMonitors.vbs
Created October 12, 2011 21:13
Monitis Top Show agent monitors
Sub ShowInternalAgentsMonitors
'Write the list of agents to the screen
For Each agent In InternalAgents.Items
WScript.Echo ""
WScript.Echo "-------------------------------------------------------------------------------"
WScript.Echo " AGENT: " & agent.Name
WScript.Echo "-------------------------------------------------------------------------------"
strHeader = ""
strRow = ""
@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..."
@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 / 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 / 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;