LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.

Learn More

Can LogicMonitor monitor custom data for my job?

Last updated on 18 September, 2024

Yes, you can have your monitored batch jobs report other custom data to LogicMonitor, for informational purposes.  This data will be displayed in LogicMonitor, but it won’t be used for alerting or graphing purposes.  The custom data reported to LogicMonitor can be any desired information, for example it could be static content such as “reportSentTo: myboss”, or information output by the batch job run on your system.

To enable custom data collection, you’ll need to modify the batch job wrapper, either lmbatchjobwrapper.js for Windows or lmbatchjobwrapper.sh for Linux, to report userData in the #start the customer job section of the script.  Specifically, there are three edits necessary:

  1. Add a line ‘my $userData = “You custom data goes here”;’ after the ‘my $level….’ line
  2. Add a comma after ‘alertLevel => $level’
  3. Add a new line after the line edited in 2 ‘userData => $userData

The end result should look like this:

my $level = $exitCode eq 0 ? 'ok' : 'error';
my $userData = "fileDeleted: 55, reportSentTo: myboss";

$response = $ua->post( $url, [
    type => 'finish',
    executionNo => $executionNo,
    hostName => $hostname,
    batchjobName => $jobname,
    epoch => time(),
    stdout => $stdout,
    stderr => $stderr,
    exitCode => $exitCode,
    alertLevel => $level,
    userData => $userData 
]);