SNMP scripting help

I am trying to script it so that when vCenter sends an SNMP trap that Orchestrator will pull the VM Name and send it to a workflow. I've been trying to make this using examples online, but it seems I have messed something up and I"m not sure where. The error I get is syntax error (no infos#17). Please help.

System.log("SNMP Trap Received");

System.log("Agent: " + event.getValue("agent"));

var key = event.getValue("key");

var snmpResult = SnmpService.retrievePolicyData(key);

// Get data as Array of Properties

var data = System.getModule("com.vmware.library.snmp").processSnmpResult(snmpResult);

System.log("Enterprise: " + snmpResult.enterprise);

// Log data


//Custom to call Workflow to add vCPU

for (var i=0; i< data.length; i++) {

  var elem = data[i];

  var oid = elem.get("oid");

  var value = elem.get("value");

  if(oid = =""){

  System.log("Launching workflow to add vCPU...");

  var params = new Properties();

  params.put("vmName", value);




  else {

  System.log("VM name not found!!!");



Tags (1)
0 Kudos
1 Reply
VMware Employee
VMware Employee

There is a syntax error on the following line

if(oid = =""){

There is a space character between the two equal signs, which makes it invalid Javascript code. It should be:

if(oid == ""){

0 Kudos