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
System.getModule("com.vmware.library.snmp").logResult(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 = ="1.3.6.1.4.1.6876.4.3.307.0"){
System.log("Launching workflow to add vCPU...");
var params = new Properties();
params.put("vmName", value);
Server.getWorkflowWithID("f3c718f6-61a6-47d7-ad2b-2957ed02cf6e").execute(params);
break;
}
else {
System.log("VM name not found!!!");
}
}