This test runs fine:
Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $response = $ua->get("somewebsite.com");
if ($response->is_success) {
print $response->status_line;
exit(0);
} else {
print $response->status_line;
exit(2);
}
Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use LWP::UserAgent;
use Nagios::Plugin::WWW::Mechanize; # new line
my $mech = Nagios::Plugin::WWW::Mechanize->new(); # new line
$mech->get("somewebsite.com"); # new line
my $ua = LWP::UserAgent->new();
my $response = $ua->get("somewebsite.com");
if ($response->is_success) {
print $response->status_line;
exit(0);
} else {
print $response->status_line;
exit(2);
}
Do I need to add the Mechanize plugin to my plugins folder on the server? I thought they worked like Ruby gems in that you can just require them and they work.
Any help would be great, thanks!