Forum Discussion
Christian_Laute
May 02, 2017Nimbostratus
Using variables in external Perl monitor
Gents,
I currently use a external monitor to check the JSON output of some webservices. Now I try to make it a little bit more flexible.
For example I want to try to replace the string "UP" at if(...
May 02, 2017
Try:
!/usr/bin/env perl
use LWP::Simple;
use JSON;
$URI = $ARGV[2];
$HOSTNAME = $ARGV[0];
$HOSTNAME =~ s/::ffff://;
$PORT=$ARGV[1];
$contents = get("http://$HOSTNAME:$PORT$URI");
$json = decode_json($contents);
$status = $json->{'status'};
$statusmsg = $ENV{'statusmsg'};
if($status eq $statusmsg) {
print $status;
}
Also take a look at this:
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects