SCOM 2016 – What’s New UNIX/Linux Series: Agent Task Running Script e.g. Perl

I assume you are familiar with creating SCOM tasks and you know there are tasks that are executed on the SCOM console side (console task) and such that are executed on the agent (agent task). In the past you had only few options, like running commands on Windows and UNIX/Linux or scripts only on Windows agents. The task options looked like this in SCOM 2012 R2…

image

In SCOM2016 you are now able to run scripts on UNIX/Linux agent using all kind of script languages (any), that are installed on the target machine.

image

To prove that it works I created a simple task called Perl Ping

image

…and added a Perl script that pings few times a host called DC01.masta.ad

image

The full script looks like this…

#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
use Net::Ping;
for (my $i=0;$i<=10;$i++)
{
    my $p=Net::Ping->new();
    my ($ret,$duration,$ip)=$p->ping(‘DC01.masta.ad’);
    say (‘Duration: ‘ . $duration . ‘ IP: ‘ . $ip);
}

After I ran the task it shows a successful output and the ping results…

image

As you can see it is a very useful improvement Microsoft did and I am sure this will help migrating other monitoring tools to SCOM :).  Awesome!

1 Comment

  1. Pingback: Whats New In SCOM 2016 | Tech Guide

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s