Skip to content

schweikert email plotting script converted to psgi

License

Notifications You must be signed in to change notification settings

starlilyth/mailgraph-psgi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

      -----------------------------------------------------
      mailgraph - a RRDtool frontend for Postfix Statistics
      by David Schweikert <david@schweikert.ch>
      -----------------------------------------------------

mailgraph is a very simple mail statistics RRDtool frontend for Postfix
that produces daily, weekly, monthly and yearly graphs of received/sent 
and bounced/rejected mail (SMTP traffic).

Originally from:

   http://mailgraph.schweikert.ch/
	 ===============================

This PSGI version available from: https://github.com/starlilyth/mailgraph-psgi


Required Modules
----------------

- rrdtool and it's perl module (RRDs)
  -> http://oss.oetiker.ch/rrdtool/

- File::Tail

- Parse::Syslog

- Plack::Request

Note that several Linux distributions will already have these modules as packages
(e.g. 'perl-Plack').


Usage
-----

mailgraph is made of two scripts:

- mailgraph.pl

  This script parses syslog (or maillog) and updates the RRD databases.

  It is a deamon and will monitor your logfile for changes.
  DO NOT RUN IT WITH CRON!

  usage: mailgraph.pl [*options*]
  
  -h, --help         display this help and exit
  -v, --verbose      be verbose about what you do
  -V, --version      output version information and exit
  -c, --cat          causes the logfile to be only read and not monitored
  -l, --logfile f    monitor logfile f instead of /var/log/syslog
  -y, --year         starting year of the log file (default: current year)
      --host=HOST    use only entries for HOST (regexp) in syslog
  -d, --daemon       start in the background
  --daemon-pid=FILE  write PID to FILE instead of /var/run/mailgraph.pid
  --daemon-rrd=DIR   write RRDs to DIR instead of /var/log
  --daemon-log=FILE  write verbose-log to FILE instead of /var/log/mailgraph.log
  --ignore-localhost ignore mail to/from localhost (used for virus scanner)\n";
  
  If -c is not specified, mailgraph will monitor logfile for Postfix log entries
  in logfile (/var/log/syslog unless -l is specified).

- mailgraph.psgi

  This is a standalone psgi app that generates graphics from the RRD database and
  writes the HTML page.

  Change $rrd_dir to point to where the RRD databases are if you are not using the
  default location.

  Note that "Bounced", "Viruses", and "Spam" are stacked one on another in the
  graph, whereas "Rejected" is a line.


Installation
------------
Make sure the rrd directory (/var/log/mailgraph by default) exists.

See the file mailgraph.service for an example systemd script that you can use to
start mailgraph.pl at system boot.

You can serve mailgraph.psgi to a web server with an app server like Nginx Unit,
Starman, or just plackup.

License
-------

mailgraph is released under the GPL license. See the file COPYING included in
the distribution for details.

About

schweikert email plotting script converted to psgi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Perl 100.0%