import com.hp.opr.api.scripting.Event;
import com.hp.opr.api.scripting.Priority;
import com.hp.opr.api.scripting.Severity;
import com.hp.opr.api.ws.model.event.ci.OprNode;
import com.hp.ucmdb.api.*
import com.hp.ucmdb.api.topology.*
import java.util.List;
class SimpleExample
{
def init()
{
// Nothing to initialize
}
def destroy()
{
// Nothing to destroy
}
def process(List<Event> events)
{
events.each {
event -> modifyEvent(event);
}
}
def modifyEvent(Event event)
{
String title = event.getTitle()
String sev = event.getSeverity()
event.setDescription(title+sev)
String command = "sh /opt/HP/BSM/bin/snmp_trap_test.sh"
def proc = command.execute()
StringBuffer sout = new StringBuffer(), serr = new StringBuffer()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(15000)
}
}
hello everyone, i am totally new to groovy scripting i need to execute a script on Linux using groovy,
i need to run a script located on linux. i found the above code and i tried to use it but it is not working
what is wrong with my code here.