check_mailq usage

Upayavira uv at upaya.co.uk
Mon Apr 26 22:09:24 CEST 2004


[Note: I am no Nagios guru - I haven't even got my setup to work yet. 
Nor have I ever installed a unix mail server. I just know Perl, that's all]

kollasch.drew at bvrmc.org wrote:

>I included the output of the mailq command at the top before the error...but
>here it is again
>  
>
If I do /usr/bin/mailq, I get:

/var/spool/mqueue is empty
                Total requests: 0

Now the check_mailq script first looks for the phrase "mqueue" in a 
line. In that line, it looks for either "empty", or a number. If it gets 
a number, it checks to see if that number is less than the one it 
expects, and sets status details accordingly.

Now, if it doesn't find a line containing "mqueue", it will give 
precicely the error you have been getting.

>...
>gentoo1 cron.daily # /usr/bin/mailq
>-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
>DC225A01CB*   51754 Mon Apr 26 14:47:59  MAILER-DAEMON
>                                         emailalert at clma.org
>
>-- 50 Kbytes in 1 Request.
>

>gentoo1 cron.daily # /usr/bin/mailq
>Mail queue is empty
>...
>
>The mailq command works perfectly fine on the box. It's the check command
>that does not.
>  
>
Well, that's because your mailq command is giving out a type of output 
that the check command doesn't know how to handle. Are there different 
versions of mailq available? I dunno.

You could try this in your perl script (how good is your Perl?):

Find where it says:
        if (/mqueue/) {
until:
        last;

Replace this all with:

       if (/mail queue is empty/) {
                        $msg = "OK: mailq is empty";
                        $msg_q = 0;
                        $state = $ERRORS{'OK'};
                        last;
       }elsif ( /in (\d+) request/ ) {
                        $msg_q = $1 ;

                        print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" 
if $verbose;

                        if ($msg_q < $opt_w) {
                                $msg = "OK: mailq ($msg_q) is below 
threshold ($opt_w/$opt_c)";
                                $state = $ERRORS{'OK'};
                        }elsif ($msg_q >= $opt_w  && $msg_q < $opt_c) {
                                $msg = "WARNING: mailq is $msg_q 
(threshold w = $opt_w)";
                                $state = $ERRORS{'WARNING'};
                        }else {
                                $msg = "CRITICAL: mailq is $msg_q 
(threshold c = $opt_c)";
                                $state = $ERRORS{'CRITICAL'};
                        }
                last;
        }

That _might_ convert your check_mailq script into one that will work 
with your mailq command.

I make no promises though.

Regards, Upayavira

>-----Original Message-----
>From: Upayavira [mailto:uv at upaya.co.uk] 
>Sent: Monday, April 26, 2004 2:32 PM
>To: nagios-users at lists.sourceforge.net
>Subject: Re: [Nagios-users] check_mailq usage
>
>
>kollasch.drew at bvrmc.org wrote:
>
>  
>
>>I have since migrated my mail server and my nagios server together
>>(onto the same box) and I still get the same error. IT was suggested 
>>that I get the newest one via CVS. I am lost on knowing how to do that 
>>though. If there are other ideas/solutions also, please let me know.
>>    
>>
>
>Try at a prompt:
>/usr/bin/mailq
>
>What do you get?
>
>Basically, the perl script is expecting either the word "empty" or a 
>number on the line that contains "mqueue". But it seems that yours isn't 
>doing that.
>
>Upayavira
>
>  
>
>> 
>>gentoo1 nagios # mailq
>>Mail queue is empty
>>gentoo1 nagios # /usr/nagios/libexec/check_mailq -w5 -c10 -v Use of 
>>uninitialized value in concatenation (.) or string at 
>>/usr/nagios/libexec/check_mailq line 110. Use of uninitialized value 
>>in concatenation (.) or string at /usr/nagios/libexec/check_mailq line 
>>110.  | mailq =
>>Use of uninitialized value in exit at /usr/nagios/libexec/check_mailq 
>>line 111.
>>gentoo1 nagios #
>>
>>    -----Original Message-----
>>    *From:* Drew Kollasch
>>    *Sent:* Friday, April 16, 2004 3:18 PM
>>    *To:* nagios-users at lists.sourceforge.net
>>    *Subject:* RE: [Nagios-users] check_mailq usage
>>
>>    IC...well that's no fun now is it?
>>    This machine DOES have a mailq on it, its just not the one that I
>>    want to check.
>>     
>>
>>    -------------------------------------------------------
>>    Drew Kollasch
>>    Network/Desktop Technician
>>    Buena Vista Regional Medical Center
>>    kollasch.drew at bvrmc.org
>>    712-732-4455x2153
>>
>>        -----Original Message-----
>>        *From:* Marc Powell [mailto:marc at ena.com]
>>        *Sent:* Friday, April 16, 2004 3:17 PM
>>        *To:* Drew Kollasch; nagios-users at lists.sourceforge.net
>>        *Subject:* Re: [Nagios-users] check_mailq usage
>>
>>        The plugin expects to be run on the machine with the mail
>>        queue you want to check. That's probably why it's failing.
>>        Like the majority of the plugins that check non-network
>>        related items, there is no support for connecting to a remote
>>        host to check local stats. You'll need to use a transport
>>        mechanism such as NRPE or check-by-ssh.
>>
>>        --
>>        Marc
>>
>>        -----Original Message-----
>>        From: kollasch.drew at bvrmc.org <kollasch.drew at bvrmc.org>
>>        To: nagios-users at lists.sourceforge.net
>>        <nagios-users at lists.sourceforge.net>
>>        Sent: Fri Apr 16 15:00:15 2004
>>        Subject: [Nagios-users] check_mailq usage
>>
>>        I am attempting to get the check_mailq check to work, but am
>>        having some troubles.
>>        Executing from the CLI,
>>        ...
>>        gentoo1 nagios # /usr/nagios/libexec/check_mailq -w 5 -c 10
>>        Use of uninitialized value in concatenation (.) or string at
>>        /usr/nagios/libexec/check_mailq line 110.
>>        Use of uninitialized value in concatenation (.) or string at
>>        /usr/nagios/libexec/check_mailq line 110.
>>         | mailq =
>>        Use of uninitialized value in exit at
>>        /usr/nagios/libexec/check_mailq line 111.
>>        ...
>>
>>        any ideas? also the mailq that I wish to check IS on a
>>        different host, how would I specify that?
>>        Thanks in advance.
>>
>>    
>>
>
>
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a
>limited time only, get FREE Ground shipping on all orders of $35 or more.
>Hurry up and shop folks, this offer expires April 30th!
>http://www.thinkgeek.com/freeshipping/?cpg=12297
>_______________________________________________
>Nagios-users mailing list
>Nagios-users at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nagios-users
>::: Please include Nagios version, plugin version (-v) and OS when reporting
>any issue. 
>::: Messages without supporting info will risk being sent to /dev/null
>
>
>	********************************************
>This message and accompanying documents are covered by the Electronic
>Communications Privacy Act, 18 U.S.C. ?? 2510-2521, and contain information
>intended for the specified individual (s) only. This information is
>confidential. If you are not the intended recipient or an agent responsible
>for delivering it to the intended recipient, you are hereby notified that
>you have received the document in error and that any review, dissemination,
>copying, or the taking of any action based on the contents of this is
>strictly prohibited. If you have received this communication in error,
>please notify us immediately by email, and delete the original message.
>	*********************************************
>
>
>  
>




-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list