Forum Discussion

joecooper's avatar
2 years ago

Groovy Debug

Trying to get started on a custom script and having an issue with the groovy debug helper.  Using the chrome extension "logicMonitor script editor" and launching from collector using !groovy.

Just trying to run the following results in null for hostName.  I see there is a drop-down menu for the script editor, and there is a box to enter hostname.  Is this supposed to set the context for the groovy script editor?  I've tried putting in the hostname for a device in our environment but it's still reporting as null.    Based on this article hostprops.get should work in debug window since version 28.300+ and we are on 30.002.

import com.santaba.agent.groovyapi.expect.Expect;
import com.santaba.agent.groovyapi.snmp.Snmp;
import com.santaba.agent.groovyapi.http.*;
import com.santaba.agent.groovyapi.jmx.*;
import org.xbill.DNS.*;

def hostName = hostProps.get("system.hostname");
println hostName

 

OUTPUT

---GROOVY---

returns null
output:
null

1 Reply

  • @joecooper  you need to enter the value for "system.hostname" exactly as-is into that hostname box.

    If you disable the extension, the built-in !groovy now actually lets you search for a device name so you don't have to risk typing it wrong.

    Also make sure you're doing debug from the collector that is monitoring that host.