A simple script to check Exim queue size for Nagios NRPE:

#!/bin/bash
#arg1 = warning count
#arg2 = critical count
if \[ -z "$1" \] || \[ -z "$2" \]
then
        echo "Usage: ${0} warningcount criticalcount"
else
        if \[ "$1" -ge "$2" \] || \[ "$1" -le "0" \] || \[ "$2" -le "0" \]
        then
                echo "Error: incorrect values."
        else
                queuesize=$(/usr/sbin/exim4 -bpc)
                if \[ "$queuesize" -gt "$2" \]
                then
                        echo "CRITICAL - exim queue size: $queuesize"
                        exit 2
                elif \[ "$queuesize" -gt "$1" \]
                then
                        echo "WARNING - exim queue size: $queuesize"
                        exit 1
                else
                        echo "OK - exim queuesize: $queuesize"
                        exit 0
                fi
        fi
fi