10 use WWW
::Mechanize
::Script
::Util
qw(:ALL);
11 use WWW
::Mechanize
::Script
;
15 my @options = ( "file=s", "help|h", "usage|?" );
17 GetOptions
( \
%opts, @options ) or pod2usage
(2);
19 defined( $opts{help
} )
27 defined( $opts{usage
} ) and $opts{usage
} and pod2usage
(1);
28 opt_required_all
( \
%opts, qw(file) );
30 my %cfg = load_config
( \
%opts );
33 my %cfgvar = ( OPTS_FILE
=> $opts{file
} );
34 my $cfgkeys = join( "|", keys %cfgvar );
35 $cfg{summary
}->{target
} =~ s/@($cfgkeys)[@]/$cfgvar{$1}/ge;
36 $cfg{report
}->{target
} =~ s/@($cfgkeys)[@]/$cfgvar{$1}/ge;
39 my $wms = WWW
::Mechanize
::Script
->new( \
%cfg );
41 my @script_files = find_scripts
( \
%cfg, $opts{file
} );
43 my ( $code, @msgs ) = (0);
46 my $scripts = Config
::Any
->load_files(
48 files
=> [@script_files],
53 foreach my $filename (@script_files)
55 defined( $scripts->{$filename} )
56 or next; # file not found or not parsable ...
57 # merge into default and previous loaded config ...
58 push( @script, @
{ $scripts->{$filename} } );
60 ( $code, @msgs ) = $wms->run_script(@script);
62 $@
and say("UNKNOWN - $@");
63 exit( $@ ?
255 : $code );
69 check_web2 - allows checking of website according to configured specifications
73 check_web2 is intended to be used to check web-sites according a configuration.
74 The configuration covers the request configuration (including agent part) and
75 check configuration to specify check parameters.
77 See C<WWW::Mechanize::Script> for details about the configuration options.
81 This script is created as successor of an check_web script of a nagios setup
82 based on HTTP::WebCheck. This module isn't longer maintained, so decision
83 was made to create a new environment simulating the old one basing on
88 $ check_web2 --file domain1/site1.json
89 $ check_web2 --file domain2/site1.yml
91 $ check_web2 --file domain1/site2.wts
95 Jens Rehsack, C<< <rehsack at cpan.org> >>
99 Please report any bugs or feature requests to C<bug-www-mechanize-script at rt.cpan.org>, or through
100 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Mechanize-Script>. I will be notified, and then you'll
101 automatically be notified of progress on your bug as I make changes.
105 You can find documentation for this module with the perldoc command.
107 perldoc WWW:Mechanize::Script
109 You can also look for information at:
113 =item * RT: CPAN's request tracker (report bugs here)
115 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Mechanize-Script>
117 =item * AnnoCPAN: Annotated CPAN documentation
119 L<http://annocpan.org/dist/WWW-Mechanize-Script>
123 L<http://cpanratings.perl.org/d/WWW-Mechanize-Script>
127 L<http://search.cpan.org/dist/WWW-Mechanize-Script/>
131 =head1 ACKNOWLEDGEMENTS
133 =head1 LICENSE AND COPYRIGHT
135 Copyright 2012 Jens Rehsack.
137 This program is free software; you can redistribute it and/or modify it
138 under the terms of either: the GNU General Public License as published
139 by the Free Software Foundation; or the Artistic License.
141 See http://dev.perl.org/licenses/ for more information.