Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

Json Simple and perl

$
0
0

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;


Viewing all articles
Browse latest Browse all 12281

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>