Simple/plugins/check-url.pl untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 23 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 #
3 # Plugin for checking availability of a single URL (using the HTTP
4 # HEAD method).
5 #
6 # Usage: check-url.pl [-cfg <config-file>] -service <id> [<logging-options>]
7 #
8 # The return code and STDOUT are compatible with the Nagios plugins
9 # (see: http://nagios.sourceforge.net/docs/3_0/quickstart.html)
10 #
11 # September 2011
12 # Author: Martin Senger <martin.senger@gmail.com>
13 #-----------------------------------------------------------------
14  
15 use warnings;
16 use strict;
17  
18 use Monitor::Simple;
19 use Log::Log4perl qw(:easy);
20  
21 # read command-line arguments and configuration
22 my ($config_file, $service_id) = Monitor::Simple::Utils->parse_plugin_args ('', @ARGV);
23 LOGDIE ("Unknown service (missing parameter '-service <id>')\n")
24 unless $service_id;
25 my $config = Monitor::Simple::Config->get_config ($config_file);
26  
27 # make my test
28 Monitor::Simple::UserAgent->head_or_exit ($service_id, $config);
29  
30 # everything is okay
31 Monitor::Simple::Utils->report_and_exit ($service_id, $config, Monitor::Simple::RETURN_OK, "OK");
32  
33 __END__