I am trying to create an application monitor using perl and json. We have the script built out and created a new APM template with a Windows Script monitor component. The problem is, when we run this against a node we get the following error:
Testing on node '10.6.242.73' failed with 'Unknown' status ('Unknown' might be different if script exits with a different exit code).
Here is the script. Any help is appreciated.
#!c:\perl\bin\perl
#
use JSON;
use Data::Dumper;
$ip = '10.88.14.81';
$port = 80;
$inst = "AMQ2";
$ARG = $WScript->{Arguments};
if($ARG) {
$ip = $ARG->item(0);
$port = $ARG->item(1);
$inst = $ARG->item(2);
}
$url = "http://qamc.lab.securustech.net/mancenter/rest/clusters/qa_loadtest/queues/cdrRecords";
#print "$url\n";
$content = `wget $url --output-document=- --output-file=-`;
unless($content) {
print "Message: Could not reach the MC status page\n";
print "Statistic: 0\n";
if ($ARG) {$WScript->Quit(1)};
exit;
}
#print $content;
$x = decode_json($content);
#foreach $k1 (keys %$x) {
# $v1 = $$x{$k1};
# print "$k1 => $v1\n";
#}
$own = $$x{ownedItemCount};
$npolls = $$x{numberOfPolls};
$epolls = $$x{numberOfEmptyPolls};
print "Message.ownedItemCount: $own Owned Items\n";
print "Statistic.ownedItemCount: $own\n";
print "Message.numberOfPolls: $npolls Polls\n";
print "Statistic.numberOfPolls: $npolls\n";
print "Message.numberOfEmptyPolls: $epolls Empty Polls\n";
print "Statistic.numberOfEmptyPolls: $epolls\n";
if ($ARG) {$WScript->Quit(0)};
exit;