16.01.2013 Views

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Ipswitch</strong> <strong>WhatsUp</strong> <strong>Gold</strong> <strong>User</strong> <strong>Guide</strong><br />

{<br />

Context.SetResult(1, "Failed to poll device using port " + nSNMPPort + ".<br />

Error=" + oResult.GetPayload);<br />

}<br />

else<br />

{<br />

nSNMPPort );<br />

}<br />

}<br />

Context.SetResult(0, "SUCCESS. Detected an SNMP agent running on port " +<br />

Monitor for unknown MAC addresses<br />

Note: This example is provided as an illustration only and is not supported. Technical support<br />

is available for the Context object, SNMP API, and scripting environment, but <strong>Ipswitch</strong> does<br />

not provide support for JScript, VBScript, or developing and debugging Active Script<br />

monitors or actions. For assistance with this example or with writing your own scripts, visit<br />

the <strong>WhatsUp</strong> <strong>Gold</strong> user community (http://www.whatsupgold.com/wugspace).<br />

This active monitor watches MAC addresses present on a network by polling an SNMPmanaged<br />

switch and the bridge MIB. In the example script, you define a list of MAC addresses<br />

you will allow to connect to the network. This monitor will fail if it finds devices that do not<br />

match the addresses specified in the list.<br />

// Modify the list below. It defines a list of allowed mac addresses with mapping to<br />

switch interface<br />

// on the network.<br />

// This script will poll a managed switch using SNMP and the bridge MIB to detect MAC<br />

addresses present<br />

// on your network that should not be and to detect misplaced machines (connected to the<br />

wrong port).<br />

//<br />

// The MAC addresses should be typed lowercase with no padding using ':' between each<br />

bytes<br />

// for instance "0:1:32:4c:ef:9" and not "00:01:32:4C:EF:09"<br />

//<br />

var arrAllowedMacToPortMapping = new ActiveXObject("Scripting.Dictionary");<br />

arrAllowedMacToPortMapping.add("0:3:ff:3b:df:1f", 17);<br />

arrAllowedMacToPortMapping.add("0:3:ff:72:5c:bf", 77);<br />

arrAllowedMacToPortMapping.add("0:3:ff:e2:e5:76", 73);<br />

arrAllowedMacToPortMapping.add("0:11:24:8e:e0:a5", 63);<br />

arrAllowedMacToPortMapping.add("0:1c:23:ae:b0:4c", 48);<br />

arrAllowedMacToPortMapping.add("0:1d:60:96:e5:58", 73);<br />

arrAllowedMacToPortMapping.add("0:e0:db:8:aa:a3", 73);<br />

var ERR_NOERROR = 0;<br />

var ERR_NOTALLOWED = 1;<br />

var ERR_MISPLACED = 2;<br />

function CheckMacAddress(sMacAddress, nPort)<br />

{<br />

924

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!