External Scripting in LogicMonitor
Last updated - 01 June, 2026
In addition to embedded scripting with Groovy and PowerShell, LogicMonitor provides support for external scripts using any scripting language. You can also use external scripting to execute any program on the Collector directly and use its output to collect data.
Recommendations:
- Use Groovy for most tasks that require scripting. For more information, see Embedded Groovy Scripting.
- Always account for version and extension dependencies when using external scripts.
Requirements for Configuring External Scripting
To configure an external script, you must have the following:
- A user role with access to Modules.
For more information, see LogicMonitor Roles - A new or existing resource or resources to which the script applies.
- A script file in your preferred language.
For example, the following is a sample Perl script namedtomcat_log_size.plwritten to take a single argument that contains the Tomcat root directory.
#!/usr/bin/perl
use warnings;
use strict;
# ingest the single argument into a single variable
my ($tomcatRoot) = @ARGV;
# run the "stat" function on the filename and collect the output as an array
my @result = stat("$tomcatRoot/logs/catalina.out");
# exit with a non-zero code if we didn't get a valid result from stat
if (!@result) {
exit 1;
}
# the 7th element in the array is size in bytes; print this out
print $result[7];
# exit to indicate we got a valid result
exit 0;To test the script, run the following on the command line:$ ./tomcat_log_size.pl /usr/local/tomcat 3710925
Note: The value stored in the tomcat.root property is the directory where Tomcat is installed on that system. The script can only monitor Tomcat installations running on the same host as the Collector since the script does not accommodate any remote connectivity. You can modify the script to enable remote monitoring if required.
Configuring External Scripting for a DataSource
- In LogicMonitor, navigate to Modules.
- Choose an existing DataSource or create a new one. For more information, see Creating a DataSource.
For example, create a resource property namedtomcat.rooton each resource where you want to monitor the Tomcat log file.
For more information, see Resource and Instance Properties. - In the Summary section, select “SCRIPT” from the Collection Method dropdown menu.

- In the Collection section, select “Upload script File” from the Script Type dropdown menu.
- Select Upload Script and upload your custom script file.
External scripts are installed onto the agent, local, or bin subdirectory within the LogicMonitor Collector. If you have multiple scripts (for example, one Linux and one Windows), upload both, one after the other.
Recommendation:LogicMonitor strongly recommends auto-deploying using the DataSource definition for the following reasons:
- Consistency between script and DataSource definition—If an external script is inadvertently modified on the Collector, it will forcibly resynchronize with the version maintained upstream.
- Easy script updating—If an external script needs updating, the new version from the DataSource definition is automatically distributed to your Collectors as needed.
- Automatic distribution to all relevant Collectors—LogicMonitor distributes scripts to all necessary Collectors. For example, if a Collector is down and a resource fails over to a backup Collector, data collection continues without interruption.
- In the Windows script name/path and/or Linux/Unix script name/path fields, provide the name of the uploaded script.
For example, the sampletomcat_log_size.plscript would use the following details:- In the Linux/Unix script name/path field, enter “tomcat_log_size.pl” as the file name.
Note: To deliver a script to a target Collector, the Script Name of any script in these fields must match the name of the script uploaded using the Upload Script button. However, a Script Path does not reference named/uploaded scripts, and can refer to any local Collector path. Script Paths must be manually copied to each Collector.
- In the Windows arguments and/or Linux/Unix arguments fields, enter any arguments to pass to your script.
When passing multiple parameters, provide each argument individually and separate by whitespace. Do not use double quotes to enclose your argument string.
For example, the sampletomcat_log_size.plscript would use ##tomcat.root## in the Linux/Unix arguments field.
Note:When passing arguments to a Windows script, LogicMonitor recommends providing the script interpreter in the Windows Script field and the full path along with any arguments in the Script Parameters field.
For example, with a Python script, enter c:\python27\python.exe as the script name and c:\program files (x86)\logicmonitor\agent\lib\monitor_script.py ##system.hostname## as the script parameters.
In this case, you must use double quotes to encompass the script filename and associated arguments.
- (Optional) Select Test Script to confirm the script and any applied arguments function properly.
- (Optional) Add or edit normal and complex datapoints to capture values from the monitored resource. For more information, see Normal Datapoints and Complex Datapoints.
For example, to create a normal datapoint for the sample tomcat_log_size.pl script, do the following:- In Normal Datapoints, select Add a Normal Datapoint.
- In the Interpret output with dropdown menu, select “no interpretation; use directly.” as the script is returning only a single value.
Note: If a script output has multiple values, they can be extracted as key-value pairs or with a regular expression.
- Select Add Static Threshold. Configure the following fields to alert when the datapoint exceeds 1 GB.
- In Time Range, set a time range to monitor each day.
- In the When field, select Value.
- Select “(>) Greater than.” in the Is field. Choose an alert severity, and enter “1” in the corresponding field.
- Select Apply.
- Select Save.
Your DataSource will appear in the Modules list.
Configuring External Scripting for a ConfigSource
- In LogicMonitor, navigate to Modules.
- Choose an existing ConfigSource or create a new one.
For more information, see Creating ConfigSources. - In the Summary section, select “SCRIPT” from the Collection Method dropdown menu.

- In the Collection section, select “Upload script File” from the Script Type dropdown menu.
- Select Upload Script and upload your custom script file.
External scripts are installed onto the agent/local/bin/ subdirectory within the LogicMonitor Collector. If you have multiple scripts (for example, one Linux and one Windows), upload both, one after the other.
Recommendation: LogicMonitor strongly recommends auto-deploying using the DataSource definition for the following reasons:
- Consistency between script and ConfigSource definition—If an external script is inadvertently modified on the Collector, it will forcibly resynchronize with the version maintained upstream.
- Easy script updating—If an external script needs updating, the new version from the DataSource definition is automatically distributed to your Collectors as needed.
- Automatic distribution to all relevant Collectors—LogicMonitor distributes scripts to all necessary Collectors. For example, if a Collector is down and a resource fails over to a backup Collector, data collection continues without interruption.
- In the Windows script name/path and/or Linux/Unix script name/path fields, provide the name of the uploaded script.
Note: To deliver a script to a target Collector, the Script Name of any script in these fields must match the name of the script uploaded using the Upload Script button. However, a Script Path does not reference named/uploaded scripts, and can refer to any local Collector path. Script Paths must be manually copied to each Collector.
- In the Windows arguments and/or Linux/Unix arguments fields, enter any arguments to pass to your script.
When passing multiple parameters, provide each argument individually and separate by whitespace. Do not use double quotes to enclose your argument string.
Recommendation: When passing arguments to a Windows script, LogicMonitor recommends providing the script interpreter in the Windows Script field and the full path along with any arguments in the Script Parameters field.
For example, with a Python script, enter c:\python27\python.exe as the script name and c:\program files (x86)\logicmonitor\agent\lib\monitor_script.py ##system.hostname## as the script parameters.
In this case, you must use double quotes to encompass the script filename and associated arguments.
- (Optional) Select Test Script to confirm the script and any applied arguments function properly.
- (Optional) Add or edit config checks as needed. For more information, see Config Checks.
- Select Save.
Your ConfigSource will appear in the Modules list.