On 10.02.2014 00:17, Stuart Henderson wrote:
> On 2014/02/10 00:06, Guenther Niess wrote:
>> Any comments are welcome.
> 
> OpenSMTP isn't OpenBSD-only - could you try getting these added
> upstream please?
> 
> btw there are several "STMP" typos, and there should be a license
> grant alongside the copyright line (/usr/share/misc/license.template if
> you want the usual one used for OpenBSD).
> 

Thanks for your quick and helpful response. I hopefully fixed the patch.
Would you recommend to ask on the [email protected] mailing list if the
used values for monitoring are adequate or should I try to get it
upstream anyway?


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/munin/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- Makefile    15 Jan 2014 08:24:25 -0000      1.37
+++ Makefile    10 Feb 2014 00:08:36 -0000
@@ -62,7 +62,9 @@ FAKE_FLAGS +=         HTMLDIR=${WRKINST}/${PREF
                        CONFDIR=${WRKINST}/${PREFIX}/share/examples/munin

 MUNIN_PLUGINS =                bgpd if_pps_ intr pf_changes pf_searches 
pf_states \
-                       sensors_ vmstat
+                       sensors_ opensmtp_delivery opensmtp_mails \
+                       opensmtp_queue_cache opensmtp_sessions \
+                       opensmtp_sessions_created vmstat

 .for i in ${MUNIN_PLUGINS}
 SUBST_LIST += ${FILESDIR}/$i ${WRKSRC}/plugins/node.d.openbsd/$i.in
Index: files/openbsd-packages
===================================================================
RCS file: /cvs/ports/net/munin/files/openbsd-packages,v
retrieving revision 1.3
diff -u -p -r1.3 openbsd-packages
--- files/openbsd-packages      21 Jan 2010 20:59:30 -0000      1.3
+++ files/openbsd-packages      10 Feb 2014 00:08:36 -0000
@@ -5,3 +5,6 @@

 #[postfix_mailqueue]
 #user _postfix
+
+[opensmtp_*]
+user root
Index: pkg/PLIST-main
===================================================================
RCS file: /cvs/ports/net/munin/pkg/PLIST-main,v
retrieving revision 1.14
diff -u -p -r1.14 PLIST-main
--- pkg/PLIST-main      3 Jun 2013 19:45:32 -0000       1.14
+++ pkg/PLIST-main      10 Feb 2014 00:08:36 -0000
@@ -163,6 +163,11 @@ libexec/munin/plugins/nut_volts
 libexec/munin/plugins/nutups_
 @comment libexec/munin/plugins/nvidia_
 libexec/munin/plugins/open_files
+libexec/munin/plugins/opensmtp_delivery
+libexec/munin/plugins/opensmtp_mails
+libexec/munin/plugins/opensmtp_queue_cache
+libexec/munin/plugins/opensmtp_sessions
+libexec/munin/plugins/opensmtp_sessions_created
 libexec/munin/plugins/openvpn
 libexec/munin/plugins/perdition
 libexec/munin/plugins/pf_changes
--- /dev/null   Mon Feb 10 01:08:43 2014
+++ files/opensmtp_delivery     Mon Feb 10 00:59:41 2014
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTP mail delivery
+# (c) 2014 Guenther Niess <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#      suggest  (optional - used by munin-config)
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+smtpctl=`which smtpctl`
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x ${smtpctl} ]; then
+               echo yes
+               exit 0
+       else
+               echo no (smtpctl is not executable)
+               exit 1
+       fi
+fi
+
+if [ "$1" = "suggest" ]; then
+       exit 0
+fi
+
+if [ "$1" = "config" ]; then
+       echo graph_title OpenSMTP Mail delivery
+       echo graph_vlabel mails / second
+       echo graph_category mail
+       echo graph_args --lower-limit 0
+       echo graph_info OpenSMTP mail delivery plugin
+       echo ok.label ok
+       echo ok.type DERIVE
+       echo ok.min 0
+       echo tempfail.label tempfail
+       echo tempfail.type DERIVE
+       echo tempfail.min 0
+       echo permfail.label permfail
+       echo permfail.type DERIVE
+       echo permfail.min 0
+       echo loop.label loop
+       echo loop.type DERIVE
+       echo loop.min 0
+fi
+
+${smtpctl} show stats | awk -F'=' '
+BEGIN {
+  ok=0;
+  permfail=0;
+  tempfail=0;
+  loop=0;
+}
+/^scheduler.delivery.loop=/{loop=$2;}
+/^scheduler.delivery.permfail=/{permfail=$2;}
+/^scheduler.delivery.tempfail=/{tempfail=$2;}
+/^scheduler.delivery.ok=/{ok=$2;}
+END {
+  print "ok.value", ok
+  print "tempfail.value", tempfail
+  print "permfail.value", permfail
+  print "loop.value", loop
+}
+'
--- /dev/null   Mon Feb 10 01:08:50 2014
+++ files/opensmtp_mails        Mon Feb 10 00:59:41 2014
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTP mail statistics
+# (c) 2014 Guenther Niess <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#      suggest  (optional - used by munin-config)
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+smtpctl=`which smtpctl`
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x ${smtpctl} ]; then
+               echo yes
+               exit 0
+       else
+               echo no (smtpctl is not executable)
+               exit 1
+       fi
+fi
+
+if [ "$1" = "suggest" ]; then
+       exit 0
+fi
+
+if [ "$1" = "config" ]; then
+       echo graph_title OpenSMTP Mails
+       echo graph_vlabel mails / second
+       echo graph_category mail
+       echo graph_args --lower-limit 0
+       echo graph_info OpenSMTP mail plugin
+       echo delivered.label delivered
+       echo delivered.type DERIVE
+       echo delivered.min 0
+       echo expired.label expired
+       echo expired.type DERIVE
+       echo expired.min 0
+       echo removed.label removed
+       echo removed.type DERIVE
+       echo removed.min 0
+       echo bounced.label bounced
+       echo bounced.type DERIVE
+       echo bounced.min 0
+fi
+
+${smtpctl} show stats | awk -F'=' '
+BEGIN {
+  delivered=0;
+  expired=0;
+  removed=0;
+  bounced=0;
+}
+/^scheduler.delivery.ok=/{delivered=$2;}
+/^scheduler.envelope.expired=/{expired=$2;}
+/^scheduler.envelope.removed=/{removed=$2;}
+/^queue.bounce=/{bounced=$2;}
+END {
+  print "delivered.value", delivered
+  print "expired.value", expired
+  print "removed.value", removed
+  print "bounced.value", bounced
+}
+'
--- /dev/null   Mon Feb 10 01:08:57 2014
+++ files/opensmtp_queue_cache  Mon Feb 10 00:59:41 2014
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTP queue cache
+# (c) 2014 Guenther Niess <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#      suggest  (optional - used by munin-config)
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+smtpctl=`which smtpctl`
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x ${smtpctl} ]; then
+               echo yes
+               exit 0
+       else
+               echo no (smtpctl is not executable)
+               exit 1
+       fi
+fi
+
+if [ "$1" = "suggest" ]; then
+       exit 0
+fi
+
+if [ "$1" = "config" ]; then
+       echo graph_title OpenSMTP Queue Cache
+       echo graph_vlabel mails / second
+       echo graph_category mail
+       echo graph_args --lower-limit 0
+       echo graph_info OpenSMTP queue cache plugin
+       echo hit.label hit
+       echo hit.type DERIVE
+       echo hit.min 0
+       echo missed.label miss
+       echo missed.type DERIVE
+       echo missed.min 0
+fi
+
+${smtpctl} show stats | awk -F'=' '
+BEGIN {
+  hit=0;
+  missed=0;
+}
+/^queue.evpcache.load.hit=/{hit=$2;}
+/^queue.evpcache.load.missed=/{missed=$2;}
+END {
+  print "hit.value", hit
+  print "missed.value", missed
+}
+'
--- /dev/null   Mon Feb 10 01:09:03 2014
+++ files/opensmtp_sessions     Mon Feb 10 00:59:41 2014
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTP sessions
+# (c) 2014 Guenther Niess <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#      suggest  (optional - used by munin-config)
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+smtpctl=`which smtpctl`
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x ${smtpctl} ]; then
+               echo yes
+               exit 0
+       else
+               echo no (smtpctl is not executable)
+               exit 1
+       fi
+fi
+
+if [ "$1" = "suggest" ]; then
+       exit 0
+fi
+
+if [ "$1" = "config" ]; then
+       echo graph_title OpenSMTP Sessions
+       echo graph_vlabel sessions
+       echo graph_category mail
+       echo graph_args --lower-limit 0
+       echo graph_info OpenSMTP session plugin
+       echo session.label sessions
+fi
+
+${smtpctl} show stats | awk -F'=' '
+BEGIN {
+  session=0;
+}
+/^smtp.session=/{session=$2;}
+END {
+  print "session.value", session
+}
+'
--- /dev/null   Mon Feb 10 01:09:09 2014
+++ files/opensmtp_sessions_created     Mon Feb 10 00:59:41 2014
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Script to monitor new OpenSMTP sessions
+# (c) 2014 Guenther Niess <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+# Parameters:
+#
+#      config   (required)
+#      autoconf (optional - used by munin-config)
+#      suggest  (optional - used by munin-config)
+#
+#%# family=auto
+#%# capabilities=autoconf
+
+smtpctl=`which smtpctl`
+
+if [ "$1" = "autoconf" ]; then
+       if [ -x ${smtpctl} ]; then
+               echo yes
+               exit 0
+       else
+               echo no (smtpctl is not executable)
+               exit 1
+       fi
+fi
+
+if [ "$1" = "suggest" ]; then
+       exit 0
+fi
+
+if [ "$1" = "config" ]; then
+       echo graph_title OpenSMTP Sessions Created
+       echo graph_vlabel sessions created / second
+       echo graph_category mail
+       echo graph_args --lower-limit 0
+       echo graph_info OpenSMTP sessions created
+       echo local.label local sessions
+       echo local.type DERIVE
+       echo local.min 0
+       echo ipv4.label IPv4 sessions
+       echo ipv4.type DERIVE
+       echo ipv4.min 0
+       echo ipv6.label IPv6 sessions
+       echo ipv6.type DERIVE
+       echo ipv6.min 0
+fi
+
+${smtpctl} show stats | awk -F'=' '
+BEGIN {
+  local=0;
+  ipv4=0;
+  ipv6=0;
+}
+/^smtp.session.local=/{local=$2;}
+/^smtp.session.inet4=/{ipv4=$2;}
+/^smtp.session.inet6=/{ipv6=$2;}
+END {
+  print "local.value", local
+  print "ipv4.value", ipv4
+  print "ipv6.value", ipv6
+}
+'

Reply via email to