Run/control External Processes
Last updated on 01 November, 2020The most robust way to call external processes is to use the Groovy method waitForProcessOutput.
For example:
This site uses cookies from Google to deliver its services and to analyze traffic.
This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities...
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously. These include the Qualified chatbot, the Marketo cookie for loading and submitting forms on the website, and page variation testing software tool.
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 ...}