Check imap.pl: Difference between revisions

From Federal Burro of Information
Jump to navigationJump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 94: Line 94:
}
}
</pre>
</pre>
[[Category:Computers]]
[[Category:Script]]

Latest revision as of 15:22, 12 March 2021

Documentation

CHECK_IMAP(1)         User Contributed Perl Documentation        CHECK_IMAP(1)

SYNOPSIS
       check_imap.pl -v -S -w <seconds> -c <seconds> --user <username> --host <host> --port 993 --pwf /path/to/file.safe

       Options:
           -v          Verbose
           -fr         Full responses
           -S          Secure
           -h          brief help message
           -m          full documentation
           -w          warn threshold (seconds)
           -c          critical threshold (seconds)
           --user      imap username
           --host      imap server
           --port      tcp port (default 143)
           --pwf       password file

OPTIONS
       -v      be verbose , show server communication.

       -fr     Show full responses from the server.

       -S      Use TLS

       -h      Print a brief help message and exits.

       -m      Prints the manual page and exits.

       -w      Warn threshold in seconds

       -c      Critical Threshold in seconds

       --user  Imap user

       --host  Imap Server address.

       --port  TCP port to use, vanilla IMAP would be 143, Secure IMAP would be 993 (use -S for secure)

       --pwf   The password file. Should contain the password in one line.

DESCRIPTION
       check_imap.pl will open a connection to the IMAP server and have a conversation:

       Expected conversation roughly
        * OK IMAP4 ready
        a01 login $user $password
        LOGIN completed
        a02 SELECT INBOX
        SELECT completed
        a03 FETCH 1:* FLAGS
        OK FETCH completed
        a04 FETCH 1 full
        OK FETCH completed
        a06 FETCH 1 body[text]
        OK FETCH completed
        a05 logout
        * BYE imapserver.domain.com Zimbra IMAP4rev1 server closing connection"

perl v5.8.8                       2011-10-05                     CHECK_IMAP(1)

Code

/code

Requirements

  • IO::Socket::SSL ( requires Crypt::SSLeay )

Nagios

command definition

in commands.cfg

define command{
command_name    check_imap_pl
#command_line    $USER1$/check_imap.pl -u david.thornton@domain.com -p ~/.zmsoap.pwd -s 10.14.19.111
command_line    $USER1$/check_imap.pl -w $ARG1$ -c $ARG2$ --user $ARG3$ --host $HOSTADDRESS$ --port $ARG4$ --pwf $ARG5$
}

service example

define service{
use                 generic-service,service-pnp
host_name           5-sms-zimbra-message-store-01
contact_groups      smsadmingroup-tech-critical
service_description 5-Imap Conversation
check_command       check_imap_pl!5!10!testms3@domain.com!143!/usr/local/nagios/etc/sms/.zmsoap.pwd
}