pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/sysutils/zabbix50-proxy



Module Name:    pkgsrc
Committed By:   otis
Date:           Tue Nov  3 22:45:39 UTC 2020

Added Files:
        pkgsrc/sysutils/zabbix50-proxy: DESCR Makefile PLIST distinfo
            options.mk
        pkgsrc/sysutils/zabbix50-proxy/files: zabbix_proxy.sh
        pkgsrc/sysutils/zabbix50-proxy/files/smf: manifest.xml
        pkgsrc/sysutils/zabbix50-proxy/patches: patch-m4_ax__lib__mysql.m4
            patch-m4_libssh.m4 patch-src_libs_zbxsysinfo_netbsd_net.c
            patch-src_zabbix__proxy_Makefile.am

Log Message:
zabbix50-proxy: Import zabbix-proxy 5.0.5

Zabbix is the ultimate enterprise-level software designed for monitoring
availability and performance of IT infrastructure components. Zabbix is open
source and comes at no cost.

With Zabbix it is possible to gather virtually limitless types of data from
the network. High performance real-time monitoring means that tens of thousands
of servers, virtual machines and network devices can be monitored
simultaneously. Along with storing the data, visualization features are
available (overviews, maps, graphs, screens, etc), as well as very flexible
ways of analyzing the data for the purpose of alerting.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/zabbix50-proxy/DESCR \
    pkgsrc/sysutils/zabbix50-proxy/Makefile \
    pkgsrc/sysutils/zabbix50-proxy/PLIST \
    pkgsrc/sysutils/zabbix50-proxy/distinfo \
    pkgsrc/sysutils/zabbix50-proxy/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/zabbix50-proxy/files/zabbix_proxy.sh
