On a recently installed machine, the Nagios check for mailq did not work. Instead it returned the following error:
This is on a QMail based machine running on FreeBSD. I compared the setup with an older FreeBSD machine, where the check works properly. This box was also running QMail but with an older set of Nagios plugins. The configuration was equal, except the check_mailq script itself, because it has evolved a little in the meantime. The changes itself looked quite innocent, but apperently they made a significant difference: if I replaced the newer version with the older version, all of a sudden the mail queue was properly checked. I have added the older, but working, file as an attachment to this page.
It's a bit unsatisfying that I cannot point my finger at which line(s) make that error appear.