Tech Racho エンジニアの「?」を「!」に。
  • インフラ

nagiosのcheck_mailqプラググインがうまく動かないとき

nagiosでmailqのチェックをしようとしたらうまく動いてなかったので、
こんなパッチを当てると良いです。
怖いのはデフォルトのままで使うとどんなときもmailq emptyを返すので、まったくチェックにならないです。

# diff -u ./check_mailq.org /usr/lib/nagios/plugins/check_mailq
--- ./check_mailq.org 2013-04-08 17:33:52.000000000 +0900
+++ /usr/lib/nagios/plugins/check_mailq 2013-04-08 17:34:03.000000000 +0900
@@ -165,9 +165,9 @@
# Finally look at the overall queue length
#
- if (/mqueue/) {
+ if (/^\-\-/) {
print "$utils::PATH_TO_MAILQ = $_ "if $verbose ;
- if (/ \((\d+) request/) {
+ if (/ (\d+) Request/) {
#
# single queue: first line
# multi queue: one for each queue. overwrite on multi queue below

zimbraのmailqをチェックする場合はこんな感じ

# diff -u check_mailq.org /usr/lib/nagios/plugins/check_mailq
--- check_mailq.org 2013-04-09 10:22:53.701747418 +0900
+++ /usr/lib/nagios/plugins/check_mailq 2013-04-09 10:26:15.281747415 +0900
@@ -47,6 +47,7 @@
$msg_q = 0 ;
$msg_p = 0 ;
$state = $ERRORS{'UNKNOWN'};
+$utils::PATH_TO_MAILQ = "/opt/zimbra/postfix/sbin/mailq";
Getopt::Long::Configure('bundling');
$status = process_arguments();
@@ -164,9 +165,9 @@
# Finally look at the overall queue length
#
- if (/mqueue/) {
+ if (/^\-\-/) {
print "$utils::PATH_TO_MAILQ = $_ "if $verbose ;
- if (/ \((\d+) request/) {
+ if (/ (\d+) Request/) {
#
# single queue: first line
# multi queue: one for each queue. overwrite on multi queue below


CONTACT

TechRachoでは、パートナーシップをご検討いただける方からの
ご連絡をお待ちしております。ぜひお気軽にご意見・ご相談ください。