--- _orig/net/nagios-plugins/Portfile	2014-01-19 00:30:38.000000000 -0500
+++ net/nagios-plugins/Portfile	2014-07-20 14:47:06.000000000 -0400
@@ -1,82 +1,145 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # $Id: Portfile 116135 2014-01-19 05:12:46Z jmr@macports.org $
 
-PortSystem	1.0
-PortGroup		perl5 1.0
+PortSystem          1.0
+PortGroup           perl5 1.0
 
-name			nagios-plugins
-version			1.4.15
-revision        4
-categories		net
-license			GPL-3+
-maintainers		markd openmaintainer
-platforms		darwin
-
-description		Nagios plugins for the Nagios host and service monitor
-
-long_description	Nagios plugins are standalone programs that report the \
-			status of hosts and services to the Nagios monitoring \
-			framework.
-
-homepage		http://nagios.org
-master_sites		sourceforge:nagiosplug
-checksums		md5 56abd6ade8aa860b38c4ca4a6ac5ab0d
-patchfiles		patch-plugins-check_procs.c.diff
-
-perl5.branches 5.12
-
-destroot.destdir        prefix=${prefix} DESTDIR=${destroot}
-
-depends_build		port:fping \
-			port:p5.12-net-snmp \
-			port:p5.12-digest-sha1 \
-			port:p5.12-digest-hmac \
-			port:p5.12-crypt-des \
-			port:openssl
-
-configure.args		--sbindir=${prefix}/share/nagios/cgi-bin \
-			--libexecdir=${prefix}/libexec/nagios \
-			--datadir=${prefix}/share/nagios \
-			--sysconfdir=${prefix}/etc/nagios \
-			--with-df-command="/bin/df -Pkt noprocfs" \
-			--with-trusted-path=${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin \
-			--with-openssl=${prefix}/bin \
-			--without-mysql \
-			--without-pgsql \
-			--without-radius \
-			--without-lmstat \
-			--without-qstat \
-			--without-qmail-qstat \
-			--with-ps-command="/bin/ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'" \
-			--with-ps-format="%s %d %d %d %d %d %f %s %n" \
-			--with-ps-cols=9 \
-			--with-ps-varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos"
+name                nagios-plugins
+version             2.0.3
+categories          net
+license             GPL-3+
+maintainers         markd openmaintainer
+platforms           darwin
+
+description         Nagios plugins for the Nagios host and service monitor
+
+long_description    Nagios plugins are standalone programs that report the \
+                    status of hosts and services to the Nagios monitoring \
+                    framework.
+
+homepage            http://www.nagios.org/projects/nagiosplugins
+master_sites        http://nagios-plugins.org/download/
+checksums           rmd160  b682b126c78df51f64d9cb8599d2f9dfd411d5f4 \
+                    sha256  8f0021442dce0138f0285ca22960b870662e28ae8973d49d439463588aada04a
+
+destroot.destdir    prefix=${prefix} DESTDIR=${destroot}
+
+depends_build       port:fping port:openssl
+depends_lib         port:openssl port:cyrus-sasl2 port:gettext \
+                    port:libiconv port:openldap
+
+configure.args        --sbindir=${prefix}/share/nagios/cgi-bin \
+            --libexecdir=${prefix}/libexec/nagios \
+            --datadir=${prefix}/share/nagios \
+            --sysconfdir=${prefix}/etc/nagios \
+            --with-trusted-path=${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin \
+            --with-openssl=${prefix}/bin \
+            --without-mysql \
+            --without-pgsql \
+            --without-radius \
+            --with-ps-command="/bin/ps -axwo 'stat uid pid ppid vsz rss pcpu ucomm command'" \
+            --with-ps-format="%s %d %d %d %d %d %f %s %n" \
+            --with-ps-cols=9 \
+            --with-ps-varlist="procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos" \
+            --with-mailq-command="/usr/bin/mailq" \
+            --with-ipv6
 
-variant mysql5 {
+variant mysql5 description { Bind to Mysql5 } conflicts mysql4 {
         depends_lib-append path:bin/mysql_config5:mysql5
         configure.args-delete --without-mysql
         configure.args-append --with-mysql=${prefix}/lib/mysql5
+
+notes-append "
+You are encouraged to use a dedicated mysql user for monitoring purpose as stated here
+https://dev.mysql.com/doc/mysql-monitor/2.3/en/mem-agent-rights.html
+http://www.it-slav.net/blogs/2009/04/06/mysql-performance-monitoring-with-nagios-or-op5-monitor/
+Usually, it's enough to:
+    mysql> grant usage on *.* to nagios@localhost identified by '<your-password>';
+"
 }
 
-variant mysql4 {
+variant mysql4 description { Bind to Mysql4 } conflicts mysql5 {
         depends_lib-append port:mysql4
         configure.args-delete --without-mysql
         configure.args-append --with-mysql=${prefix}
 }
 
-variant qstat {
+variant pgsql93 description { Bind to PostgreSQL 9.3 } {
+        depends_lib-append port:postgresql93
+        configure.args-delete --without-pgsql
+        configure.args-append --with-pgsql=${prefix}/bin
+}
+variant qstat description { plugin for qstat } {
         depends_lib-append port:qstat
         configure.args-delete --without-qstat
         configure.args-append --with-qstat=${prefix}/bin
 }
 
+## FIXME! not working
+variant gnutls description { plugin for gnutls } {
+        depends_lib-append port:gnutls
+        configure.args-delete --without-gnutls
+        configure.args-append --with-gnutls=${prefix}/bin
+}
+
 post-extract {
 # Replace check_nt with the enhanced one from www.shatterit.com/nc_net/files that supports NC_Net Win client
-	file copy -force ${filespath}/check_nt.c ${worksrcpath}/plugins
+    file copy -force ${filespath}/check_nt.c ${worksrcpath}/plugins
 }
 
 post-destroot {
 # Put a copy of utils.pm in perl's path for certain Nagios perl plugins
-	xinstall -m 755 -d ${destroot}${perl5.archlib}
-	xinstall -m 755 ${destroot}${prefix}/libexec/nagios/utils.pm \
-		${destroot}${perl5.archlib}
+    xinstall -m 755 -d ${destroot}${perl5.archlib}
+    xinstall -m 755 ${destroot}${prefix}/libexec/nagios/utils.pm \
+        ${destroot}${perl5.archlib}
+
+    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
+    copy ${filespath}/commands-nagios-plugins.cfg ${destroot}${prefix}/share/examples/${name}/
+}
+
+post-activate {
+    if ![file exists ${prefix}/etc/nagios/objects/commands-nagios-plugins.cfg ] {
+        if ![file exists ${prefix}/etc/nagios/objects ] {
+            xinstall -d ${prefix}/etc/nagios/objects
+        }
+        copy ${prefix}/share/examples/${name}/commands-nagios-plugins.cfg ${prefix}/etc/nagios/objects/
+    }
+}
+
+default_variants    +perl5_16 +gnutls
+
+variant universal {}
+configure.cflags-append "${configure.cflags} [get_canonical_archflags cc]"
+
+variant perl5_12 conflicts perl5_18 perl5_16 description { Perl bindings with perl 5.12} {
+    perl5.branches 5.12
+    configure.args-append   --with-perl=${prefix}/bin/perl5.12
+    depends_build-append    port:p5.12-net-snmp \
+                            port:p5.12-digest-sha1 \
+                            port:p5.12-digest-hmac \
+                            port:p5.12-crypt-des
 }
+
+variant perl5_16 conflicts perl5_18 perl5_12 description { Perl bindings with perl 5.16} {
+    perl5.branches 5.16
+    configure.args-append   --with-perl=${prefix}/bin/perl5.16
+    depends_build-append    port:p5.16-net-snmp \
+                            port:p5.16-digest-sha1 \
+                            port:p5.16-digest-hmac \
+                            port:p5.16-crypt-des
+}
+
+variant perl5_18 conflicts perl5_16 perl5_12 description { Perl bindings with perl 5.18} {
+    perl5.branches 5.18
+    configure.args-append   --with-perl=${prefix}/bin/perl5.18
+    depends_build-append    port:p5.18-net-snmp \
+                            port:p5.18-digest-sha1 \
+                            port:p5.18-digest-hmac \
+                            port:p5.18-crypt-des
+}
+
+livecheck.type     regex
+livecheck.url       http://www.nagios.org/download/plugins
+livecheck.regex     "\">nagios-plugins-(\\d+(?:\\.\\d+)*).tar.gz</a></td>"
+
+
