CHECK_IMAP_QUOTA(7)

πŸ’– CHECK_IMAP_QUOTA πŸ’–

okay so bestie, welcome to check_imap_quota β€” it's a lil Perl plugin from the CHECK_IMAP_QUOTA(7) manual, and it does exactly one iconic thing: it connects to an IMAP account and checks the quota. that's it. that's the whole job. and it ate. πŸ’…


✨ NAME ✨

check_imap_quota β€” connects to an IMAP account and checks the quota πŸ¦‹


✨ SYNOPSIS ✨

check_imap_quota -vV
check_imap_quota -?
check_imap_quota --help

✨ OPTIONS ✨

  • --warning <seconds> β€” throws a warning if connecting to the IMAP server takes longer than <seconds>. default is 15 seconds. also known as: -w <seconds>
  • --critical <seconds> β€” returns a CRITICAL status if connecting to the IMAP server takes longer than <seconds>. default is 30 seconds. see also: --capture-critical <messages>. also known as: -c <seconds>
  • --timeout <seconds> β€” aborts with critical status if connecting to the IMAP server takes longer than <seconds>. default is 60 seconds. okay so the difference between timeout and critical is this: with the default settings, if it takes 45 seconds to connect to the server, then the connection will actually succeed, but the plugin will still return CRITICAL because it took longer than 30 seconds. no cap. also known as: -t <seconds>
  • --hostname <server> β€” the address or name of the IMAP server. examples: mail.server.com, localhost, 192.168.1.100. also known as: -H <server>
  • --port <number> β€” the service port on the IMAP server. default is 143. if you use SSL, the default is 993. also known as: -p <number>
  • --username <username> and --password <password> β€” the username and password to use when connecting to the IMAP server. also known as: -U <username> -P <password>
  • --mailbox <mailbox> β€” use this option to specify the mailbox to search for messages. default is INBOX. also known as: -m <mailbox>
  • --ssl and --nossl β€” enable the SSL protocol. requires IO::Socket::SSL.
    • using this option automatically changes the default port from 143 to 993. you can still override this from the command line using the --port option.
    • use the nossl option to turn off the ssl option.
  • --hires β€” use the Time::HiRes module to measure time, if available.
  • --verbose β€” display additional information. useful for troubleshooting. use it together with --version to see the default warning and critical timeout values.
    • if the selected mailbox was not found, you can use verbosity level 3 (-vvv) to display a list of all available mailboxes on the server.
    • also known as: -v
  • --version β€” display plugin version and exit. also known as: -V
  • --help β€” display this documentation and exit. does not work in the ePN version. also known as: -h
  • --usage β€” display a short usage instruction and exit.

🌸 EXAMPLES 🌸

Report how many emails are in the mailbox

$ check_imap_receive -H mail.server.net --username mailuser --password mailpass
-s ALL --nodelete

IMAP RECEIVE OK - 1 seconds, 7 found

Report the email with the highest value

suppose your mailbox has some emails from an automated script, and a message from this script typically looks like this (abbreviated):

To: mailuser@server.net
From: autoscript@server.net
Subject: Results of Autoscript
Date: Wed, 09 Nov 2005 08:30:40 -0800
Message-ID: <auto-000000992528@server.net>

Homeruns 5

and further suppose you're interested in reporting the message with the highest number of home runs, and also leaving that message in the mailbox for future checks, but removing the other matching messages with lesser values:

$ check_imap_receive -H mail.server.net --username mailuser --password mailpass
-s SUBJECT -s "Results of Autoscript" --capture-max "Homeruns (\d+)"  --nodelete-captured

IMAP RECEIVE OK - 1 seconds, 3 found, 1 captured, 5 max, 2 deleted

Troubleshoot your search parameters

add the --nodelete and --imap-retries=1 parameters to your command line. πŸ”


πŸ’€ EXIT CODES πŸ’€

complies with the Nagios plug-in specification:

 0         OK             The plugin was able to check the service and
it appeared to be functioning properly
 1         Warning        The plugin was able to check the service, but
it appeared to be above some "warning" threshold or did not appear to be
working properly
 2         Critical  The plugin detected that either the service was not
running or it was above some "critical" threshold
 3         Unknown        Invalid command line arguments were supplied
to the plugin or the plugin was unable to check the status of the given
hosts/service

πŸ‘‘ NAGIOS PLUGIN NOTES πŸ‘‘

Nagios plugin reference: http://nagiosplug.sourceforge.net/developer-guidelines.html

this plugin does NOT use Nagios DEFAULT_SOCKET_TIMEOUT (provided by utils.pm as $TIMEOUT) because the path to utils.pm must be specified completely in this program, and that forces users to edit the source code if their install location is different (if they even realize that's the problem 😭). you can view the default timeout for this module by using the --verbose and --version options together. the short form is -vV.

other than that, it attempts to follow published guidelines for Nagios plugins. 🫢


πŸ¦‹ SEE ALSO πŸ¦‹


🌈 CHANGES 🌈

 Fri Nov 11 04:53:09 AST 2011
 + version 0.1 created with quota code contributed by Johan Romme

 Tue Dec 20 17:38:04 PST 2011
 + fixed bug where a quota of 0 was reported as an incorrect response from the server, thanks to Eike Arndt
 + version 0.2

πŸŽ€ AUTHOR πŸŽ€

Jonathan Buhacoff <jonathan@buhacoff.net>


 Copyright (C) 2011 Jonathan Buhacoff

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

 http://www.gnu.org/licenses/gpl.txt

okay that's the whole page, bestie, you're officially fluent πŸ’…βœ¨ this lil icon of a manpage is running on perl v5.40.1 and it was last touched on 2026-02-11 β€” go check that quota, periodt πŸ“πŸ§š

πŸ“¦ where this page comes from