Graph plotting from perl script (noob)

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
ianwinter
Posts: 1
Joined: Mon Jul 07, 2008 11:25 am

Graph plotting from perl script (noob)

Post by ianwinter »

I have a perl script which grabs a URL and then returns 1 if the content is matched and 0 if not or it fails.

I've got it setup as a data input method and a data source, but, I can't work out quite what to put where when I'm creating the graph. It'll only ever return 1 or 0 but I want to plot that so I can see historically when it's up and down.

Please can you advise how I'd setup the graph in graph management.

This is the perl file (might not be grate as I'm no perl dev)...

Code: Select all

#!/usr/bin/perl

use strict;
use LWP::UserAgent;
my $content;

my $urlvar = $ARGV[0];

my $ua = new LWP::UserAgent;
$ua->timeout(3);
$ua->agent("WLD-Monitor/1.0");

my $req = new HTTP::Request GET => $urlvar;
my $res = $ua->request($req);

if ($res->is_success)
{
  $content= $res->content;
  if($content =~ m/verified/i) {
     print "1";
  } else {
     print "0";
  }
}
else
{
  die "0";
}
Data input method is Script/Command with "perl /path/to/file/monitor/cgi-bin/checkurl.pl <url>" as it's value. Input is url and output is status.

Thanks in advance,
Ian
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please see 1st link of my signature to learn how to setup everything
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests