Update to the latest available RC (1.8.4rc3).

Details available at:
http://www.zabbix.com/documentation/1.8/manual/about/what_s_new_1.8.4

We are updating now because this release brings lots of fixes and
integrates robert@'s patches for sensors and network statistics. Used
in production for several weeks now.
Final 1.8.4 is scheduled to be released shortly.

ok robert@
This commit is contained in:
ajacoutot 2010-12-27 17:19:17 +00:00
parent 021b835a3b
commit f5a0b77fbe
11 changed files with 39 additions and 757 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.44 2010/12/27 14:50:23 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.45 2010/12/27 17:19:17 ajacoutot Exp $
COMMENT-main = network and application monitoring - agent
COMMENT-server = network and application monitoring - server
COMMENT-web = network and application monitoring - web frontend
VERSION = 1.8.3
VERSION = 1.8.4rc3
DISTNAME = zabbix-${VERSION}
FULLPKGNAME-main = zabbix-agent-${VERSION}
FULLPKGPATH-main = net/zabbix,-main
@ -13,10 +13,6 @@ FULLPKGNAME-web = zabbix-web-${VERSION}
FULLPKGPATH-web = net/zabbix,-web
CATEGORIES = net
REVISION-main = 10
REVISION-server = 9
REVISION-web = 3
MAJV = ${VERSION:C/^([0-9]+\.[0-9]+).*/\1/}
HOMEPAGE = http://www.zabbix.com/

View File

