diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-03-19 04:00:18 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-03-19 04:00:18 -0400 |
commit | 85865c7c19157efdf9c402f97bd979ddde4e2c49 (patch) | |
tree | 0777c2f9b4d83f2c9eefa7b73abfd9a5be45dd59 /modules/munin | |
parent | b4d978865ac872991f9ca59781724b2988ee48c3 (diff) | |
download | puppet-tozt-85865c7c19157efdf9c402f97bd979ddde4e2c49.tar.gz puppet-tozt-85865c7c19157efdf9c402f97bd979ddde4e2c49.zip |
add munin plugin for counting number of processed mails
Diffstat (limited to 'modules/munin')
-rw-r--r-- | modules/munin/files/plugins/mail_count | 24 | ||||
-rw-r--r-- | modules/munin/manifests/mailu.pp | 9 |
2 files changed, 33 insertions, 0 deletions
diff --git a/modules/munin/files/plugins/mail_count b/modules/munin/files/plugins/mail_count new file mode 100644 index 0000000..99d3a2a --- /dev/null +++ b/modules/munin/files/plugins/mail_count @@ -0,0 +1,24 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.020; + +use JSON::PP; + +if (@ARGV > 0 && $ARGV[0] eq 'config') { + say "graph_title count of processed mails"; + say "graph_category mail"; + say "graph_vlabel count"; + say "graph_args -l 0"; + say "graph_scale no"; + + say "mailcount.label count of processed mails"; + exit 0; +} + +chdir "/media/persistent"; + +my $json = `docker-compose exec imap rspamc -h antispam:11334 stat --json --compact`; +my $data = decode_json($json); + +say "mailcount.value $data->{scanned}"; diff --git a/modules/munin/manifests/mailu.pp b/modules/munin/manifests/mailu.pp new file mode 100644 index 0000000..c7daba0 --- /dev/null +++ b/modules/munin/manifests/mailu.pp @@ -0,0 +1,9 @@ +class munin::mailu { + file { + "/usr/lib/munin/plugins/mail_count": + source => "puppet:///modules/munin/plugins/mail_count", + mode => "0755", + require => Package["munin-node"], + before => Service["munin-node"]; + } +} |