cvs rdiff -u -r0 -r1.1 pkgsrc/sysutils/zabbix50-proxy/files/smf/manifest.xml
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_ax__lib__mysql.m4 \
    pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_libssh.m4 \
    pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_libs_zbxsysinfo_netbsd_net.c \
    pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_zabbix__proxy_Makefile.am

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/sysutils/zabbix50-proxy/DESCR
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/DESCR:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/DESCR        Tue Nov  3 22:45:38 2020
@@ -0,0 +1,10 @@
+Zabbix is the ultimate enterprise-level software designed for monitoring
+availability and performance of IT infrastructure components. Zabbix is open
+source and comes at no cost.
+
+With Zabbix it is possible to gather virtually limitless types of data from
+the network. High performance real-time monitoring means that tens of thousands
+of servers, virtual machines and network devices can be monitored
+simultaneously. Along with storing the data, visualization features are
+available (overviews, maps, graphs, screens, etc), as well as very flexible
+ways of analyzing the data for the purpose of alerting.
Index: pkgsrc/sysutils/zabbix50-proxy/Makefile
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/Makefile:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/Makefile     Tue Nov  3 22:45:38 2020
@@ -0,0 +1,77 @@
+# $NetBSD: Makefile,v 1.1 2020/11/03 22:45:38 otis Exp $
+
+.include "../../sysutils/zabbix50-server/Makefile.common"
+
+PKGNAME=       ${DISTNAME:S/-/-proxy-${ZABBIX_DB_TYPE}-/}
+COMMENT=       Enterprise-class Monitoring Solution for Everyone
+
+CONFLICTS+=    zabbix-[0-9]*
+CONFLICTS+=    zabbix-proxy-[0-9]*
+
+DEPENDS+=      fping-[0-9]*:../../net/fping
+
+USE_TOOLS+=            aclocal autoconf automake pax pkg-config
+GNU_CONFIGURE=         yes
+CONFIGURE_ARGS+=       --enable-proxy
+CONFIGURE_ARGS+=       --sysconfdir=${PKG_SYSCONFDIR}
+CONFIGURE_ARGS+=       --datarootdir=${PREFIX}/share/${PKGBASE}
+CONFIGURE_ARGS+=       --with-iconv=${BUILDLINK_PREFIX.iconv}
+CONFIGURE_ARGS+=       --with-ldap=${BUILDLINK_PREFIX.openldap-client}
+CONFIGURE_ARGS+=       --with-libcurl
+CONFIGURE_ARGS+=       --with-libevent=${BUILDLINK_PREFIX.libevent}
+CONFIGURE_ARGS+=       --with-libpcre=${BUILDLINK_PREFIX.pcre}
+CONFIGURE_ARGS+=       --with-libxml2
+CONFIGURE_ARGS+=       --with-openssl=${BUILDLINK_PREFIX.openssl}
+CONFIGURE_ARGS+=       --with-zlib=${BUILDLINK_PREFIX.zlib}
+
+EGDIR=         share/examples/${PKGBASE}
+CONF_FILES+=   ${EGDIR}/zabbix_proxy.conf ${PKG_SYSCONFDIR}/zabbix_proxy.conf
+
+RCD_SCRIPTS=   zabbix_proxy
+SMF_NAME=      zabbix-proxy
+
+INSTALLATION_DIRS+=    ${EGDIR} share/${PKGBASE}
+
+SUBST_CLASSES+=                        fix-paths
+SUBST_STAGE.fix-paths=         pre-configure
+SUBST_MESSAGE.fix-paths=       Fixing absolute paths.
+SUBST_FILES.fix-paths=         conf/*.conf
+SUBST_FILES.fix-paths+=                man/*.man
+SUBST_SED.fix-paths=           -e 's,/usr/local/etc,${PKG_SYSCONFDIR},g'
+
+SUBST_CLASSES+=                        fix-pkgbase
+SUBST_STAGE.fix-pkgbase=       pre-configure
+SUBST_MESSAGE.fix-pkgbase=     Fixing PKGBASE.
+SUBST_FILES.fix-pkgbase=       src/zabbix_proxy/Makefile.am
+SUBST_SED.fix-pkgbase=         -e 's,%%PKGBASE%%,${PKGBASE},g'
+
+PLIST_SUBST+=                  PKGBASE=${PKGBASE}
+
+CFLAGS.SunOS+=                 -DDUK_USE_BYTEORDER=1
+
+.include "../../mk/bsd.prefs.mk"
+
+pre-configure:
+       set -e; cd ${WRKSRC}; \
+          aclocal -I m4 ; automake -ai --foreign; autoconf -I m4
+
+post-install:
+       cd ${WRKSRC}/database/${ZABBIX_DB_TYPE}; \
+               ${PAX} -rw . ${DESTDIR}${PREFIX}/share/${PKGBASE}/
+       ${RM} ${DESTDIR}${PREFIX}/share/${PKGBASE}/Makefile*
+       ${RM} ${DESTDIR}${PREFIX}/share/${PKGBASE}/data.sql
+       ${RM} ${DESTDIR}${PREFIX}/share/${PKGBASE}/images.sql
+       ${MV} ${DESTDIR}${PREFIX}/bin/zabbix_js \
+          ${DESTDIR}${PREFIX}/bin/zabbix_proxy_js
+
+.include "options.mk"
+
+.include "../../converters/libiconv/buildlink3.mk"
+.include "../../databases/openldap-client/buildlink3.mk"
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
+.include "../../textproc/libxml2/buildlink3.mk"
+.include "../../www/curl/buildlink3.mk"
+.include "../../devel/pcre/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/sysutils/zabbix50-proxy/PLIST
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/PLIST:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/PLIST        Tue Nov  3 22:45:38 2020
@@ -0,0 +1,11 @@
+@comment $NetBSD: PLIST,v 1.1 2020/11/03 22:45:38 otis Exp $
+bin/zabbix_proxy_js
+man/man8/zabbix_proxy.8
+sbin/zabbix_proxy
+share/examples/${PKGBASE}/zabbix_proxy.conf
+${PLIST.sqldb}share/${PKGBASE}/double.sql
+share/${PKGBASE}/schema.sql
+${PLIST.pgsql}share/${PKGBASE}/timescaledb.sql
+@pkgdir share/${PKGBASE}/externalscripts
+@pkgdir lib/modules
+@pkgdir etc/zabbix_proxy.conf.d
Index: pkgsrc/sysutils/zabbix50-proxy/distinfo
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/distinfo:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/distinfo     Tue Nov  3 22:45:38 2020
@@ -0,0 +1,10 @@
+$NetBSD: distinfo,v 1.1 2020/11/03 22:45:38 otis Exp $
+
+SHA1 (zabbix-5.0.5.tar.gz) = 65683f4ada7ae91f26215a53683d12ec726a960d
+RMD160 (zabbix-5.0.5.tar.gz) = 0d65e30d3d91ba8819572468425cf18c4e2c33bc
+SHA512 (zabbix-5.0.5.tar.gz) = 5397672fa170e12120526793b48d01764013467cc259eca61991bc52251c25888dd318ccffa6ed30ac3643104e715ceb70baaeec6eeaddb115ed294c22f5e619
+Size (zabbix-5.0.5.tar.gz) = 19153153 bytes
+SHA1 (patch-m4_ax__lib__mysql.m4) = 9786c6bff3d22334263921c201bf241a207a46bc
+SHA1 (patch-m4_libssh.m4) = 8b4ac3964caf94bb0e4939d265dcefc08a07a0df
+SHA1 (patch-src_libs_zbxsysinfo_netbsd_net.c) = 468f2112a3d65b0a73f371194ae15ce0df0ad71c
+SHA1 (patch-src_zabbix__proxy_Makefile.am) = 9d2c3d5ca06e676154653b70f0931ed2ea281cf5
Index: pkgsrc/sysutils/zabbix50-proxy/options.mk
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/options.mk:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/options.mk   Tue Nov  3 22:45:38 2020
@@ -0,0 +1,61 @@
+# $NetBSD: options.mk,v 1.1 2020/11/03 22:45:38 otis Exp $
+
+PKG_OPTIONS_VAR=               PKG_OPTIONS.zabbix50-proxy
+PKG_SUPPORTED_OPTIONS+=                inet6 ipmi libssh libssh2 snmp
+PKG_OPTIONS_OPTIONAL_GROUPS=   database
+PKG_OPTIONS_GROUP.database=    mysql pgsql sqlite3
+PKG_SUGGESTED_OPTIONS+=                libssh2 pgsql snmp
+
+.if empty(MISSING_FEATURES:Minet6)
+PKG_SUGGESTED_OPTIONS+=                inet6
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=           pgsql
+PLIST_VARS+=           sqldb
+
+.if !empty(PKG_OPTIONS:Minet6)
+CONFIGURE_ARGS+=       --enable-ipv6
+.endif
+
+.if !empty(PKG_OPTIONS:Mlibssh)
+CONFIGURE_ARGS+=       --with-ssh=${BUILDLINK_PREFIX.libssh}
+.include "../../security/libssh/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mlibssh2)
+CONFIGURE_ARGS+=       --with-ssh2=${BUILDLINK_PREFIX.libssh2}
+.include "../../security/libssh2/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mmysql)
+CONFIGURE_ARGS+=       --with-mysql
+.include "../../mk/mysql.buildlink3.mk"
+ZABBIX_DB_TYPE=                mysql
+PLIST.sqldb=           yes
+.endif
+
+.if !empty(PKG_OPTIONS:Msnmp)
+CONFIGURE_ARGS+=       --with-net-snmp
+.include "../../net/net-snmp/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mpgsql)
+CONFIGURE_ARGS+=       --with-postgresql
+.include "../../mk/pgsql.buildlink3.mk"
+ZABBIX_DB_TYPE=                postgresql
+PLIST.pgsql=           yes
+PLIST.sqldb=           yes
+.endif
+
+.if !empty(PKG_OPTIONS:Msqlite3)
+CONFIGURE_ARGS+=       --with-sqlite3=${BUILDLINK_PREFIX.sqlite3}
+.include "../../databases/sqlite3/buildlink3.mk"
+ZABBIX_DB_TYPE=                sqlite3
+.endif
+
+.if !empty(PKG_OPTIONS:Mipmi)
+CONFIGURE_ARGS+=       --with-openipmi=${PREFIX}
+.include "../../sysutils/openipmi/buildlink3.mk"
+.endif

Index: pkgsrc/sysutils/zabbix50-proxy/files/zabbix_proxy.sh
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/files/zabbix_proxy.sh:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/files/zabbix_proxy.sh        Tue Nov  3 22:45:38 2020
@@ -0,0 +1,27 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD: zabbix_proxy.sh,v 1.1 2020/11/03 22:45:38 otis Exp $
+#
+# Zabbix proxy daemon
+#
+# REQUIRE: DAEMON
+# PROVIDE: zabbix_proxy
+
+if [ -f /etc/rc.subr ]; then
+       . /etc/rc.subr
+fi
+
+name="zabbix_proxy"
+rcvar=${name}
+command="@PREFIX@/sbin/${name}"
+start_precmd="ulimit -s 10240"
+required_files="@PKG_SYSCONFDIR@/${name}.conf"
+
+if [ -f /etc/rc.subr ]; then
+       load_rc_config ${name}
+       run_rc_command "$1"
+else
+       @ECHO@ -n " ${name}"
+       [ "x$1" = "xstart" ] && ulimit -s 10240
+       ${command} ${command_args}
+fi

Index: pkgsrc/sysutils/zabbix50-proxy/files/smf/manifest.xml
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/files/smf/manifest.xml:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/files/smf/manifest.xml       Tue Nov  3 22:45:38 2020
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+<service_bundle type="manifest" name="export">
+  <service name="@SMF_PREFIX@/@SMF_NAME@" type="service" version="1">
+    <dependency name="fs-local" grouping="require_all" restart_on="none" type="service">
+      <service_fmri value="svc:/system/filesystem/local"/>
+    </dependency>
+    <dependency name="network-service" grouping="require_all" restart_on="none" type="service">
+      <service_fmri value="svc:/network/service"/>
+    </dependency>
+    <dependency name="system-log" grouping="optional_all" restart_on="none" type="service">
+      <service_fmri value="svc:/system/system-log"/>
+    </dependency>
+    <method_context>
+        <method_credential user="@ZABBIX_USER@" group="@ZABBIX_GROUP@"/>
+    </method_context>
+    <instance name="@SMF_INSTANCES@" enabled="false">
+      <dependency name="config-file" grouping="require_all" restart_on="refresh" type="path">
+        <service_fmri value="file://localhost@PKG_SYSCONFDIR@/zabbix_proxy.conf"/>
+      </dependency>
+      <exec_method name="start" type="method" exec="@PREFIX@/sbin/zabbix_proxy -c @PKG_SYSCONFDIR@/zabbix_proxy.conf" timeout_seconds="0"/>
+      <exec_method name="stop" type="method" exec=":kill" timeout_seconds="0"/>
+      <template>
+        <common_name>
+          <loctext xml:lang="C">Zabbix proxy</loctext>
+        </common_name>
+      </template>
+    </instance>
+  </service>
+</service_bundle>

Index: pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_ax__lib__mysql.m4
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_ax__lib__mysql.m4:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_ax__lib__mysql.m4   Tue Nov  3 22:45:39 2020
@@ -0,0 +1,15 @@
+$NetBSD: patch-m4_ax__lib__mysql.m4,v 1.1 2020/11/03 22:45:39 otis Exp $
+
+Fix bash-ism.
+
+--- m4/ax_lib_mysql.m4.orig    2020-08-24 09:42:55.000000000 +0000
++++ m4/ax_lib_mysql.m4
+@@ -236,7 +236,7 @@ AC_DEFUN([AX_LIB_MYSQL],
+             LDFLAGS="${LDFLAGS} ${MYSQL_LDFLAGS}"
+             LIBS="${LIBS} ${MYSQL_LIBS}"
+             LIBMYSQL_TLS_TRY_LINK([no])
+-            if test "$found_mysql_tls" == "yes"; then
++            if test "$found_mysql_tls" = "yes"; then
+                 LIBMYSQL_TLS_CIPHERS_TRY_LINK([no])
+             else
+                 LIBMARIADB_TLS_TRY_LINK([no])
Index: pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_libssh.m4
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_libssh.m4:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/patches/patch-m4_libssh.m4   Tue Nov  3 22:45:39 2020
@@ -0,0 +1,40 @@
+$NetBSD: patch-m4_libssh.m4,v 1.1 2020/11/03 22:45:39 otis Exp $
+
+Fix libssh >= 0.9.5 detection.
+
+--- m4/libssh.m4.orig  2020-05-10 17:36:06.000000000 +0000
++++ m4/libssh.m4
+@@ -83,13 +83,19 @@ AC_HELP_STRING([--with-ssh@<:@=DIR@:>@],
+          SSH_LDFLAGS=-L/usr/lib
+          SSH_LIBS="-lssh"
+          found_ssh="yes"
+-       LIBSSH_ACCEPT_VERSION([/usr/include/libssh/libssh.h])
++       LIBSSH_ACCEPT_VERSION([/usr/include/libssh/libssh_version.h])
++       if test "x$accept_ssh_version" = "xno"; then
++          LIBSSH_ACCEPT_VERSION([/usr/include/libssh/libssh.h])
++       fi
+        elif test -f /usr/local/include/libssh/libssh.h; then
+          SSH_CFLAGS=-I/usr/local/include
+          SSH_LDFLAGS=-L/usr/local/lib
+          SSH_LIBS="-lssh"
+          found_ssh="yes"
+-       LIBSSH_ACCEPT_VERSION([/usr/local/include/libssh/libssh.h])
++       LIBSSH_ACCEPT_VERSION([/usr/local/include/libssh/libssh_version.h])
++       if test "x$accept_ssh_version" = "xno"; then
++          LIBSSH_ACCEPT_VERSION([/usr/local/include/libssh/libssh.h])
++       fi
+        else #libraries are not found in default directories
+          found_ssh="no"
+          AC_MSG_RESULT(no)
+@@ -100,7 +106,10 @@ AC_HELP_STRING([--with-ssh@<:@=DIR@:>@],
+          SSH_LDFLAGS=-L$_libssh_dir/lib
+          SSH_LIBS="-lssh"
+          found_ssh="yes"
+-       LIBSSH_ACCEPT_VERSION([$_libssh_dir/include/libssh/libssh.h])
++       LIBSSH_ACCEPT_VERSION([$_libssh_dir/include/libssh/libssh_version.h])
++       if test "x$accept_ssh_version" = "xno"; then
++          LIBSSH_ACCEPT_VERSION([$_libssh_dir/include/libssh/libssh.h])
++       fi
+        else #if test -f $_libssh_dir/include/libssh/libssh.h; then
+          found_ssh="no"
+          AC_MSG_RESULT(no)
Index: pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_libs_zbxsysinfo_netbsd_net.c
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_libs_zbxsysinfo_netbsd_net.c:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_libs_zbxsysinfo_netbsd_net.c       Tue Nov  3 22:45:39 2020
@@ -0,0 +1,203 @@
+$NetBSD: patch-src_libs_zbxsysinfo_netbsd_net.c,v 1.1 2020/11/03 22:45:39 otis Exp $
+
+Rework interface statistics code from using kvm to using sysctl interface.
+
+--- src/libs/zbxsysinfo/netbsd/net.c.orig      2020-08-24 09:42:55.000000000 +0000
++++ src/libs/zbxsysinfo/netbsd/net.c
+@@ -22,6 +22,9 @@
+ #include "zbxjson.h"
+ #include "log.h"
+ 
++#include <net/route.h>
++#include <net/if_dl.h>
++
+ static struct nlist kernel_symbols[] =
+ {
+       {"_ifnet", N_UNDF, 0, 0, 0},
+@@ -31,43 +34,91 @@ static struct nlist kernel_symbols[] =
+ 
+ #define IFNET_ID 0
+ 
++static void
++get_rtaddrs(int addrs, struct sockaddr *sa, struct sockaddr **rti_info)
++{
++    int i;
++
++    for (i = 0; i < RTAX_MAX; i++) {
++        if (addrs & (1 << i)) {
++            rti_info[i] = sa;
++            sa = (struct sockaddr *)((char *)(sa) +
++                RT_ROUNDUP(sa->sa_len));
++        } else
++            rti_info[i] = NULL;
++    }
++}
++
++
+ static int    get_ifdata(const char *if_name,
+               zbx_uint64_t *ibytes, zbx_uint64_t *ipackets, zbx_uint64_t *ierrors, zbx_uint64_t *idropped,
+               zbx_uint64_t *obytes, zbx_uint64_t *opackets, zbx_uint64_t *oerrors,
+               zbx_uint64_t *tbytes, zbx_uint64_t *tpackets, zbx_uint64_t *terrors,
+               zbx_uint64_t *icollisions, char **error)
+ {
+-      struct ifnet_head       head;
+-      struct ifnet            *ifp;
+-      struct ifnet            v;
+-
+-      kvm_t   *kp;
+-      int     len = 0;
+-      int     ret = SYSINFO_RET_FAIL;
++      struct  if_msghdr *ifm;
++      int             mib[6] = { CTL_NET, AF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
++      char    *buf = NULL;
++      char    *lim, *next;
++      struct  rt_msghdr *rtm;
++      struct  if_data *ifd = NULL;
++      struct  sockaddr *sa, *rti_info[RTAX_MAX];
++      struct  sockaddr_dl *sdl;
++
++      size_t  len = 0;
++      size_t  olen = 0;
++      int             ret = SYSINFO_RET_FAIL;
++
++      static char name[IFNAMSIZ];
+ 
+       if (NULL == if_name || '\0' == *if_name)
+       {
+               *error = zbx_strdup(NULL, "Network interface name cannot be empty.");
+-              return FAIL;
++              ret = FAIL;
++              goto out;
+       }
+ 
+-      if (NULL == (kp = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL))) /* requires root privileges */
+-      {
+-              *error = zbx_strdup(NULL, "Cannot obtain a descriptor to access kernel virtual memory.");
+-              return FAIL;
+-      }
+-
+-      if (N_UNDF == kernel_symbols[IFNET_ID].n_type)
+-              if (0 != kvm_nlist(kp, &kernel_symbols[0]))
+-                      kernel_symbols[IFNET_ID].n_type = N_UNDF;
+-
+-      if (N_UNDF != kernel_symbols[IFNET_ID].n_type)
+-      {
+-              len = sizeof(struct ifnet_head);
+-
+-              if (kvm_read(kp, kernel_symbols[IFNET_ID].n_value, &head, len) >= len)
+-              {
+-                      len = sizeof(struct ifnet);
++    if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1) {
++        *error = zbx_strdup(NULL, "Failed to read network interfaces data");
++              ret = FAIL;
++              goto out;
++      }
++
++    if (len > olen) {
++        free(buf);
++        if ((buf = zbx_malloc(NULL, len)) == NULL) {
++                      *error = zbx_strdup(NULL, "Failed to allocate buffer for network interfaces data");
++                      ret = FAIL;
++                      goto out;
++              }
++        olen = len;
++    }
++    if (sysctl(mib, 6, buf, &len, NULL, 0) == -1) {
++              *error = zbx_strdup(NULL, "Failed to allocate buffer for network interfaces data");
++              ret = FAIL;
++              goto out;
++      }
++
++      lim = buf + len;
++    for (next = buf; next < lim; next += rtm->rtm_msglen) {
++        rtm = (struct rt_msghdr *)next;
++        if ((rtm->rtm_version == RTM_VERSION) &&
++                (rtm->rtm_type == RTM_IFINFO)) {
++            ifm = (struct if_msghdr *)next;
++            ifd = &ifm->ifm_data;
++
++            sa = (struct sockaddr *)(ifm + 1);
++            get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
++
++            sdl = (struct sockaddr_dl *)rti_info[RTAX_IFP];
++            if (sdl == NULL || sdl->sdl_family != AF_LINK) {
++                continue;
++            }
++            bzero(name, sizeof(name));
++            if (sdl->sdl_nlen >= IFNAMSIZ)
++                memcpy(name, sdl->sdl_data, IFNAMSIZ - 1);
++            else if (sdl->sdl_nlen > 0)
++                memcpy(name, sdl->sdl_data, sdl->sdl_nlen);
+ 
+                       /* if_ibytes;           total number of octets received */
+                       /* if_ipackets;         packets received on interface */
+@@ -101,42 +152,38 @@ static int       get_ifdata(const char *if_nam
+                       if (icollisions)
+                               *icollisions = 0;
+ 
+-                      for (ifp = head.tqh_first; ifp; ifp = v.if_list.tqe_next)
++                      if (0 == strcmp(if_name, name))
+                       {
+-                              if (kvm_read(kp, (u_long)ifp, &v, len) < len)
+-                                      break;
+-
+-                              if (0 == strcmp(if_name, v.if_xname))
+-                              {
+-                                      if (ibytes)
+-                                              *ibytes += v.if_ibytes;
+-                                      if (ipackets)
+-                                              *ipackets += v.if_ipackets;
+-                                      if (ierrors)
+-                                              *ierrors += v.if_ierrors;
+-                                      if (idropped)
+-                                              *idropped += v.if_iqdrops;
+-                                      if (obytes)
+-                                              *obytes += v.if_obytes;
+-                                      if (opackets)
+-                                              *opackets += v.if_opackets;
+-                                      if (oerrors)
+-                                              *oerrors += v.if_oerrors;
+-                                      if (tbytes)
+-                                              *tbytes += v.if_ibytes + v.if_obytes;
+-                                      if (tpackets)
+-                                              *tpackets += v.if_ipackets + v.if_opackets;
+-                                      if (terrors)
+-                                              *terrors += v.if_ierrors + v.if_oerrors;
+-                                      if (icollisions)
+-                                              *icollisions += v.if_collisions;
+-                                      ret = SYSINFO_RET_OK;
+-                              }
++                              if (ibytes)
++                                      *ibytes += ifd->ifi_ibytes;
++                              if (ipackets)
++                                      *ipackets += ifd->ifi_ipackets;
++                              if (ierrors)
++                                      *ierrors += ifd->ifi_ierrors;
++                              if (idropped)
++                                      *idropped += ifd->ifi_iqdrops;
++                              if (obytes)
++                                      *obytes += ifd->ifi_obytes;
++                              if (opackets)
++                                      *opackets += ifd->ifi_opackets;
++                              if (oerrors)
++                                      *oerrors += ifd->ifi_oerrors;
++                              if (tbytes)
++                                      *tbytes += ifd->ifi_ibytes + ifd->ifi_obytes;
++                              if (tpackets)
++                                      *tpackets += ifd->ifi_ipackets + ifd->ifi_opackets;
++                              if (terrors)
++                                      *terrors += ifd->ifi_ierrors + ifd->ifi_oerrors;
++                              if (icollisions)
++                                      *icollisions += ifd->ifi_collisions;
++                              ret = SYSINFO_RET_OK;
++                              goto out;
+                       }
+               }
+       }
+ 
+-      kvm_close(kp);
++out:
++      free(buf);
+ 
+       if (SYSINFO_RET_FAIL == ret)
+       {
Index: pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_zabbix__proxy_Makefile.am
diff -u /dev/null pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_zabbix__proxy_Makefile.am:1.1
--- /dev/null   Tue Nov  3 22:45:39 2020
+++ pkgsrc/sysutils/zabbix50-proxy/patches/patch-src_zabbix__proxy_Makefile.am  Tue Nov  3 22:45:39 2020
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_zabbix__proxy_Makefile.am,v 1.1 2020/11/03 22:45:39 otis Exp $
+
+Install config file to component's example directory.
+
+--- src/zabbix_proxy/Makefile.am.orig  2020-08-24 09:42:55.000000000 +0000
++++ src/zabbix_proxy/Makefile.am
+@@ -97,4 +97,4 @@ install-data-hook:
+       $(MKDIR_P) "$(DESTDIR)$(PROXY_CONFIG_FILE).d"
+       $(MKDIR_P) "$(DESTDIR)$(EXTERNAL_SCRIPTS_PATH)"
+       $(MKDIR_P) "$(DESTDIR)$(LOAD_MODULE_PATH)"
+-      test -f "$(DESTDIR)$(PROXY_CONFIG_FILE)" || cp "../../conf/zabbix_proxy.conf" "$(DESTDIR)$(PROXY_CONFIG_FILE)"
++      $(INSTALL_DATA) "../../conf/zabbix_proxy.conf" "$(DESTDIR)/${PREFIX}/share/examples/%%PKGBASE%%"



Home | Main Index | Thread Index | Old Index