@ -1,5 +1,5 @@
MD5 (zabbix-1.8.3.tar.gz) = V1wxiA1z9v5B5zCHTr/GMw==
RMD160 (zabbix-1.8.3.tar.gz) = 8NVMHNiGXJUpRajsOVjn692aktU=
SHA1 (zabbix-1.8.3.tar.gz) = aPXR8SiXvGnG/13uorrYKwwfV2E=
SHA256 (zabbix-1.8.3.tar.gz) = NyYtdRyWYaNhOAvxSA0nfYFiHYpJxgqBZny+JYAhBlw=
SIZE (zabbix-1.8.3.tar.gz) = 4106152
MD5 (zabbix-1.8.4rc3.tar.gz) = U+uuBsn6+Lo1qkvcG4pV/w==
RMD160 (zabbix-1.8.4rc3.tar.gz) = FADRebSNNfughV28d89KV9ohnDg=
SHA1 (zabbix-1.8.4rc3.tar.gz) = 0p5dHifB/jkyBq7tY1D2nQKO5Bc=
SHA256 (zabbix-1.8.4rc3.tar.gz) = ZBuKu+YCC30i42SO9x5W269bdYeZqBkdKb4ZTgTT1YY=
SIZE (zabbix-1.8.4rc3.tar.gz) = 4123766

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-include_sysinfo_h,v 1.1 2010/09/29 07:10:45 robert Exp $
--- include/sysinfo.h.orig Wed Sep 29 09:09:12 2010
+++ include/sysinfo.h Wed Sep 29 09:09:32 2010
@@ -255,4 +255,7 @@ int NET_IF_LIST(const char *cmd, const char *param, un
int SYSTEM_STAT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result);
#endif /* _AIX */
+#if defined(__OpenBSD__)
+int GET_SENSOR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result);
+#endif /* __OpenBSD__ */
#endif

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot Exp $
--- misc/conf/zabbix_proxy.conf.orig Thu Aug 19 16:33:48 2010
+++ misc/conf/zabbix_proxy.conf Thu Aug 19 16:36:24 2010
@@ -96,6 +96,7 @@ LogFile=/tmp/zabbix_proxy.log
$OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.6 2010/12/27 17:19:17 ajacoutot Exp $
--- misc/conf/zabbix_proxy.conf.orig Thu Dec 23 17:51:28 2010
+++ misc/conf/zabbix_proxy.conf Mon Dec 27 16:19:44 2010
@@ -94,6 +94,7 @@ LogFile=/tmp/zabbix_proxy.log
# Mandatory: no
# Default:
# PidFile=/tmp/zabbix_proxy.pid
@ -9,7 +9,7 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: DBHost
# Database host name.
@@ -121,7 +122,7 @@ DBName=zabbix
@@ -126,7 +127,7 @@ DBName=zabbix
# Default:
# DBUser=
@ -18,7 +18,7 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: DBPassword
# Database password. Ignored for SQLite.
@@ -137,6 +138,7 @@ DBUser=root
@@ -142,6 +143,7 @@ DBUser=root
# Mandatory: no
# Default:
# DBSocket=/tmp/mysql.sock
@ -26,7 +26,7 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
# Option: DBPort
# Database port when not using local socket. Ignored for SQLite.
@@ -372,6 +374,7 @@ DBUser=root
@@ -380,6 +382,7 @@ DBUser=root
# Mandatory: no
# Default:
# ExternalScripts=/etc/zabbix/externalscripts
@ -34,7 +34,7 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: FpingLocation
# Location of fping.
@@ -380,6 +383,7 @@ DBUser=root
@@ -388,6 +391,7 @@ DBUser=root
# Mandatory: no
# Default:
# FpingLocation=/usr/sbin/fping
@ -42,7 +42,7 @@ $OpenBSD: patch-misc_conf_zabbix_proxy_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: Fping6Location
# Location of fping6.
@@ -389,6 +393,7 @@ DBUser=root
@@ -397,6 +401,7 @@ DBUser=root
# Mandatory: no
# Default:
# Fping6Location=/usr/sbin/fping6

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot Exp $
--- misc/conf/zabbix_server.conf.orig Thu Aug 19 16:37:36 2010
+++ misc/conf/zabbix_server.conf Thu Aug 19 16:40:20 2010
$OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.6 2010/12/27 17:19:17 ajacoutot Exp $
--- misc/conf/zabbix_server.conf.orig Thu Dec 23 17:51:28 2010
+++ misc/conf/zabbix_server.conf Mon Dec 27 16:19:44 2010
@@ -36,8 +36,6 @@
# Default:
# LogFile=
@ -18,7 +18,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: DBHost
# Database host name.
@@ -92,7 +91,7 @@ DBName=zabbix
@@ -99,7 +98,7 @@ DBName=zabbix
# Default:
# DBUser=
@ -27,7 +27,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: DBPassword
# Database password. Ignored for SQLite.
@@ -108,6 +107,7 @@ DBUser=root
@@ -115,6 +114,7 @@ DBUser=root
# Mandatory: no
# Default:
# DBSocket=/tmp/mysql.sock
@ -35,7 +35,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: DBPort
# Database port when not using local socket. Ignored for SQLite.
@@ -334,6 +334,7 @@ DBUser=root
@@ -346,6 +346,7 @@ DBUser=root
# Mandatory: no
# Default:
# AlertScriptsPath=/home/zabbix/bin/
@ -43,7 +43,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: ExternalScripts
# Location of external scripts
@@ -341,6 +342,7 @@ DBUser=root
@@ -353,6 +354,7 @@ DBUser=root
# Mandatory: no
# Default:
# ExternalScripts=/etc/zabbix/externalscripts
@ -51,7 +51,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: FpingLocation
# Location of fping.
@@ -349,6 +351,7 @@ DBUser=root
@@ -361,6 +363,7 @@ DBUser=root
# Mandatory: no
# Default:
# FpingLocation=/usr/sbin/fping
@ -59,7 +59,7 @@ $OpenBSD: patch-misc_conf_zabbix_server_conf,v 1.5 2010/08/22 14:43:24 ajacoutot
### Option: Fping6Location
# Location of fping6.
@@ -358,6 +361,7 @@ DBUser=root
@@ -370,6 +373,7 @@ DBUser=root
# Mandatory: no
# Default:
# Fping6Location=/usr/sbin/fping6

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-src_libs_zbxnix_daemon_c,v 1.4 2010/08/22 14:43:24 ajacoutot Exp $
--- src/libs/zbxnix/daemon.c.orig Thu Aug 19 16:43:41 2010
+++ src/libs/zbxnix/daemon.c Thu Aug 19 16:44:01 2010
@@ -138,7 +138,7 @@ int daemon_start(int allow_root)
$OpenBSD: patch-src_libs_zbxnix_daemon_c,v 1.5 2010/12/27 17:19:17 ajacoutot Exp $
--- src/libs/zbxnix/daemon.c.orig Thu Dec 23 17:51:28 2010
+++ src/libs/zbxnix/daemon.c Mon Dec 27 16:19:44 2010
@@ -148,7 +148,7 @@ int daemon_start(int allow_root)
pid_t pid;
struct passwd *pwd;
struct sigaction phan;

