Nagios::Plugin::OverHTTP gets timeout

In versions of Nagios::Plugin::OverHTTP previous to 0.06 the only way to set a timeout on the plugin was to initiate your own LWP::UserAgent and set the timeout on it and pass that to Nagios::Plugin::OverHTTP like:

use LWP::UserAgent;
use Nagios::Plugin::OverHTTP;
my $ua = LWP::UserAgent->new(timeout => 20);
my $plugin = Nagios::Plugin::OverHTTP->new(useragent => $ua);

So now you can skip the entire custom user agent step unless you actually want a custom user agent:

use Nagios::Plugin::OverHTTP 0.06;
my $plugin = Nagios::Plugin::OverHTTP->new(timeout => 20);

In addition verson 0.07 changes the check_over_http script so that the timeout defaults to 10 seconds, which is reasonable with Nagios plugins.

Leave a Reply