summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-03-19 04:00:18 -0400
committerJesse Luehrs <doy@tozt.net>2019-03-19 04:00:18 -0400
commit85865c7c19157efdf9c402f97bd979ddde4e2c49 (patch)
tree0777c2f9b4d83f2c9eefa7b73abfd9a5be45dd59 /modules
parentb4d978865ac872991f9ca59781724b2988ee48c3 (diff)
downloadpuppet-tozt-85865c7c19157efdf9c402f97bd979ddde4e2c49.tar.gz
puppet-tozt-85865c7c19157efdf9c402f97bd979ddde4e2c49.zip
add munin plugin for counting number of processed mails
Diffstat (limited to 'modules')
-rw-r--r--modules/munin/files/plugins/mail_count24
-rw-r--r--modules/munin/manifests/mailu.pp9
-rw-r--r--modules/tozt/manifests/monitoring.pp7
3 files changed, 40 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"];
+ }
+}
diff --git a/modules/tozt/manifests/monitoring.pp b/modules/tozt/manifests/monitoring.pp
index d6a4af3..3f75cf7 100644
--- a/modules/tozt/manifests/monitoring.pp
+++ b/modules/tozt/manifests/monitoring.pp
@@ -4,6 +4,7 @@ class tozt::monitoring {
include munin::tarsnap
include munin::archlinux
include munin::certbot
+ include munin::mailu
file { "/etc/munin/plugin-conf.d/tozt":
source => "puppet:///modules/tozt/munin-plugin-conf",
@@ -80,4 +81,10 @@ class tozt::monitoring {
'certbot',
]:
}
+
+ munin::plugin {
+ [
+ 'mail_count',
+ ]:
+ }
}