diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-02-15 10:18:03.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-02-15 10:06:14.000000000 +0100 @@ -1,2 +1,4 @@ Cmnd_Alias ZABBIX_AGENT_ROOT = /usr/bin/mysqladmin status Cmnd_Alias ZABBIX_AGENT_SMELOG = /var/lib/zabbix/bin/logtail.pl /var/log/qpsmtpd/current /var/lib/zabbix/tmp/* +Cmnd_Alias ZABBIX_AGENT_QMAIL = /var/lib/zabbix/bin/logtail.pl /var/log/qmail/current /var/lib/zabbix/tmp/* + diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2009-02-15 10:18:03.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2009-02-15 10:05:48.000000000 +0100 @@ -1,3 +1,4 @@ zabbix ALL=(root) NOPASSWD: ZABBIX_AGENT_ROOT zabbix ALL=(smelog) NOPASSWD: ZABBIX_AGENT_SMELOG +zabbix ALL=(qmaill) NOPASSWD: ZABBIX_AGENT_QMAIL diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut --- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_agentd.conf/90UserParameters_mailOut 2009-02-15 10:16:58.000000000 +0100 @@ -0,0 +1,8 @@ +# Outgoing mails statistics + +UserParameter=mail.out.total,/var/lib/zabbix/bin/mail_out.sh total +UserParameter=mail.out.success,/var/lib/zabbix/bin/mail_out.sh success +UserParameter=mail.out.deferral,/var/lib/zabbix/bin/mail_out.sh deferral +UserParameter=mail.out.failre,/var/lib/zabbix/bin/mail_out.sh failure + + diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh --- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh 2009-02-15 10:18:03.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh 2009-02-15 10:17:46.000000000 +0100 @@ -4,7 +4,7 @@ LOGTAIL=$BINDIR'/logtail.pl' PARSER=$BINDIR'/parse_mail_in.pl' LOGFILE='/var/log/qpsmtpd/current' -TMPDIR='/var/lib/zabbix/tmp' +TMPDIR='/var/lib/zabbix/tmp/smelog' /usr/bin/sudo -u smelog $LOGTAIL $LOGFILE $TMPDIR/mailin.$WHAT.offset | $PARSER $WHAT diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh --- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh 2009-02-15 10:17:56.000000000 +0100 @@ -0,0 +1,10 @@ +#!/bin/bash +WHAT=$1 +BINDIR='/var/lib/zabbix/bin' +LOGTAIL=$BINDIR'/logtail.pl' +PARSER=$BINDIR'/parse_mail_out.pl' +LOGFILE='/var/log/qmail/current' +TMPDIR='/var/lib/zabbix/tmp/qmail' + +/usr/bin/sudo -u qmaill $LOGTAIL $LOGFILE $TMPDIR/mailout.$WHAT.offset | $PARSER $WHAT + diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl --- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl 1970-01-01 01:00:00.000000000 +0100 +++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl 2009-02-15 10:06:55.000000000 +0100 @@ -0,0 +1,70 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2009 Daniel Berteaud + +# This file is part of smeserver-zabbix-agent package. + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with Foobar; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +my $what = $ARGV[0] || ''; + +# On initialise nos compteurs a 0 +my @results = qw(failure deferral success total); +my %cnt; +foreach (@results){ + $cnt{$_} = 0; +} + +while () { + my $line = $_; + + # on limites aux lignes concernant l'envoie + # @400000004994ad092afa867c delivery 96906: success etc... + next unless $line =~ m/^\@[0-9a-f]{24} delivery \d+: (success|failure|deferral)/; + my $result = $1; + $cnt{$result}++; +} + +# Caclul des totaux: +foreach (@results){ + $cnt{total} = $cnt{total} + $cnt{$_} if $_ !~ /total/; +} + +# Si l'argument est "print" on affiche toutes les stats +if ($what eq "print"){ + + foreach (@results){ + print "$_: $cnt{$_}\n"; + } +} + +# Si l'argument correspond a un compteur definit +# On affiche uniquemment cette valeur +elsif (defined $cnt{$what}){ + print "$cnt{$what}\n"; +} + +# Sinon, on quitte avec une erreur +else{ + print "supported items are: "; + foreach (@results){ + print "$_ "; + } + print "\n"; + exit 1; +} +exit 0; +