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