Friday, June 7, 2013

check_mailq not correctly detecting the mail queue -NRPE plugins


I have added nagios NRPE client to check mail queue in CentOS 6 server and running postfix as mail deamon.

Issue : Eventhough there is mailq in the server nagios showed as Empty mailq.


First I checked the below configuration files in the Mail server
--> /usr/local/nagios/libexec/check_mailq : There you can find a variable called
"$mailq = 'sendmail'; # default". I have changed it to postfix. But it didnt resolve the issue.
--> /usr/local/nagios/libexec/utils.pm : There you can find a varialbe called $PATH_TO_MAILQ   = "/usr/bin/mailq";
This is also correct. That can checked by issue /usr/bin/mailq and it will show the actual mailq
--> /usr/local/nagios/etc/nrpe.cfg : There you set check_mailq parameteres
/usr/local/nagios/libexec/check_mailq -w 100 -c 200

Run the below command independantly in the mail server
--> /usr/local/nagios/libexec/check_mailq -w 100 -c 200
But it issues the Mail queue empty though there are several mails in the queue.

Then I issued the above command with the mail deamon option as below
--> /usr/local/nagios/libexec/check_mailq -w 100 -c 200 -M postfix
This will show you the correct mail queue and then I chaged the /usr/local/nagios/etc/nrpe.cfg check_mailq parameter with the -M postfix option.
Issue was sorted.

Note : AS far as I found the postfix does not create mailqueue directory under /var/spool/. It has seperate direcotry in /var/spool/postfix/ which maintain mails in seperate directories such as  deferred , bounce , active  etc. So this might be the reason the nagion NRPE plugin could not check the mail queue correctly.

Some of the packages cannot updated. Need to take from old packages.


Ubuntu apt-get install propagate error message “ Some of the packages cannot updated. Need to take from old packages. - Ubuntu OS version is old.”


When you get this kind of error message first you need to backup /etc/apt/souces.list and then follow the below mention steps.

  1. vi /etc/apt/sources.list
  2. Then find the below lines and replace as mention
  • deb <siteurl> karmic main restricted
  • replace the <siteurl> with http://old-releases.ubuntu.com/ubuntu
3. Once again find http://security.ubuntu.com/ubuntu and replace with http://old-releases.ubuntu.com/ubuntu

4. Save the changes and issue the below command.
5. apt-get update

Then install the packages as you wish.