1 |
slords |
1.1 |
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 |
2 |
|
|
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-02-15 10:18:03.000000000 +0100 |
3 |
|
|
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/00zabbixAgentAlias 2009-02-15 10:06:14.000000000 +0100 |
4 |
|
|
@@ -1,2 +1,4 @@ |
5 |
|
|
Cmnd_Alias ZABBIX_AGENT_ROOT = /usr/bin/mysqladmin status |
6 |
|
|
Cmnd_Alias ZABBIX_AGENT_SMELOG = /var/lib/zabbix/bin/logtail.pl /var/log/qpsmtpd/current /var/lib/zabbix/tmp/* |
7 |
|
|
+Cmnd_Alias ZABBIX_AGENT_QMAIL = /var/lib/zabbix/bin/logtail.pl /var/log/qmail/current /var/lib/zabbix/tmp/* |
8 |
|
|
+ |
9 |
|
|
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 |
10 |
|
|
--- smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2009-02-15 10:18:03.000000000 +0100 |
11 |
|
|
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/etc/e-smith/templates/etc/sudoers/30zabbixAgent 2009-02-15 10:05:48.000000000 +0100 |
12 |
|
|
@@ -1,3 +1,4 @@ |
13 |
|
|
zabbix ALL=(root) NOPASSWD: ZABBIX_AGENT_ROOT |
14 |
|
|
zabbix ALL=(smelog) NOPASSWD: ZABBIX_AGENT_SMELOG |
15 |
|
|
+zabbix ALL=(qmaill) NOPASSWD: ZABBIX_AGENT_QMAIL |
16 |
|
|
|
17 |
|
|
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 |
18 |
|
|
--- 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 |
19 |
|
|
+++ 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 |
20 |
|
|
@@ -0,0 +1,8 @@ |
21 |
|
|
+# Outgoing mails statistics |
22 |
|
|
+ |
23 |
|
|
+UserParameter=mail.out.total,/var/lib/zabbix/bin/mail_out.sh total |
24 |
|
|
+UserParameter=mail.out.success,/var/lib/zabbix/bin/mail_out.sh success |
25 |
|
|
+UserParameter=mail.out.deferral,/var/lib/zabbix/bin/mail_out.sh deferral |
26 |
|
|
+UserParameter=mail.out.failre,/var/lib/zabbix/bin/mail_out.sh failure |
27 |
|
|
+ |
28 |
|
|
+ |
29 |
|
|
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 |
30 |
|
|
--- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh 2009-02-15 10:18:03.000000000 +0100 |
31 |
|
|
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_in.sh 2009-02-15 10:17:46.000000000 +0100 |
32 |
|
|
@@ -4,7 +4,7 @@ |
33 |
|
|
LOGTAIL=$BINDIR'/logtail.pl' |
34 |
|
|
PARSER=$BINDIR'/parse_mail_in.pl' |
35 |
|
|
LOGFILE='/var/log/qpsmtpd/current' |
36 |
|
|
-TMPDIR='/var/lib/zabbix/tmp' |
37 |
|
|
+TMPDIR='/var/lib/zabbix/tmp/smelog' |
38 |
|
|
|
39 |
|
|
/usr/bin/sudo -u smelog $LOGTAIL $LOGFILE $TMPDIR/mailin.$WHAT.offset | $PARSER $WHAT |
40 |
|
|
|
41 |
|
|
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 |
42 |
|
|
--- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh 1970-01-01 01:00:00.000000000 +0100 |
43 |
|
|
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/mail_out.sh 2009-02-15 10:17:56.000000000 +0100 |
44 |
|
|
@@ -0,0 +1,10 @@ |
45 |
|
|
+#!/bin/bash |
46 |
|
|
+WHAT=$1 |
47 |
|
|
+BINDIR='/var/lib/zabbix/bin' |
48 |
|
|
+LOGTAIL=$BINDIR'/logtail.pl' |
49 |
|
|
+PARSER=$BINDIR'/parse_mail_out.pl' |
50 |
|
|
+LOGFILE='/var/log/qmail/current' |
51 |
|
|
+TMPDIR='/var/lib/zabbix/tmp/qmail' |
52 |
|
|
+ |
53 |
|
|
+/usr/bin/sudo -u qmaill $LOGTAIL $LOGFILE $TMPDIR/mailout.$WHAT.offset | $PARSER $WHAT |
54 |
|
|
+ |
55 |
|
|
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 |
56 |
|
|
--- smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl 1970-01-01 01:00:00.000000000 +0100 |
57 |
|
|
+++ mezzanine_patched_smeserver-zabbix-agent-0.1/root/var/lib/zabbix/bin/parse_mail_out.pl 2009-02-15 10:06:55.000000000 +0100 |
58 |
|
|
@@ -0,0 +1,70 @@ |
59 |
|
|
+#!/usr/bin/perl -w |
60 |
|
|
+ |
61 |
|
|
+# Copyright (C) 2009 Daniel Berteaud <daniel@firewall-services.com> |
62 |
|
|
+ |
63 |
|
|
+# This file is part of smeserver-zabbix-agent package. |
64 |
|
|
+ |
65 |
|
|
+# This script is free software; you can redistribute it and/or modify |
66 |
|
|
+# it under the terms of the GNU General Public License as published by |
67 |
|
|
+# the Free Software Foundation; either version 2 of the License, or |
68 |
|
|
+# (at your option) any later version. |
69 |
|
|
+ |
70 |
|
|
+# This script is distributed in the hope that it will be useful, |
71 |
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
72 |
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
73 |
|
|
+# GNU General Public License for more details. |
74 |
|
|
+ |
75 |
|
|
+# You should have received a copy of the GNU General Public License |
76 |
|
|
+# along with Foobar; if not, write to the Free Software |
77 |
|
|
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
78 |
|
|
+ |
79 |
|
|
+ |
80 |
|
|
+my $what = $ARGV[0] || ''; |
81 |
|
|
+ |
82 |
|
|
+# On initialise nos compteurs a 0 |
83 |
|
|
+my @results = qw(failure deferral success total); |
84 |
|
|
+my %cnt; |
85 |
|
|
+foreach (@results){ |
86 |
|
|
+ $cnt{$_} = 0; |
87 |
|
|
+} |
88 |
|
|
+ |
89 |
|
|
+while (<STDIN>) { |
90 |
|
|
+ my $line = $_; |
91 |
|
|
+ |
92 |
|
|
+ # on limites aux lignes concernant l'envoie |
93 |
|
|
+ # @400000004994ad092afa867c delivery 96906: success etc... |
94 |
|
|
+ next unless $line =~ m/^\@[0-9a-f]{24} delivery \d+: (success|failure|deferral)/; |
95 |
|
|
+ my $result = $1; |
96 |
|
|
+ $cnt{$result}++; |
97 |
|
|
+} |
98 |
|
|
+ |
99 |
|
|
+# Caclul des totaux: |
100 |
|
|
+foreach (@results){ |
101 |
|
|
+ $cnt{total} = $cnt{total} + $cnt{$_} if $_ !~ /total/; |
102 |
|
|
+} |
103 |
|
|
+ |
104 |
|
|
+# Si l'argument est "print" on affiche toutes les stats |
105 |
|
|
+if ($what eq "print"){ |
106 |
|
|
+ |
107 |
|
|
+ foreach (@results){ |
108 |
|
|
+ print "$_: $cnt{$_}\n"; |
109 |
|
|
+ } |
110 |
|
|
+} |
111 |
|
|
+ |
112 |
|
|
+# Si l'argument correspond a un compteur definit |
113 |
|
|
+# On affiche uniquemment cette valeur |
114 |
|
|
+elsif (defined $cnt{$what}){ |
115 |
|
|
+ print "$cnt{$what}\n"; |
116 |
|
|
+} |
117 |
|
|
+ |
118 |
|
|
+# Sinon, on quitte avec une erreur |
119 |
|
|
+else{ |
120 |
|
|
+ print "supported items are: "; |
121 |
|
|
+ foreach (@results){ |
122 |
|
|
+ print "$_ "; |
123 |
|
|
+ } |
124 |
|
|
+ print "\n"; |
125 |
|
|
+ exit 1; |
126 |
|
|
+} |
127 |
|
|
+exit 0; |
128 |
|
|
+ |