DNS Scripting Methods

Last updated on 13 June, 2022

The Collector includes dnsjava (dnsjava.org) to allow scripting of DNS based objects.

To determine which version of dnsjava is installed in your environment, navigate to the Collector installation folder and verify the version installed:

  • Default library path on Windows – C:\Program Files\LogicMonitor\agent\lib
  • Default path on Linux – /usr/local/logicmonitor/agent/lib

See https://github.com/dnsjava/dnsjava for documentation on the version of dnsjava installed in your environment.

As a simple example, a datasource could use a script such as the below to ensure that the local DNS resolvers are working:

import org.xbill.DNS.*;

records = new Lookup("gmail.com", Type.MX).run()

records.each() {
println it

return (0);