Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
centos:mail_c7:mta_13 [03.03.2015 13:44. ] – [3. Statistikgraphen und Webseite erzeugen] django | centos:mail_c7:mta_13 [18.11.2024 19:00. ] (aktuell) – Externe Bearbeitung 127.0.0.1 | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Mailserver - Logfileauswertungen unter CentOS 7.x ====== | ====== Mailserver - Logfileauswertungen unter CentOS 7.x ====== | ||
Oft werden vom Management hübsche bunte Auswertungsgraphiken gewünscht, um sich so mehr oder weniger ein Bild davon zu machen, ob und wie der/die Mailserver mit der anfallenden Menge an elektronischer Post umgehen können. | Oft werden vom Management hübsche bunte Auswertungsgraphiken gewünscht, um sich so mehr oder weniger ein Bild davon zu machen, ob und wie der/die Mailserver mit der anfallenden Menge an elektronischer Post umgehen können. | ||
- | Auch als Postmaster und Admin können wir uns so einen kurzen Überblick verschaffen, | + | Auch als Postmaster und Admin können wir uns so einen kurzen Überblick verschaffen, |
Im Detail wollen wir uns nun drei der Varianten genauer ansehen. | Im Detail wollen wir uns nun drei der Varianten genauer ansehen. | ||
- **[[centos: | - **[[centos: | ||
- | - **WEB-GUIs** Graphisch sehr ansprechende | + | - **WEB-GUIs** Graphisch sehr ansprechende |
- **[[centos: | - **[[centos: | ||
- **[[centos: | - **[[centos: | ||
Zeile 34: | Zeile 34: | ||
Build Host : vml000200.dmz.nausch.org | Build Host : vml000200.dmz.nausch.org | ||
Relocations : (not relocatable) | Relocations : (not relocatable) | ||
- | Packager | + | Packager |
Vendor | Vendor | ||
URL : http:// | URL : http:// | ||
Zeile 559: | Zeile 559: | ||
===== mailgraph ===== | ===== mailgraph ===== | ||
- | Eine ansprechende graphische Übersicht kann mittels [[http:// | + | Eine ansprechende graphische Übersicht kann mittels [[http:// |
Mailgraph besteht im wesentlichen aus zwei Teilen. Das eine perl-Script ist zuständig für das Durchsuchen und Analysieren des Mailserver-Logdatei. Die gewonnenen Daten werden in **rrd**-Datendateien geschrieben. Ein zweites Perl **cgi**-Script generiert dann beim Aufrufen der zugehörigen Webseite Graphiken mit den Daten der **rrd**-Dateien. | Mailgraph besteht im wesentlichen aus zwei Teilen. Das eine perl-Script ist zuständig für das Durchsuchen und Analysieren des Mailserver-Logdatei. Die gewonnenen Daten werden in **rrd**-Datendateien geschrieben. Ein zweites Perl **cgi**-Script generiert dann beim Aufrufen der zugehörigen Webseite Graphiken mit den Daten der **rrd**-Dateien. | ||
Zeile 583: | Zeile 583: | ||
Build Host : vml000200.dmz.nausch.org | Build Host : vml000200.dmz.nausch.org | ||
Relocations : (not relocatable) | Relocations : (not relocatable) | ||
- | Packager | + | Packager |
URL : http:// | URL : http:// | ||
Summary | Summary | ||
Zeile 878: | Zeile 878: | ||
AddHandler cgi-script .cgi | AddHandler cgi-script .cgi | ||
- | < | + | < |
- | AllowOverride None | + | AllowOverride None |
- | Options +ExecCGI | + | Options +ExecCGI |
- | DirectoryIndex mailgraph.cgi | + | DirectoryIndex mailgraph.cgi |
- | Order deny, | + | Order deny, |
- | require IP 10.0. | + | |
</ | </ | ||
ErrorLog logs/ | ErrorLog logs/ | ||
Zeile 978: | Zeile 978: | ||
Möchte man einen graphischen Überblick über die Queues haben, so liefert uns das gerade vorgestellte und installierte **Mailgraph** leider keine grafischen werte. Hierzu greifen wir auf das Programm **[[http:// | Möchte man einen graphischen Überblick über die Queues haben, so liefert uns das gerade vorgestellte und installierte **Mailgraph** leider keine grafischen werte. Hierzu greifen wir auf das Programm **[[http:// | ||
- | Das passende Programmpaket **queuegraph** installieren am einfachsten aus dem Repository **[[centos:mailserver.guru|mailserver.guru]]**. | + | Das passende Programmpaket **queuegraph** installieren am einfachsten aus dem Repository **[[centos:nausch.org|nausch.org]]**. |
==== Installation ==== | ==== Installation ==== | ||
Zeile 999: | Zeile 999: | ||
Build Host : vml000200.dmz.nausch.org | Build Host : vml000200.dmz.nausch.org | ||
Relocations : (not relocatable) | Relocations : (not relocatable) | ||
- | Packager | + | Packager |
URL : http:// | URL : http:// | ||
Summary | Summary | ||
Zeile 1374: | Zeile 1374: | ||
=== RPM-Installation === | === RPM-Installation === | ||
- | Die wohl einfachste Art ist die der RPM-basierten Installation. Das passende Paket **mailgraph** installieren wir aus dem Repository **[[centos:mailserver.guru|mailserver.guru]]**. Aktuell wird vom Paketmaintainer die [[http:// | + | Die wohl einfachste Art ist die der RPM-basierten Installation. Das passende Paket **mailgraph** installieren wir aus dem Repository **[[centos:nausch.org|nausch.org]]**. Aktuell wird vom Paketmaintainer die [[http:// |
- | Haben wir das Repository **[[centos:mailserver.guru|mailserver.guru]]** installiert, | + | Haben wir das Repository **[[centos:nausch.org|nausch.org]]** installiert, |
# yum install mailgraph | # yum install mailgraph | ||
Zeile 1381: | Zeile 1381: | ||
Will man die beiden Pakete "nur lokal" installieren verwendet man folgenden Aufruf. | Will man die beiden Pakete "nur lokal" installieren verwendet man folgenden Aufruf. | ||
- | # yum localinstall http:// | + | # yum localinstall http:// |
- | http:// | + | http:// |
=== manuelle Installation === | === manuelle Installation === | ||
Zeile 1430: | Zeile 1430: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# modified 2011 for queuegraph by Ralf Hildebrandt < | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
- | # modified 2015 for mailgraph-ng by Django <django@mailserver.guru> based on | + | # modified 2015 for mailgraph-ng by Django <django@nausch.org> based on |
# patches from Sebastian van de Meer < | # patches from Sebastian van de Meer < | ||
# released under the GNU General Public License | # released under the GNU General Public License | ||
Zeile 2135: | Zeile 2135: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</td> | </td> | ||
<td> | <td> | ||
Zeile 2294: | Zeile 2294: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# copyright (c) 2011 Markus Neubauer < | # copyright (c) 2011 Markus Neubauer < | ||
- | # copyright (c) 2014-2015 Django <django@mailserver.guru> | + | # copyright (c) 2014-2015 Django <django@nausch.org> |
# released under the GNU General Public License | # released under the GNU General Public License | ||
# with spf-, dkim-, dmarc, and dane-patch Sebastian van de Meer < | # with spf-, dkim-, dmarc, and dane-patch Sebastian van de Meer < | ||
Zeile 2780: | Zeile 2780: | ||
if($opt{version}) { | if($opt{version}) { | ||
- | print " | + | print " |
exit; | exit; | ||
} | } | ||
Zeile 3807: | Zeile 3807: | ||
So lassen sich z.B. auch die Reports zu **SPF**, **DKIM** und **DMARC** ausblenden, wenn man diese (aktuell noch) nicht haben möchte. Will man später die Graphen wieder sehen, reicht das Entfernen des Kommentarzeichens **#** am Anfang der betreffenden Zeilen. | So lassen sich z.B. auch die Reports zu **SPF**, **DKIM** und **DMARC** ausblenden, wenn man diese (aktuell noch) nicht haben möchte. Will man später die Graphen wieder sehen, reicht das Entfernen des Kommentarzeichens **#** am Anfang der betreffenden Zeilen. | ||
- | ==== (Summen-) Ausgabe | + | ===== Mailgraph-NG für mehrere Mailserver |
Betreibt man mehrere Mailserver will man neben den Einzelstatistiken der einzelnen Mailserver oft auch einen Überblick über den gesamten Mail-Server-Verkehr haben. | Betreibt man mehrere Mailserver will man neben den Einzelstatistiken der einzelnen Mailserver oft auch einen Überblick über den gesamten Mail-Server-Verkehr haben. | ||
Auch das lässt sich mit einem überschaubaren Aufwand realisieren. Hierzu gehen wir wie folgt vor. | Auch das lässt sich mit einem überschaubaren Aufwand realisieren. Hierzu gehen wir wie folgt vor. | ||
Zeile 3817: | Zeile 3817: | ||
Auf diese drei Schritte gehen wir nun im Detail noch ein. | Auf diese drei Schritte gehen wir nun im Detail noch ein. | ||
- | === 1. Daten einsammeln === | + | ==== RRD-Dateien |
Die einzelnen RRD-Dateien unserer Mailserver kopieren wir mit scp in ein temporäres Arbeitsverzeichnis unseres WEB-Servers. Hierzu legen wir uns erst einmal einen eigenen User an. | Die einzelnen RRD-Dateien unserer Mailserver kopieren wir mit scp in ein temporäres Arbeitsverzeichnis unseres WEB-Servers. Hierzu legen wir uns erst einmal einen eigenen User an. | ||
# groupadd -g 1100 mx-transfer && useradd -c "MX Transfer User" -d / | # groupadd -g 1100 mx-transfer && useradd -c "MX Transfer User" -d / | ||
Zeile 3961: | Zeile 3961: | ||
- | === 2. Daten bereitstellen | + | ==== Datenbereitstellung ==== |
Das CGI-Script, welches wir zum dynamischen Generieren der Statistikgraphen verwenden, bekommt im Verzeichnis // | Das CGI-Script, welches wir zum dynamischen Generieren der Statistikgraphen verwenden, bekommt im Verzeichnis // | ||
# mkdir -p / | # mkdir -p / | ||
- | Die Befüllung dieser Zeilverzeichnisse nehmen wir jeweils mit Hilfe eines **rsync**-Aufrufes | + | Die Befüllung dieser Zeilverzeichnisse nehmen wir jeweils mit Hilfe eines **rsync**-Aufrufs |
# vim / | # vim / | ||
Zeile 3985: | Zeile 3985: | ||
# Django : 2015-02-26 | # Django : 2015-02-26 | ||
- | # alles 5 Minuten die RRD-Files vom TRansfer-Verzeichnis | + | # alles 5 Minuten die RRD-Files vom Transfer-Verzeichnis |
*/5 * * * * root / | */5 * * * * root / | ||
*/5 * * * * root / | */5 * * * * root / | ||
Zeile 3994: | Zeile 3994: | ||
Nach wenigen Minuten stehen die Statistikdaten, | Nach wenigen Minuten stehen die Statistikdaten, | ||
- | === 3. Statistikgraphen und Webseite | + | ==== Generierung |
Zur Präsentation unserer Statistikdaten benötigen wir nun noch einen Webserver, der die aufbereiteten Daten bereitstellt. Hierzu legen wir uns folgende Verzeichnisstruktur an. | Zur Präsentation unserer Statistikdaten benötigen wir nun noch einen Webserver, der die aufbereiteten Daten bereitstellt. Hierzu legen wir uns folgende Verzeichnisstruktur an. | ||
< | < | ||
Zeile 4004: | Zeile 4004: | ||
</ | </ | ||
- | # mkdir -p / | + | # mkdir -p / |
- | Bei der **[[centos: | + | Bei der **[[centos: |
{{ : | {{ : | ||
body { width: 900px; background-color: | body { width: 900px; background-color: | ||
Zeile 4045: | Zeile 4045: | ||
# cp / | # cp / | ||
- | In den Unterverzeichnissen **mx11** bis **mx14** legen wir jeweils ein CGI-Script ab. Damit wir später zwischen den Einzelanzeigen der Mailserver und der kumulierten Übersicht jeweils wechseln können, versehen wir das Originalscript aus dem RPM **[[http:// | + | In den Unterverzeichnissen **mx11** bis **mx14** legen wir jeweils ein CGI-Script ab. Damit wir später zwischen den Einzelanzeigen der Mailserver und der kumulierten Übersicht jeweils wechseln können, versehen wir das Originalscript aus dem RPM **[[http:// |
Die wesentlichen Änderungen/ | Die wesentlichen Änderungen/ | ||
Zeile 4208: | Zeile 4208: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</td> | </td> | ||
<td> | <td> | ||
Zeile 4237: | Zeile 4237: | ||
</ | </ | ||
- | Somit ergeben sich folgende | + | ==== CGI-Scripte für die Einzelsysteme ==== |
+ | Für die vier Mailserver | ||
+ | |||
+ | === / | ||
# vim / | # vim / | ||
Zeile 4246: | Zeile 4249: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# modified 2011 for queuegraph by Ralf Hildebrandt < | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
- | # modified 2015 for mailgraph-ng by Django <django@mailserver.guru> based on | + | # modified 2015 for mailgraph-ng by Django <django@nausch.org> based on |
# patches from Sebastian van de Meer < | # patches from Sebastian van de Meer < | ||
# released under the GNU General Public License | # released under the GNU General Public License | ||
Zeile 5075: | Zeile 5078: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</ | </ | ||
< | < | ||
Zeile 5200: | Zeile 5203: | ||
main; | main; | ||
</ | </ | ||
+ | |||
+ | === / | ||
# vim / | # vim / | ||
Zeile 5208: | Zeile 5213: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# modified 2011 for queuegraph by Ralf Hildebrandt < | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
- | # modified 2015 for mailgraph-ng by Django <django@mailserver.guru> based on | + | # modified 2015 for mailgraph-ng by Django <django@nausch.org> based on |
# patches from Sebastian van de Meer < | # patches from Sebastian van de Meer < | ||
# released under the GNU General Public License | # released under the GNU General Public License | ||
Zeile 6037: | Zeile 6042: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</ | </ | ||
< | < | ||
Zeile 6162: | Zeile 6167: | ||
main; | main; | ||
</ | </ | ||
+ | |||
+ | === / | ||
# vim / | # vim / | ||
Zeile 6170: | Zeile 6177: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# modified 2011 for queuegraph by Ralf Hildebrandt < | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
- | # modified 2015 for mailgraph-ng by Django <django@mailserver.guru> based on | + | # modified 2015 for mailgraph-ng by Django <django@nausch.org> based on |
# patches from Sebastian van de Meer < | # patches from Sebastian van de Meer < | ||
# released under the GNU General Public License | # released under the GNU General Public License | ||
Zeile 6999: | Zeile 7006: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</ | </ | ||
< | < | ||
Zeile 7125: | Zeile 7132: | ||
</ | </ | ||
+ | === / | ||
# vim / | # vim / | ||
<file perl / | <file perl / | ||
Zeile 7132: | Zeile 7140: | ||
# copyright (c) 2000-2007 David Schweikert < | # copyright (c) 2000-2007 David Schweikert < | ||
# modified 2011 for queuegraph by Ralf Hildebrandt < | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
- | # modified 2015 for mailgraph-ng by Django <django@mailserver.guru> based on | + | # modified 2015 for mailgraph-ng by Django <django@nausch.org> based on |
# patches from Sebastian van de Meer < | # patches from Sebastian van de Meer < | ||
# released under the GNU General Public License | # released under the GNU General Public License | ||
Zeile 7961: | Zeile 7969: | ||
<td class=" | <td class=" | ||
<a href=" | <a href=" | ||
- | <a href=" | + | <a href=" |
</ | </ | ||
< | < | ||
Zeile 8087: | Zeile 8095: | ||
</ | </ | ||
+ | ==== CGI-Erweiterung für die Σ-Seite ==== | ||
+ | Wie auch schon bei den Einzelstatistiken sind bei der Σ-Seite, die die kumulierten Einzelgraphen enthält, umfangreichere Änderungen/ | ||
+ | === Datenquellen === | ||
+ | Da wir bei der Gesamtstatistik die Summe der einzelnen Mailserver zur Anzeige bringen wollen, benötigen wir daher auch alle Datenquellen. Die Anzahl der Variablen **$rrd_* ** erhöht sich daher entsprechend! | ||
+ | <code perl>... | ||
+ | my $rrd_11 | ||
+ | my $rrd_12 | ||
+ | my $rrd_13 | ||
+ | my $rrd_14 | ||
+ | my $rrd_virus_11 | ||
+ | my $rrd_virus_12 | ||
+ | my $rrd_virus_13 | ||
+ | my $rrd_virus_14 | ||
+ | my $rrd_grey_11 | ||
+ | my $rrd_grey_12 | ||
+ | my $rrd_grey_13 | ||
+ | my $rrd_grey_14 | ||
+ | my $rrd_dane_11 | ||
+ | my $rrd_dane_12 | ||
+ | my $rrd_dane_13 | ||
+ | my $rrd_dane_14 | ||
+ | my $rrd_dmarc_11 | ||
+ | my $rrd_dmarc_12 | ||
+ | my $rrd_dmarc_13 | ||
+ | my $rrd_dmarc_14 | ||
+ | my $rrd_smtpd_11 | ||
+ | my $rrd_smtpd_12 | ||
+ | my $rrd_smtpd_13 | ||
+ | my $rrd_smtpd_14 | ||
+ | my $rrd_queue_11 | ||
+ | my $rrd_queue_12 | ||
+ | my $rrd_queue_13 | ||
+ | my $rrd_queue_14 | ||
+ | my $rrd_post_11 | ||
+ | my $rrd_post_12 | ||
+ | my $rrd_post_13 | ||
+ | my $rrd_post_14 | ||
+ | ... | ||
+ | </ | ||
- | FIXME | + | === URL-Definitionen === |
+ | Damit die Seite bei Portierungen ohne große Änderungen im Code realisiert werden können, wird für die Querverweise jeweils zugehörige URL's definiert. | ||
+ | <code perl>... | ||
+ | my $url = " | ||
+ | my $urlg = " | ||
+ | my $url1 = " | ||
+ | my $url2 = " | ||
+ | my $url3 = " | ||
+ | my $url4 = " | ||
+ | my $url11 = " | ||
+ | my $url12 = " | ||
+ | my $url13 = " | ||
+ | my $url14 = " | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | === Unterprogramme graph_xxx - kumulierte Werte für die Generierung der RRD-Graphiken === | ||
+ | Bei der Generierung der kumulierten Graphiken stellt sich grundsätzlich die Frage, wie führt man den Inhalt mehrerer RRD-Dateien zusammen um einen Summengraph zu erstellen. Anstatt nun einen neue RRD-Datei mit dem Inhalt der vier einzelnen RRD-Dateien zu erstellen um daraus dann den Graphen zu generieren, wählen wir einen anderen Weg. Bei der Erstellung eines Summengraphen mit Hilfe von **RRD_GRAPH** bedienen wir uns nicht nur einer Quelle (RRD-Datei), | ||
+ | |||
+ | Dazu müssen wir im ersten Schritt **alle Datenquellen** beim RRD_GRAPH Parameter **DEF** benennen. Somit wird z.B. beim Graphen mit den nicht angenommenen Nachrichten **Rejected** statt der **beiden Zeilen** < | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | entsprechend **acht Zeilen** | ||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | Bei der Generierung der eigentlichen Graphen ziehen wir die **Summe der vier RRD-Dateien** heran, egal ob eine einfache Fläche, ein gestapelter Bereich oder ein Liniengraph erzeugt werden soll. Beim RRD_GRAPH Parameter **CDEF** lassen wir daher die Summe aus den Variablen // | ||
+ | |||
+ | Hierzu verwenden wir die //RRD_GRAPH eigene Berechnungssyntax// | ||
+ | |||
+ | Im Falle unseres Graphen über die Abgelehneten Nachrichten (**rejected**) berechnet sich die Gesamtsumme also wie folgt: \\ < | ||
+ | |||
+ | Daraus wird dann in der //RRD_GRAPH eigenen Berechnungssyntax//: | ||
+ | | ||
+ | |||
+ | Anstatt der ursprünglichen **CDEF**-Definitionen | ||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | verwenden wir also nachfolgende **CDEF**-Definitionen: | ||
+ | |||
+ | < | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | Diese Änderungen tragen wir nun bei den Unterprogrammen **graph_xxx** nach. | ||
+ | |||
+ | === Unterprogramm print_html | ||
+ | Wie auch schon bei den [[centos: | ||
+ | <code perl> | ||
+ | |||
+ | sub print_html() | ||
+ | { | ||
+ | print " | ||
+ | |||
+ | print << | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | <meta http-equiv=" | ||
+ | <link rel=" | ||
+ | </ | ||
+ | < | ||
+ | HEADER | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | for my $n (0..$# | ||
+ | print " | ||
+ | } | ||
+ | print "</ | ||
+ | |||
+ | for my $n (0..$# | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | } | ||
+ | |||
+ | print << | ||
+ | <hr/> | ||
+ | <table border=" | ||
+ | < | ||
+ | <col width=" | ||
+ | <col width=" | ||
+ | <col width=" | ||
+ | </ | ||
+ | < | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </td> | ||
+ | <td> | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </td> | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | </td> | ||
+ | </ | ||
+ | < | ||
+ | <td class=" | ||
+ | </td> | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </td> | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | FOOTER | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | |||
+ | === CGI-Script für die ∑-Auswertung === | ||
+ | Mit allen Änderungen und Erweiterungen ergibt sich dann folgendes Gesamt-CGI-Script: | ||
+ | # vim / | ||
+ | |||
+ | <file perl / | ||
+ | |||
+ | # mailgraph -- detailed postfix mail traffic statistics | ||
+ | # copyright (c) 2000-2007 ETH Zurich | ||
+ | # copyright (c) 2000-2007 David Schweikert < | ||
+ | # modified 2011 for queuegraph by Ralf Hildebrandt < | ||
+ | # modified 2015 for mailgraph-ng by Django < | ||
+ | # patches from Sebastian van de Meer < | ||
+ | # released under the GNU General Public License | ||
+ | |||
+ | use RRDs; | ||
+ | use POSIX qw(uname); | ||
+ | |||
+ | my $VERSION = " | ||
+ | |||
+ | my $host = (POSIX:: | ||
+ | my $scriptname = $ENV{" | ||
+ | my $xpoints | ||
+ | my $points_per_sample = 3; | ||
+ | my $ypoints | ||
+ | my $rrd_11 | ||
+ | my $rrd_12 | ||
+ | my $rrd_13 | ||
+ | my $rrd_14 | ||
+ | my $rrd_virus_11 | ||
+ | my $rrd_virus_12 | ||
+ | my $rrd_virus_13 | ||
+ | my $rrd_virus_14 | ||
+ | my $rrd_grey_11 | ||
+ | my $rrd_grey_12 | ||
+ | my $rrd_grey_13 | ||
+ | my $rrd_grey_14 | ||
+ | my $rrd_dane_11 | ||
+ | my $rrd_dane_12 | ||
+ | my $rrd_dane_13 | ||
+ | my $rrd_dane_14 | ||
+ | my $rrd_dmarc_11 | ||
+ | my $rrd_dmarc_12 | ||
+ | my $rrd_dmarc_13 | ||
+ | my $rrd_dmarc_14 | ||
+ | my $rrd_smtpd_11 | ||
+ | my $rrd_smtpd_12 | ||
+ | my $rrd_smtpd_13 | ||
+ | my $rrd_smtpd_14 | ||
+ | my $rrd_queue_11 | ||
+ | my $rrd_queue_12 | ||
+ | my $rrd_queue_13 | ||
+ | my $rrd_queue_14 | ||
+ | my $rrd_post_11 | ||
+ | my $rrd_post_12 | ||
+ | my $rrd_post_13 | ||
+ | my $rrd_post_14 | ||
+ | |||
+ | my $tmp_dir = '/ | ||
+ | my @graphs = ( | ||
+ | { title => ' | ||
+ | { title => ' | ||
+ | { title => ' | ||
+ | { title => ' | ||
+ | ); | ||
+ | |||
+ | my %color = ( # rrggbb in hex | ||
+ | # n | ||
+ | sent => ' | ||
+ | received | ||
+ | |||
+ | bounced | ||
+ | virus => ' | ||
+ | spam => ' | ||
+ | rejected | ||
+ | |||
+ | greylisted | ||
+ | delayed | ||
+ | whitelist | ||
+ | awl => ' | ||
+ | early => ' | ||
+ | |||
+ | pswl => ' | ||
+ | psbl => ' | ||
+ | passold | ||
+ | veto => ' | ||
+ | pregreet | ||
+ | dnsbl => ' | ||
+ | pipelining | ||
+ | nonsmtp | ||
+ | barenewline | ||
+ | command | ||
+ | hangup | ||
+ | passnew | ||
+ | |||
+ | new => ' | ||
+ | reconnectok | ||
+ | |||
+ | active | ||
+ | deferred | ||
+ | |||
+ | untrustedtls | ||
+ | anonymoustls | ||
+ | trustedtls | ||
+ | verifiedtls | ||
+ | |||
+ | untrustedtlsin | ||
+ | anonymoustlsin | ||
+ | trustedtlsin | ||
+ | |||
+ | spfnone | ||
+ | spffail | ||
+ | spfpass | ||
+ | |||
+ | dkimnone | ||
+ | dkimfail | ||
+ | dkimpass | ||
+ | |||
+ | dmarcnone | ||
+ | dmarcfail | ||
+ | dmarcpass | ||
+ | ); | ||
+ | |||
+ | my $url = " | ||
+ | my $url1 = " | ||
+ | my $url2 = " | ||
+ | my $url3 = " | ||
+ | my $url4 = " | ||
+ | my $url11 | ||
+ | my $url12 | ||
+ | my $url13 | ||
+ | my $url14 | ||
+ | |||
+ | sub rrd_graph(@) | ||
+ | { | ||
+ | my ($range, $file, $ypoints, @rrdargs) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | my $end = time; $end -= $end % $step; | ||
+ | my $date = localtime(time); | ||
+ | $date =~ s|:|\\:|g unless $RRDs:: | ||
+ | |||
+ | my ($graphret, | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | $RRDs:: | ||
+ | |||
+ | @rrdargs, | ||
+ | |||
+ | ' | ||
+ | ); | ||
+ | |||
+ | my $ERR=RRDs:: | ||
+ | die " | ||
+ | } | ||
+ | |||
+ | sub graph($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | sub graph_virus($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | sub graph_greylist($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | sub graph_greystats($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | |||
+ | ); | ||
+ | } | ||
+ | |||
+ | sub graph_postscreen($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | sub graph_postscreenstats($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | sub graph_dane($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | sub graph_smtpd($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | sub graph_spf($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | sub graph_dkim($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | sub graph_dmarc($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | sub graph_queue($$) | ||
+ | { | ||
+ | my ($range, $file) = @_; | ||
+ | my $step = $range*$points_per_sample/ | ||
+ | rrd_graph($range, | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | sub print_html() | ||
+ | { | ||
+ | print " | ||
+ | |||
+ | print << | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | < | ||
+ | <meta http-equiv=" | ||
+ | <meta http-equiv=" | ||
+ | <link rel=" | ||
+ | </ | ||
+ | < | ||
+ | HEADER | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | for my $n (0..$# | ||
+ | print " | ||
+ | } | ||
+ | print "</ | ||
+ | |||
+ | for my $n (0..$# | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | | ||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | |||
+ | print "< | ||
+ | print "< | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "<a href=' | ||
+ | print "< | ||
+ | } | ||
+ | |||
+ | print << | ||
+ | < | ||
+ | <table border=" | ||
+ | < | ||
+ | <col width=" | ||
+ | <col width=" | ||
+ | <col width=" | ||
+ | </ | ||
+ | < | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | < | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | <td class=" | ||
+ | </ | ||
+ | <td class=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | <a href=" | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | FOOTER | ||
+ | } | ||
+ | |||
+ | sub send_image($) | ||
+ | { | ||
+ | my ($file)= @_; | ||
+ | |||
+ | -r $file or do { | ||
+ | print " | ||
+ | exit 1; | ||
+ | }; | ||
+ | |||
+ | print " | ||
+ | print " | ||
+ | print " | ||
+ | open(IMG, $file) or die; | ||
+ | my $data; | ||
+ | print $data while read(IMG, $data, 16384)> | ||
+ | } | ||
+ | |||
+ | sub main() | ||
+ | { | ||
+ | my $uri = $ENV{REQUEST_URI} || ''; | ||
+ | $uri =~ s/ | ||
+ | $uri =~ s/ | ||
+ | $uri =~ s/ | ||
+ | mkdir $tmp_dir, 0777 unless -d $tmp_dir; | ||
+ | mkdir " | ||
+ | |||
+ | my $img = $ENV{QUERY_STRING}; | ||
+ | if(defined $img and $img =~ /\S/) { | ||
+ | if($img =~ / | ||
+ | my $file = " | ||
+ | graph($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_virus($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_greylist($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_greystats($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_postscreen($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_postscreenstats($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_queue($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_dane($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_smtpd($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_spf($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_dkim($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | elsif($img =~ / | ||
+ | my $file = " | ||
+ | graph_dmarc($graphs[$1]{seconds}, | ||
+ | send_image($file); | ||
+ | } | ||
+ | else { | ||
+ | die " | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | print_html; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | main; | ||
+ | </ | ||
+ | |||
+ | ==== Apache VHost anlegen ==== | ||
+ | Damit wir bequem von unserem Browser aus, die aktuellen Graphiken abfragen können, bearbeiten wir entweder die aus dem RPM stammende Konfigurationsdatei oder legen wir nun einen passenden VHost an. | ||
+ | # vim / | ||
+ | <file apache / | ||
+ | # | ||
+ | # mailgraph.nausch.org | ||
+ | # | ||
+ | < | ||
+ | ServerAdmin webmaster@nausch.org | ||
+ | ServerName mailgraph.nausch.org | ||
+ | ServerAlias www.mailgraph.nausch.org | ||
+ | ServerPath / | ||
+ | DocumentRoot "/ | ||
+ | AddHandler cgi-script .cgi | ||
+ | |||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI | ||
+ | DirectoryIndex mailgraph.cgi | ||
+ | require IP 10.0. | ||
+ | </ | ||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI | ||
+ | DirectoryIndex mailgraph.cgi | ||
+ | require IP 10.0. | ||
+ | </ | ||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI | ||
+ | DirectoryIndex mailgraph.cgi | ||
+ | require IP 10.0. | ||
+ | </ | ||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI | ||
+ | DirectoryIndex mailgraph.cgi | ||
+ | require IP 10.0. | ||
+ | </ | ||
+ | < | ||
+ | AllowOverride None | ||
+ | Options +ExecCGI | ||
+ | DirectoryIndex mailgraph.cgi | ||
+ | require IP 10.0. | ||
+ | </ | ||
+ | |||
+ | ErrorLog logs/ | ||
+ | CustomLog logs/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | Bevor wir bei unserem Webserver eine Reload der Konfiguration vornehmen, testen wir unsere neue Konfigurationsdatei auf syntaktische Fehler. | ||
+ | # apachectl -t | ||
+ | |||
+ | | ||
+ | |||
+ | Da keine Fehler aufgetreten sind, aktivieren wir die neue Konfiguration durch einen Reload des Webserver-Daemon. | ||
+ | # systemctl reload postfix | ||
+ | |||
+ | ==== NGiNX vHost anlegen ==== | ||
+ | Nutzen wir als Webserver **[[centos: | ||
+ | # vim / | ||
+ | <file http / | ||
+ | listen | ||
+ | server_name | ||
+ | access_log | ||
+ | error_log | ||
+ | |||
+ | root / | ||
+ | index mailgraph.cgi; | ||
+ | |||
+ | | ||
+ | fastcgi_split_path_info ^(.+\.cgi)(/ | ||
+ | fastcgi_index mailgraph.cgi; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | include fastcgi_params; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Den Parameter **fastcgi_pass** setzen wir im übrigen auf den Wert aus der Konfigurationsdatei // | ||
+ | |||
+ | Haben wir die Konfigurationsdatei vervollständigt, | ||
+ | # nginx -t | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | Somit können wir unsere Konfiguration nun noch aktivieren. | ||
+ | # systemctl reload nginx | ||
+ | |||
+ | ==== Webaufruf ==== | ||
+ | Rufen wir nun die definierte Webseite unserer Gesamtstatistikübersicht auf, erhalten wir nachfolgende Ansicht. | ||
+ | {{ : | ||
+ | Hier können wir nun gezielt einzelne Systeme auswählen, bzw. bei einer ausgewählten Detailstatistikseite zur Summenseite hin und her wechseln. | ||
===== AWStats ===== | ===== AWStats ===== | ||
Auch mit Hilfe des Projektes/ | Auch mit Hilfe des Projektes/ | ||
Zeile 9949: | Zeile 11559: | ||
* **[[wiki: | * **[[wiki: | ||
* **[[http:// | * **[[http:// | ||
- | |||
- | |||
- | |||
- | |||