Version 9 (modified by Jamie McClelland, 4 years ago) (diff)


Filter check

May First/People Link regularly checks to see if our servers are sending email messages into the spam/junk boxes of corporate providers. These scripts are installed and configured on

There are three parts to the check:

  • mf-monitor-filtercheck - This script runs on a cron job and updates the nagios server if the status changes. When run on the terminal it will take 45 minutes to complete (to leave enough time for all messages to be delivered) and will output either OK: (if all messages landed in the inbox), WARNING: (if not all messages landed in the inbox and the last time it ran that status was OK:) or CRITICAL: (if not all messages landed in the inbox and the last time it ran the status was not OK:).
  • mf-filtercheck - This script is the one executed by mf-monitor-filtercheck - by default it provides verbose output so you can see which corporate providers are filtering our email. You can pass the environment variable MF_SLEEP=60 if you want the script to sleep for only 60 seconds instead of the full 45 minutes.
  • filter-check - This is the generic script that powers mf-filercheck. See more below...

What to do if the nagios monitor alert goes off

Check the logs.

journalctl | grep filter-check


cat /var/log/syslog | grep filter-check

If the exit code is "1" it means the message landed in the spambox. If the exit code is 2 it means it was not received. If the exit code was 255 it means there was an error.

If the exit code is "1" - you can retest to see if this is happening consistently:

filter-check --sendto SENDTO --sleep 30

If the exit code is "2" - you can manually login to the provider (see keyringer for all passwords) and see if the message eventually made it. Then you can debug the delay.

If the exit code is "3" - you can try to re-run manually using filter-check (like with exit code 1) to see if you can re-create the error.


The filter-check program sends email via our servers to various corporate providers and checks to see if they land in the inbox or the spam box.

Current providers checked: Gmail, Yahoo and

Basic usage:

usage: filter-check [-h] [--sendvia SENDVIA] [--sendto SENDTO] [--quiet]
                    [--gtube] [--headers] [--sleep SLEEP]
                    [--emailfrom EMAILFROM] [--subject SUBJECT] [--msg MSG]
                    [--sendonly] [--fetchfrom FETCHFROM]
                    [--messageid MESSAGEID]

Check deliverability to various mail providers. Configuration file is in

optional arguments:
  -h, --help            show this help message and exit
  --sendvia SENDVIA     the host to relay the email
  --sendto SENDTO       the host to send the email
  --quiet               surpress all output, use exit codes only
  --gtube               use spamassassin code to identify the message as spam
                        (for debugging)
  --headers             output full headers, instead of brief headers
  --sleep SLEEP         number of seconds to wait between sending and checking
  --emailfrom EMAILFROM
                        send the test message from this email
  --subject SUBJECT     specify the subject for the test message
  --msg MSG             specify the body of the test message
  --sendonly            don't fetch the message, only send it and output the
                        message-id sent
  --fetchfrom FETCHFROM
                        don't send a message, only fetch a message from this
                        host matching the passed messageid
  --messageid MESSAGEID
                        when using fetchfrom, fetch the messageid specified in
                        this option

Exit codes: 0 if message is found in Inbox, 1 if found in spam box, 2 if not
delivered, 255 if error.

Code is available via git clone git://