X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_imap_connection;fp=modules%2Fprivate%2Fmonitoring%2Fplugins%2Fcheck_imap_connection;h=0000000000000000000000000000000000000000;hp=c1ab0dd469e41f3a867adee8ab8fff4bd0b04aa0;hb=1a64deeb894dc95e2645a75771732c6cc53a79ad;hpb=fa25ffd4583cc362075cd5e1b4130f33306103f0 diff --git a/modules/private/monitoring/plugins/check_imap_connection b/modules/private/monitoring/plugins/check_imap_connection deleted file mode 100755 index c1ab0dd..0000000 --- a/modules/private/monitoring/plugins/check_imap_connection +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env perl - -use strict; -use Getopt::Std; -$| = 1; - -my %opts; -getopts('h:u:p:H:', \%opts); - -my $STATE_OK = 0; -my $STATE_WARNING = 1; -my $STATE_CRITICAL = 2; -my $STATE_UNKNOWN = 3; - -if ($opts{'h'} || !$opts{'u'} || !$opts{'p'} || !$opts{'H'}) { - &print_help(); - exit($STATE_UNKNOWN); -} - -my $user = $opts{'u'}; -my $password = $opts{'p'}; -my $host = $opts{'H'}; - -my $cmd_result = `(echo "a login $user $password"; echo "b logout") | openssl s_client -quiet -ign_eof -connect $host -starttls imap 2>&1`; -my $expected_result = "a OK Logged in"; - -chomp($cmd_result); -if ($cmd_result !~ /$expected_result/) { - print "IMAP CRITICAL - Unable to connect via imaps | imap=0;;;;\n"; - exit($STATE_CRITICAL); -} else { - print "IMAP OK - imaps connected successfully | imap=1;;;;\n"; - exit($STATE_OK); -} - -sub print_help() { - print << "EOF"; -Check whether imap works via ssl and is able to connect its database. - -Options: --h - Print detailed help screen --u - User to log in as --p - Password to log in --H - Host to log in to - -EOF -} -