Adding Custom Libraries to Collector

Last updated on 08 October, 2024

You can add both groovy and non-groovy custom libraries to collector. 

Adding Non-groovy Custom Libraries

To add JAR files on your collector to support additional functionality in your Groovy script-based LogicModule, follow these steps:

  1. Copy the jar file to the library folder in the Collector installation (you may have to create the folder):
    • Default library path on Windows – C:\Program Files\LogicMonitor\agent\custom
    • Default path on Linux – /usr/local/logicmonitor/agent/custom

    Previously, we directed users to put custom JARs in the lib directory with the included JARs. While this still works, we recommend putting your custom jars in the separate custom folder.

  2. Now edit wrapper.conf so the Collector will load the jar. You can edit the configuration file directly on the machine, or from within your LogicMonitor portal in a browser. For more information on editing the Collector config file, see Editing the Collector Config Files.
  3. In the wrapper.conf file, you’ll see lines like this:
    wrapper.java.classpath.85=../lib/jackson-core-2.6.6.jar
    wrapper.java.classpath.86=../lib/amazonlibs/*.jar
    
  4. Being sure to increment the number, add a line for your jar:
    wrapper.java.classpath.85=../lib/jackson-core-2.6.6.jar
    wrapper.java.classpath.86=../lib/amazonlibs/*.jar
    wrapper.java.classpath.87=../custom/customlib-0.0.1.jar
    
  5. Save the config and restart the Collector.

Adding Groovy Core Custom Libraries

Starting with GD Collector 35.001, you can add the following groovy core custom libraries to collector.

  1. Copy the Groovy custom JAR file to the custom folder in the Collector installation path (If the custom folder does not exist, you may have to create the folder)
    • Default path for Windows – C:\Program Files\LogicMonitor\agent\custom
    • Default path for Linux – /usr/local/logicmonitor/agent/custom
  2. Add the configuration to the wrapper.conf settings.
    • If your custom groovy JAR file supports both the v2 and v4 versions, then you can use the common configuration to load the JAR file in both the versions.
      Example – Common configuration
      groovy.jar.common.1 = custom/common-groovy.jar
    • If your custom Groovy JAR file supports either v2 or v4 version, then you can use the version-specific configuration to load the JAR file in respective groovy version.
      This JAR file is loaded in Groovy v2 script. For example,
      groovy.jar.v2.1 = custom/example-2-1.jar
      This JAR file is loaded in Groovy v4 script. For example,
      groovy.jar.v4.1 = custom/example-4-1.jar
    • To support multiple JAR files, increment the last digit of the configuration. For example,
      groovy.jar.v4.1 = custom/example-4-1.jar
      and
      groovy.jar.v4.2 = custom/example-4-2.jar
      Both the JAR files are loaded in Groovy v4.
      Note: Ensure that the Groovy JAR files added above are not present in the wrapper.java.classpath. If the JAR files are present in wrapper.java.classpath then remove them and place as per the configuration explained in step #2.
  3. Save the configuration and restart the collector.

AWS SDK JARs Shipped with Collector Installer

Along with other installation files, collector installer also carries multiple AWS SDK JAR files which are used in the core and custom modules (DataSources). To ensure that the size of collector installer remains light, starting with Collector EA version 34.100, we ship only the following AWS SDK JAR files which are used by collector and core modules.

  • aws-java-sdk-core
  • aws-java-sdk-autoscaling
  • aws-java-sdk-ec2
  • aws-java-sdk-s3
  • aws-java-sdk-cloudformation
  • aws-java-sdk-cloudwatch
  • aws-java-sdk-dynamodb
  • aws-java-sdk-sqs

After upgrading to EA 34.100, if you try to use an AWS SDK JAR (which is not shipped with collector installer) in a groovy script of the custom datasource (existing or new), then data will not be collected for that datasource. You will see errors such as “unable to resolve class <classname>“. In such cases or if your business needs additional AWS SDK JAR, you can add them as custom JAR.

In This Article