Run/control External Processes
Last updated on 18 September, 2024The most robust way to call external processes is to use the Groovy method waitForProcessOutput.
For example:
LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.
Learn MoreGet real-time insights and automation for comprehensive, seamless monitoring with agentless architecture.
Whether you work in MSP, Enterprise IT or somewhere in between, the solution is clear.
Get to know LogicMonitor and our team.
Explore our blogs, guides, case studies, eBooks, and more actionable insights to enhance your IT monitoring and observability.
Read through our documentation, check out our latest release notes, or submit a ticket to our world-class customer service team.
Get real-time insights and automation for comprehensive, seamless monitoring with agentless architecture.
Whether you work in MSP, Enterprise IT or somewhere in between, the solution is clear.
Explore our blogs, guides, case studies, eBooks, and more actionable insights to enhance your IT monitoring and observability.
Get to know LogicMonitor and our team.
Read through our documentation, check out our latest release notes, or submit a ticket to our world-class customer service team.
Come join our live training webinar every other Wednesday at 11am PST and hear LogicMonitor experts explain best practices and answer common questions. We understand these are uncertain times, and we are here to help!
Sign up hereThe most robust way to call external processes is to use the Groovy method waitForProcessOutput.
For example:
command="../bin/ipmiutil sensor -c -N " + hostname + " -U "+User+" -P " +Pass def sout = new StringBuffer() def serr = new StringBuffer() def proc = command.execute() proc.waitForProcessOutput(sout, serr) if(proc.exitValue() == 0) { output=sout.toString() output.eachLine { if (it =~ / Full /) { elements=it.split(/ *\| */) if ( elements[5]=="OK" ) { //only discover those reporting a status println elements[0]+"##"+elements[4]+":"+elements[3] } } } else { // error handling ...}