View File

@ -1,527 +0,0 @@
$OpenBSD: patch-src_libs_zbxsysinfo_openbsd_net_c,v 1.4 2010/12/13 10:40:52 robert Exp $
--- src/libs/zbxsysinfo/openbsd/net.c.orig Mon Aug 16 10:19:32 2010
+++ src/libs/zbxsysinfo/openbsd/net.c Mon Dec 13 11:36:59 2010
@@ -21,6 +21,8 @@
#include "sysinfo.h"
+#include <sys/sockio.h>
+
static struct nlist kernel_symbols[] =
{
{"_ifnet", N_UNDF, 0, 0, 0},
@@ -32,69 +34,71 @@ static struct nlist kernel_symbols[] =
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 *tdropped,
+ zbx_uint64_t *tbytes, zbx_uint64_t *tpackets, zbx_uint64_t *terrors,
zbx_uint64_t *icollisions)
{
struct ifnet_head head;
- struct ifnet *ifp;
- struct ifnet v;
+ struct ifnet *ifp;
- kvm_t *kp;
+ kvm_t *kp;
int len = 0;
- int ret = SYSINFO_RET_FAIL;
+ int ret = SYSINFO_RET_FAIL;
- kp = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
+ /* if(i)_ibytes; total number of octets received */
+ /* if(i)_ipackets; packets received on interface */
+ /* if(i)_ierrors; input errors on interface */
+ /* if(i)_iqdrops; dropped on input, this interface */
+ /* if(i)_obytes; total number of octets sent */
+ /* if(i)_opackets; packets sent on interface */
+ /* if(i)_oerrors; output errors on interface */
+ /* if(i)_collisions; collisions on csma interfaces */
- if (kp) {
+ if (ibytes)
+ *ibytes = 0;
+ if (ipackets)
+ *ipackets = 0;
+ if (ierrors)
+ *ierrors = 0;
+ if (idropped)
+ *idropped = 0;
+ if (obytes)
+ *obytes = 0;
+ if (opackets)
+ *opackets = 0;
+ if (oerrors)
+ *oerrors = 0;
+ if (tbytes)
+ *tbytes = 0;
+ if (tpackets)
+ *tpackets = 0;
+ if (terrors)
+ *terrors = 0;
+ if (icollisions)
+ *icollisions = 0;
+
+ if (NULL != (kp = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL))) /* requires root privileges */
+ {
+ struct ifnet v;
+
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) {
+ 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) {
+ if (kvm_read(kp, kernel_symbols[IFNET_ID].n_value, &head, len) >= len)
+ {
len = sizeof(struct ifnet);
- /* if_ibytes; total number of octets received */
- /* if_ipackets; packets received on interface */
- /* if_ierrors; input errors on interface */
- /* if_iqdrops; dropped on input, this interface */
- /* if_obytes; total number of octets sent */
- /* if_opackets; packets sent on interface */
- /* if_oerrors; output errors on interface */
- /* if_collisions; collisions on csma interfaces */
-
- if (ibytes)
- *ibytes = 0;
- if (ipackets)
- *ipackets = 0;
- if (ierrors)
- *ierrors = 0;
- if (idropped)
- *idropped = 0;
- if (obytes)
- *obytes = 0;
- if (opackets)
- *opackets = 0;
- if (oerrors)
- *oerrors = 0;
- if (tbytes)
- *tbytes = 0;
- if (tpackets)
- *tpackets = 0;
- if (terrors)
- *terrors = 0;
- if (tdropped)
- *tdropped = 0;
- if (icollisions)
- *icollisions = 0;
-
- for(ifp = head.tqh_first; ifp; ifp = v.if_list.tqe_next) {
+ for (ifp = head.tqh_first; ifp; ifp = v.if_list.tqe_next)
+ {
if (kvm_read(kp, (u_long)ifp, &v, len) < len)
break;
- if (*if_name == '\0' || 0 == strcmp(if_name, v.if_xname)) {
+ if ('\0' == *if_name || 0 == strcmp(if_name, v.if_xname))
+ {
if (ibytes)
*ibytes += v.if_ibytes;
if (ipackets)
@@ -115,8 +119,6 @@ static int get_ifdata(const char *if_name, zbx_uint64_
*tpackets += v.if_ipackets + v.if_opackets;
if (terrors)
*terrors += v.if_ierrors + v.if_oerrors;
- if (tdropped)
- *tdropped += v.if_iqdrops;
if (icollisions)
*icollisions += v.if_collisions;
ret = SYSINFO_RET_OK;
@@ -126,80 +128,63 @@ static int get_ifdata(const char *if_name, zbx_uint64_
}
kvm_close(kp);
}
+ else
+ {
+ /* Fallback to using SIOCGIFDATA */
- return ret;
-}
+ int if_s;
+ struct ifreq ifr;
+ struct if_data v;
-static int NET_IF_IN_BYTES(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
+ if ((if_s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ goto clean;
- if (SYSINFO_RET_OK != get_ifdata(if_name, &value, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- return SYSINFO_RET_FAIL;
+ zbx_strlcpy(ifr.ifr_name, if_name, IFNAMSIZ - 1);
+ ifr.ifr_data = (caddr_t)&v;
- SET_UI64_RESULT(result, value);
+ if (ioctl(if_s, SIOCGIFDATA, &ifr) < 0)
+ goto clean;
- return SYSINFO_RET_OK;
-}
+ if ('\0' == *if_name || 0 == strcmp(if_name, ifr.ifr_name))
+ {
+ if (ibytes)
+ *ibytes += v.ifi_ibytes;
+ if (ipackets)
+ *ipackets += v.ifi_ipackets;
+ if (ierrors)
+ *ierrors += v.ifi_ierrors;
+ if (idropped)
+ *idropped += v.ifi_iqdrops;
+ if (obytes)
+ *obytes += v.ifi_obytes;
+ if (opackets)
+ *opackets += v.ifi_opackets;
+ if (oerrors)
+ *oerrors += v.ifi_oerrors;
+ if (tbytes)
+ *tbytes += v.ifi_ibytes + v.ifi_obytes;
+ if (tpackets)
+ *tpackets += v.ifi_ipackets + v.ifi_opackets;
+ if (terrors)
+ *terrors += v.ifi_ierrors + v.ifi_oerrors;
+ if (icollisions)
+ *icollisions += v.ifi_collisions;
+ }
-static int NET_IF_IN_PACKETS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
+ ret = SYSINFO_RET_OK;
+clean:
+ if (if_s >= 0)
+ close(if_s);
+ }
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, &value, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
+ return ret;
}
-static int NET_IF_IN_ERRORS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, &value, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
-static int NET_IF_IN_DROPPED(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, &value, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
-#define NET_FNCLIST struct net_fnclist_s
-NET_FNCLIST
-{
- char *mode;
- int (*function)();
-};
+ char if_name[MAX_STRING_LEN], mode[16];
+ zbx_uint64_t ibytes, ipackets, ierrors, idropped;
- NET_FNCLIST fl[] =
- {
- {"bytes", NET_IF_IN_BYTES},
- {"packets", NET_IF_IN_PACKETS},
- {"errors", NET_IF_IN_ERRORS},
- {"dropped", NET_IF_IN_DROPPED},
- {0, 0}
- };
-
- char if_name[MAX_STRING_LEN];
- char mode[MAX_STRING_LEN];
- int i;
-
assert(result);
init_result(result);
@@ -213,75 +198,36 @@ NET_FNCLIST
if (0 != get_param(param, 2, mode, sizeof(mode)))
*mode = '\0';
- /* default parameter */
- if (*mode == '\0')
- zbx_snprintf(mode, sizeof(mode), "bytes");
-
- for (i = 0; fl[i].mode != 0; i++)
- if (0 == strncmp(mode, fl[i].mode, MAX_STRING_LEN))
- return (fl[i].function)(if_name, result);
-
- return SYSINFO_RET_FAIL;
-}
-
-static int NET_IF_OUT_BYTES(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, &value, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
+ if (SYSINFO_RET_OK != get_ifdata(if_name, &ibytes, &ipackets, &ierrors, &idropped, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
return SYSINFO_RET_FAIL;
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
-static int NET_IF_OUT_PACKETS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, &value, NULL, NULL, NULL, NULL, NULL, NULL))
+ if ('\0' == *mode || 0 == strcmp(mode, "bytes")) /* default parameter */
+ {
+ SET_UI64_RESULT(result, ibytes);
+ }
+ else if (0 == strcmp(mode, "packets"))
+ {
+ SET_UI64_RESULT(result, ipackets);
+ }
+ else if (0 == strcmp(mode, "errors"))
+ {
+ SET_UI64_RESULT(result, ierrors);
+ }
+ else if (0 == strcmp(mode, "dropped"))
+ {
+ SET_UI64_RESULT(result, idropped);
+ }
+ else
return SYSINFO_RET_FAIL;
- SET_UI64_RESULT(result, value);
-
return SYSINFO_RET_OK;
}
-static int NET_IF_OUT_ERRORS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, &value, NULL, NULL, NULL, NULL, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
-#define NET_FNCLIST struct net_fnclist_s
-NET_FNCLIST
-{
- char *mode;
- int (*function)();
-};
+ char if_name[MAX_STRING_LEN], mode[16];
+ zbx_uint64_t obytes, opackets, oerrors;
- NET_FNCLIST fl[] =
- {
- {"bytes", NET_IF_OUT_BYTES},
- {"packets", NET_IF_OUT_PACKETS},
- {"errors", NET_IF_OUT_ERRORS},
-/* {"dropped", NET_IF_OUT_DROPPED},*/
- {0, 0}
- };
-
- char if_name[MAX_STRING_LEN];
- char mode[MAX_STRING_LEN];
- int i;
-
assert(result);
init_result(result);
@@ -295,87 +241,32 @@ NET_FNCLIST
if (0 != get_param(param, 2, mode, sizeof(mode)))
*mode = '\0';
- /* default parameter */
- if (*mode == '\0')
- zbx_snprintf(mode, sizeof(mode), "bytes");
-
- for (i = 0; fl[i].mode != 0; i++)
- if (0 == strncmp(mode, fl[i].mode, MAX_STRING_LEN))
- return (fl[i].function)(if_name, result);
-
- return SYSINFO_RET_FAIL;
-}
-
-static int NET_IF_TOTAL_BYTES(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &value, NULL, NULL, NULL, NULL))
+ if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, &obytes, &opackets, &oerrors, NULL, NULL, NULL, NULL))
return SYSINFO_RET_FAIL;
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
-static int NET_IF_TOTAL_PACKETS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &value, NULL, NULL, NULL))
+ if ('\0' == *mode || 0 == strcmp(mode, "bytes")) /* default parameter */
+ {
+ SET_UI64_RESULT(result, obytes);
+ }
+ else if (0 == strcmp(mode, "packets"))
+ {
+ SET_UI64_RESULT(result, opackets);
+ }
+ else if (0 == strcmp(mode, "errors"))
+ {
+ SET_UI64_RESULT(result, oerrors);
+ }
+ else
return SYSINFO_RET_FAIL;
- SET_UI64_RESULT(result, value);
-
return SYSINFO_RET_OK;
}
-static int NET_IF_TOTAL_ERRORS(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &value, NULL, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
-static int NET_IF_TOTAL_DROPPED(const char *if_name, AGENT_RESULT *result)
-{
- zbx_uint64_t value;
-
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &value, NULL))
- return SYSINFO_RET_FAIL;
-
- SET_UI64_RESULT(result, value);
-
- return SYSINFO_RET_OK;
-}
-
int NET_IF_TOTAL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
-#define NET_FNCLIST struct net_fnclist_s
-NET_FNCLIST
-{
- char *mode;
- int (*function)();
-};
+ char if_name[MAX_STRING_LEN], mode[16];
+ zbx_uint64_t tbytes, tpackets, terrors;
- NET_FNCLIST fl[] =
- {
- {"bytes", NET_IF_TOTAL_BYTES},
- {"packets", NET_IF_TOTAL_PACKETS},
- {"errors", NET_IF_TOTAL_ERRORS},
-/* {"dropped", NET_IF_TOTAL_DROPPED},*/ /* disabled because net.if.out does not support dropped packets */
- {0, 0}
- };
-
- char if_name[MAX_STRING_LEN];
- char mode[MAX_STRING_LEN];
- int i;
-
assert(result);
init_result(result);
@@ -389,18 +280,28 @@ NET_FNCLIST
if (0 != get_param(param, 2, mode, sizeof(mode)))
*mode = '\0';
- /* default parameter */
- if (*mode == '\0')
- zbx_snprintf(mode, sizeof(mode), "bytes");
+ if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &tbytes, &tpackets, &terrors, NULL))
+ return SYSINFO_RET_FAIL;
- for (i = 0; fl[i].mode != 0; i++)
- if (0 == strncmp(mode, fl[i].mode, MAX_STRING_LEN))
- return (fl[i].function)(if_name, result);
+ if ('\0' == *mode || 0 == strcmp(mode, "bytes")) /* default parameter */
+ {
+ SET_UI64_RESULT(result, tbytes);
+ }
+ else if (0 == strcmp(mode, "packets"))
+ {
+ SET_UI64_RESULT(result, tpackets);
+ }
+ else if (0 == strcmp(mode, "errors"))
+ {
+ SET_UI64_RESULT(result, terrors);
+ }
+ else
+ return SYSINFO_RET_FAIL;
- return SYSINFO_RET_FAIL;
+ return SYSINFO_RET_OK;
}
-int NET_TCP_LISTEN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+int NET_TCP_LISTEN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
assert(result);
@@ -409,10 +310,10 @@ int NET_TCP_LISTEN(const char *cmd, const char *pa
return SYSINFO_RET_FAIL;
}
-int NET_IF_COLLISIONS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+int NET_IF_COLLISIONS(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
{
- zbx_uint64_t value;
char if_name[MAX_STRING_LEN];
+ zbx_uint64_t icollisions;
assert(result);
@@ -424,10 +325,10 @@ int NET_IF_COLLISIONS(const char *cmd, const char
if (0 != get_param(param, 1, if_name, sizeof(if_name)))
*if_name = '\0';
- if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &value))
+ if (SYSINFO_RET_OK != get_ifdata(if_name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &icollisions))
return SYSINFO_RET_FAIL;
- SET_UI64_RESULT(result, value);
+ SET_UI64_RESULT(result, icollisions);
return SYSINFO_RET_OK;
}

