« plugins/templates/check_template-WebTransact-with-client-certificate.pl
↑ Summary
plugins/nagios/templates/check_xml.pl »
| 1 | #!/usr/bin/env perl | ||||||||||
| 2 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||
| 3 | # © Copyright 2003-2011 by Alex Peeters [alex.peeters@citap.be] | ||||||||||
| 4 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||
| 5 | # 2011/mm/dd, v3.002.003, check_template-IO.pl | ||||||||||
| 6 | # ---------------------------------------------------------------------------------------------------------- | ||||||||||
| 7 | |||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use warnings; # Must be used in test mode only. This reduces a little process speed | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | #use diagnostics; # Must be used in test mode only. This reduces a lot of process speed | ||||||||||
| 11 | |||||||||||
| 12 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | BEGIN { if ( $ENV{ASNMTAP_PERL5LIB} ) { eval 'use lib ( "$ENV{ASNMTAP_PERL5LIB}" )'; } } | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||
| 15 | |||||||||||
| 16 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins v3.002.003; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins qw(:PLUGINS); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 22 | |||||||||||
| 23 | 2 | my $objectPlugins = ASNMTAP::Asnmtap::Plugins->new ( | |||||||||
| 24 | _programName => 'check_template-IO.pl', | ||||||||||
| 25 | _programDescription => "IO plugin template for the '$APPLICATION'", | ||||||||||
| 26 | _programVersion => '3.002.003', | ||||||||||
| 27 | _programUsagePrefix => '--service <service> --protocol <protocol> --request <request>', | ||||||||||
| 28 | _programHelpPrefix => '--service=<service> | ||||||||||
| 29 | --protocol=<protocol> | ||||||||||
| 30 | --request=<request>', | ||||||||||
| 31 | _programGetOptions => ['host|H=s', 'port|P=i', 'service:s', 'protocol:s', 'request:s', 'username|u|loginname:s', 'password|p|passwd:s', 'timeout|t:i', 'trendline|T:i'], | ||||||||||
| 32 | _timeout => 30, | ||||||||||
| 33 | _debug => 0); | ||||||||||
| 34 | |||||||||||
| 35 | 0 | my $host = $objectPlugins->getOptionsArgv ('host'); | |||||||||
| 36 | 0 | my $port = $objectPlugins->getOptionsArgv ('port'); | |||||||||
| 37 | 0 | my $service = $objectPlugins->getOptionsArgv ('service'); | |||||||||
| 38 | 0 | my $protocol = $objectPlugins->getOptionsArgv ('protocol'); | |||||||||
| 39 | 0 | my $request = $objectPlugins->getOptionsArgv ('request'); | |||||||||
| 40 | 0 | my $username = $objectPlugins->getOptionsArgv ('username'); | |||||||||
| 41 | 0 | my $password = $objectPlugins->getOptionsArgv ('password'); | |||||||||
| 42 | |||||||||||
| 43 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 44 | |||||||||||
| 45 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins::IO v3.002.003; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 46 | 2 | ▶ | use ASNMTAP::Asnmtap::Plugins::IO qw(:SOCKET); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 47 | |||||||||||
| 48 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 49 | # Start plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 50 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 51 | |||||||||||
| 52 | 0 | my $returnCode = scan_socket_info ( | |||||||||
| 53 | asnmtapInherited => \$objectPlugins, | ||||||||||
| 54 | protocol => $protocol, | ||||||||||
| 55 | host => $host, | ||||||||||
| 56 | port => $port, | ||||||||||
| 57 | service => $service, | ||||||||||
| 58 | request => $request, | ||||||||||
| 59 | socketTimeout => 5, | ||||||||||
| 60 | POP3 => { | ||||||||||
| 61 | username => $username, | ||||||||||
| 62 | password => $password, | ||||||||||
| 63 | serviceReady => "[XMail [0-9.]+ POP3 Server] service ready", | ||||||||||
| 64 | passwordRequired => 'Password required for', | ||||||||||
| 65 | mailMessages => "Maildrop has [0-9.]+ messages", | ||||||||||
| 66 | closingSession => "[XMail [0-9.]+ POP3 Server] closing session" | ||||||||||
| 67 | } | ||||||||||
| 68 | ); | ||||||||||
| 69 | |||||||||||
| 70 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 71 | # End plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 72 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 73 | |||||||||||
| 74 | 0 | $objectPlugins->exit (7); | |||||||||
| 75 | |||||||||||
| 76 | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||||||
| 77 | |||||||||||
| 78 | __END__ | ||||||||||