On 02/10/14 01:36, Guenther Niess wrote:
> I hopefully fixed the patch.

Sorry, the patch below fixes some escaping errors and typos.


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 01:14:40 -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_ opensmtpd_delivery opensmtpd_mails \
+                       opensmtpd_queue_cache opensmtpd_sessions \
+                       opensmtpd_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 01:14:40 -0000
@@ -5,3 +5,6 @@

 #[postfix_mailqueue]
 #user _postfix
+
+[opensmtpd_*]
+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 01:14:40 -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/opensmtpd_delivery
+libexec/munin/plugins/opensmtpd_mails
+libexec/munin/plugins/opensmtpd_queue_cache
+libexec/munin/plugins/opensmtpd_sessions
+libexec/munin/plugins/opensmtpd_sessions_created
 libexec/munin/plugins/openvpn
 libexec/munin/plugins/perdition
 libexec/munin/plugins/pf_changes
--- /dev/null   Mon Feb 10 02:15:11 2014
+++ files/opensmtpd_delivery    Mon Feb 10 01:56:41 2014
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTPD 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 OpenSMTPD Mail delivery"
+       echo "graph_vlabel mails / second"
+       echo "graph_category mail"
+       echo "graph_args --lower-limit 0"
+       echo "graph_info OpenSMTPD 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 02:15:17 2014
+++ files/opensmtpd_mails       Mon Feb 10 01:56:41 2014
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTPD 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 OpenSMTPD Mails"
+       echo "graph_vlabel mails / second"
+       echo "graph_category mail"
+       echo "graph_args --lower-limit 0"
+       echo "graph_info OpenSMTPD 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 02:15:25 2014
+++ files/opensmtpd_queue_cache Mon Feb 10 01:56:41 2014
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTPD 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 OpenSMTPD Queue Cache"
+       echo "graph_vlabel mails / second"
+       echo "graph_category mail"
+       echo "graph_args --lower-limit 0"
+       echo "graph_info OpenSMTPD 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 02:15:33 2014
+++ files/opensmtpd_sessions    Mon Feb 10 01:56:41 2014
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Script to monitor OpenSMTPD 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 OpenSMTPD Sessions"
+       echo "graph_vlabel sessions"
+       echo "graph_category mail"
+       echo "graph_args --lower-limit 0"
+       echo "graph_info OpenSMTPD 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 02:15:37 2014
+++ files/opensmtpd_sessions_created    Mon Feb 10 01:56:41 2014
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Script to monitor new OpenSMTPD 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 OpenSMTPD Sessions Created"
+       echo "graph_vlabel sessions created / second"
+       echo "graph_category mail"
+       echo "graph_args --lower-limit 0"
+       echo "graph_info OpenSMTPD 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