View File

@ -1,11 +0,0 @@
$OpenBSD: patch-src_libs_zbxsysinfo_openbsd_openbsd_c,v 1.1 2010/09/28 11:04:14 robert Exp $
--- src/libs/zbxsysinfo/openbsd/openbsd.c.orig Mon Sep 27 19:49:49 2010
+++ src/libs/zbxsysinfo/openbsd/openbsd.c Mon Sep 27 19:50:59 2010
@@ -58,5 +58,7 @@ ZBX_METRIC parameters_specific[]=
{"system.uptime", 0, SYSTEM_UPTIME, 0, 0},
{"system.boottime", 0, SYSTEM_BOOTTIME, 0, 0},
+ {"sensor", CF_USEUPARAM, GET_SENSOR, 0, 0},
+
{0}
};

View File

@ -1,173 +0,0 @@
$OpenBSD: patch-src_libs_zbxsysinfo_openbsd_sensors_c,v 1.2 2010/09/30 15:51:51 robert Exp $
--- src/libs/zbxsysinfo/openbsd/sensors.c.orig Mon Aug 16 10:19:32 2010
+++ src/libs/zbxsysinfo/openbsd/sensors.c Thu Sep 30 17:36:12 2010
@@ -1,5 +1,6 @@
/*
** ZABBIX
+** Copyright (C) 2010 Robert Nagy <robert@openbsd.org>
** Copyright (C) 2000-2005 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
@@ -23,94 +24,94 @@
#include "md5.h"
-static int get_sensor(const char *name, unsigned flags, AGENT_RESULT *result)
+#include <sys/sensors.h>
+
+#define CELSIUS(x) ((x - 273150000) / 1000000.0)
+
+int sensor_value(int[], struct sensor *, char *);
+
+int sensor_value(int mib[], struct sensor *sensor, char *key2)
{
- DIR *dir;
- struct dirent *entries;
- struct stat buf;
- char filename[MAX_STRING_LEN];
- char line[MAX_STRING_LEN];
- double d1,d2,d3;
+ size_t slen;
- FILE *f;
+ mib[3] = SENSOR_TEMP;
+ mib[4] = key2 ? atoi(key2) : 0;
- assert(result);
+ slen = sizeof(*sensor);
+ if (sysctl(mib, 5, sensor, &slen, NULL, 0) == -1)
+ return SYSINFO_RET_FAIL;
- init_result(result);
+ return SYSINFO_RET_OK;
+}
- dir=opendir("/proc/sys/dev/sensors");
- if(NULL == dir)
+int GET_SENSOR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
+{
+ enum sensor_type type;
+ struct sensordev sensordev;
+ struct sensor sensor;
+ size_t sdlen = sizeof(sensordev);
+ int mib[3], dev, numt, cnt = 0, ret = SYSINFO_RET_FAIL;
+ uint64_t aggr = 0;
+ char key[MAX_STRING_LEN], key2[MAX_STRING_LEN];
+
+ assert(result);
+
+ init_result(result);
+
+ if(num_param(param) > 2)
{
return SYSINFO_RET_FAIL;
}
- while((entries=readdir(dir))!=NULL)
+ if(get_param(param, 1, key, MAX_STRING_LEN) != 0)
{
- strscpy(filename,"/proc/sys/dev/sensors/");
- zbx_strlcat(filename,entries->d_name,MAX_STRING_LEN);
- zbx_strlcat(filename,name,MAX_STRING_LEN);
+ return SYSINFO_RET_FAIL;
+ }
- if(stat(filename,&buf)==0)
+ if(num_param(param) == 2 && get_param(param, 2, key2, MAX_STRING_LEN) != 0)
+ {
+ return SYSINFO_RET_FAIL;
+ }
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_SENSORS;
+
+ for (dev = 0; ; dev++)
+ {
+ mib[2] = dev;
+
+ if (sysctl(mib, 3, &sensordev, &sdlen, NULL, 0) == -1)
{
- if(NULL == (f = fopen(filename,"r")))
- {
+ if (errno == ENXIO)
continue;
- }
- fgets(line,MAX_STRING_LEN,f);
- zbx_fclose(f);
+ if (errno == ENOENT)
+ break;
- if(sscanf(line,"%lf\t%lf\t%lf\n",&d1, &d2, &d3) == 3)
+ return SYSINFO_RET_FAIL;
+ }
+
+ if (!strcmp(key, "") || !strcmp(key, "cpu"))
+ {
+ if (!strncmp(sensordev.xname, "cpu", 3))
{
- closedir(dir);
- SET_DBL_RESULT(result, d3);
- return SYSINFO_RET_OK;
+ ret = sensor_value(mib, &sensor, NULL);
+ aggr += sensor.value;
+ cnt++;
}
- else
+ }
+ else
+ {
+ if (!strcmp(sensordev.xname, key))
{
- closedir(dir);
- return SYSINFO_RET_FAIL;
+ ret = sensor_value(mib, &sensor, key2);
+ if (sensor.type == SENSOR_TEMP)
+ SET_DBL_RESULT(result, CELSIUS(sensor.value));
}
}
}
- closedir(dir);
- return SYSINFO_RET_FAIL;
-}
-int OLD_SENSOR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result)
-{
- char key[MAX_STRING_LEN];
- int ret;
+ if ((!strcmp(key, "") || !strcmp(key, "cpu")) && cnt)
+ SET_DBL_RESULT(result, CELSIUS(aggr / cnt));
- assert(result);
-
- init_result(result);
-
- if(num_param(param) > 1)
- {
- return SYSINFO_RET_FAIL;
- }
-
- if(get_param(param, 1, key, MAX_STRING_LEN) != 0)
- {
- return SYSINFO_RET_FAIL;
- }
-
- if(strcmp(key,"temp1") == 0)
- {
- ret = get_sensor("temp1", flags, result);
- }
- else if(strcmp(key,"temp2") == 0)
- {
- ret = get_sensor("temp2", flags, result);
- }
- else if(strcmp(key,"temp3") == 0)
- {
- ret = get_sensor("temp3", flags, result);
- }
- else
- {
- ret = SYSINFO_RET_FAIL;
- }
-
- return ret;
+ return ret;
}

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-server,v 1.10 2010/11/22 15:39:21 ajacoutot Exp $
@comment $OpenBSD: PLIST-server,v 1.11 2010/12/27 17:19:17 ajacoutot Exp $
@conflict zabbix-agent-<=1.8.3p5
@man man/man8/zabbix_proxy.8
@man man/man8/zabbix_server.8
@ -42,6 +42,7 @@ share/zabbix/data/images/UPS.png
share/zabbix/data/images/UPS_small.png
share/zabbix/data/images/Workstation.png
share/zabbix/data/images/Workstation_small.png
share/zabbix/data/images_ibm_db2.sql
share/zabbix/data/images_mysql.sql
share/zabbix/data/images_oracle.sql
share/zabbix/data/images_pgsql.sql
@ -63,6 +64,7 @@ share/zabbix/dbpatches/${MAJV}/oracle/patch.sql
share/zabbix/dbpatches/${MAJV}/postgresql/
share/zabbix/dbpatches/${MAJV}/postgresql/patch.sql
share/zabbix/schema/
share/zabbix/schema/ibm_db2.sql
share/zabbix/schema/mysql.sql
share/zabbix/schema/oracle.sql
share/zabbix/schema/postgresql.sql

View File

@ -1,4 +1,4 @@
@comment $OpenBSD: PLIST-web,v 1.11 2010/11/06 09:01:07 ajacoutot Exp $
@comment $OpenBSD: PLIST-web,v 1.12 2010/12/27 17:19:17 ajacoutot Exp $
@pkgpath net/zabbix,-web,mysql
@pkgpath net/zabbix,-web,pgsql
conf/modules.sample/zabbix.conf
@ -257,6 +257,7 @@ zabbix/include/classes/class.ccolor.php
zabbix/include/classes/class.ccolorcell.php
zabbix/include/classes/class.ccombobox.php
zabbix/include/classes/class.ccomboitem.php
zabbix/include/classes/class.cconfigfile.php
zabbix/include/classes/class.cdiv.php
zabbix/include/classes/class.ceditablecombobox.php
zabbix/include/classes/class.cfile.php
@ -277,6 +278,7 @@ zabbix/include/classes/class.cimg.php
zabbix/include/classes/class.cipbox.php
zabbix/include/classes/class.cjson.php
zabbix/include/classes/class.cjsscript.php
zabbix/include/classes/class.clabel.php
zabbix/include/classes/class.cldap.php
zabbix/include/classes/class.clink.php
zabbix/include/classes/class.clist.php
@ -365,6 +367,8 @@ zabbix/include/triggers.inc.php
zabbix/include/users.inc.php
zabbix/include/validate.inc.php
zabbix/include/valuemap.inc.php
zabbix/include/xmlschemas/
zabbix/include/xmlschemas/screens.rng
zabbix/index.php
zabbix/instal.php
zabbix/items.php
@ -451,6 +455,8 @@ zabbix/styles/default.css
zabbix/styles/div.css
zabbix/styles/form.css
zabbix/styles/ie.css
zabbix/styles/ie_css_bb.css
zabbix/styles/ie_css_ob.css
zabbix/styles/ie_css_od.css
zabbix/styles/link.css
zabbix/styles/p.css