Join fellow LogicMonitor users at the Elevate Community Conference and get hands-on with our latest product innovations.

Register Now

Resources

Explore our blogs, guides, case studies, eBooks, and more actionable insights to enhance your IT monitoring and observability.

View Resources

About us

Get to know LogicMonitor and our team.

About us

Documentation

Read through our documentation, check out our latest release notes, or submit a ticket to our world-class customer service team.

View Resources

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 
]);

Start Your Trial

Full access to the LogicMonitor platform.
Comprehensive monitoring and alerting for unlimited devices.