Bug 234831 - net-mgmt/zabbix*-agent: Add libcurl support
Summary: net-mgmt/zabbix*-agent: Add libcurl support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Danilo G. Baio
Depends on:
Reported: 2019-01-10 20:34 UTC by Marcin Gryszkalis
Modified: 2019-03-27 11:42 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pg)

net.tcp.service on agent prototype (17.24 KB, image/png)
2019-03-13 10:57 UTC, Marcin Gryszkalis
no flags Details
zabbix-agent-cURL.patch (7.30 KB, patch)
2019-03-23 11:30 UTC, Danilo G. Baio
pg: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Gryszkalis 2019-01-10 20:34:41 UTC
the zabbix agentd doesn't enable curl option (this causes removal of https checks).

The message one can see is:
Support for HTTPS check was not compiled in.

The problem probably affects other zabbix agent versions too.

I successfully patched Makefiles for zabbix34-agent and zabbix34-server (master port) but I'm not sure if it's the right thing to do with master/slave ports.


--- Makefile.orig       2019-01-10 15:15:54.828171000 +0100
+++ Makefile    2019-01-10 15:16:10.502148000 +0100
@@ -8,7 +8,7 @@
 MASTERDIR=     ${.CURDIR}/../zabbix34-server
 PLIST=         ${PKGDIR}/pkg-plist.agent
-OPTIONS_DEFINE=                IPV6
+OPTIONS_DEFINE=                IPV6 CURL
 .include "${MASTERDIR}/Makefile"


--- Makefile.orig       2019-01-10 21:25:44.617241000 +0100
+++ Makefile    2019-01-10 15:22:39.515339000 +0100
@@ -124,6 +124,9 @@
 .elif ${ZABBIX_BUILD} == "agent"
+CURL_DESC=      Support for web monitoring
+CURL_LIB_DEPENDS=   libcurl.so:ftp/curl
 .endif # if ${ZABBIX_BUILD} != "agent" && ${ZABBIX_BUILD} != "java"
Comment 1 pg 2019-01-11 13:23:42 UTC
The curl options is huge so off by default. If you are strictly using packages, I would suggest using poudriere [1] to create a custom package repository, allowing you to customise port OPTIONS while continuing to use packages.
Comment 2 Marcin Gryszkalis 2019-01-11 15:04:28 UTC
(In reply to pg from comment #1)

I do not care if it's on or off by default. It just doesn't exist in -agent port (it's available only in -server port). 

I also don't use packages.
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-02-12 22:52:53 UTC
net-mgmt/zabbix24-agent||2017-05-29|Has expired: Upstream has declared this version EoL in 2016 (Q1).
Comment 4 Walter Schwarzenfeld freebsd_triage 2019-02-12 22:53:45 UTC
Sorry , I read it wrong (24 instead of 34).
Comment 5 Danilo G. Baio freebsd_committer 2019-02-17 14:32:57 UTC
(In reply to Marcin Gryszkalis from comment #2)


Actually, CURL is enabled by default on server/proxy.

Where and how did you get this message?
"Support for HTTPS check was not compiled in."

As far I'm concerned, Web monitoring is made through Proxy/Servers, not through the agent.

I'll appreciate if you can help me simulate this on my machine (Zabbix 4).

Just a note:
I checked agent packages distributed by Zabbix LLC and they are linked with libcurl, 
but I didn't find any reference to curl in the zabbix_agent source code, just in Makefile.
Comment 6 Danilo G. Baio freebsd_committer 2019-02-23 11:09:22 UTC
Couldn't reproduce, if you have more information, please, reopen this PR.

Thank you!
Comment 7 Marcin Gryszkalis 2019-03-13 10:55:02 UTC
It's not for web scenarios but for net.tcp.service with service == 'https'
Note that you can have net.tcp.service check as agent-side check.

in ./libs/zbxsysinfo/simple/simple.c

308 int check_service(AGENT_REQUEST *request, const char *default_addr, AGENT_RESULT *result, int perf)
309 {

344     if (0 == strncmp("net.tcp.service", get_rkey(request), 15))
345     {

407         else if (0 == strcmp(service, "https"))
408         {
409 #ifdef HAVE_LIBCURL
410             if (NULL == port_str || '\0' == *port_str)
411                 port = ZBX_DEFAULT_HTTPS_PORT;
412             ret = check_https(ip, port, CONFIG_TIMEOUT, &value_int);
413 #else
414             SET_MSG_RESULT(result, zbx_strdup(NULL, "Support for HTTPS check was not compiled in."));
415 #endif
416         }

% strings /usr/local/sbin/zabbix_agentd | grep HTTPS.check
Support for HTTPS check was not compiled in.
Comment 8 Marcin Gryszkalis 2019-03-13 10:57:39 UTC
Created attachment 202838 [details]
net.tcp.service on agent prototype

I use it as prototype in autodiscovery but it can be ordinary item too.
Comment 9 Marcin Gryszkalis 2019-03-13 11:03:37 UTC
You can also easily test it with zabbix_get

% zabbix_get -s -k 'net.tcp.service[https,google.com]'
ZBX_NOTSUPPORTED: Support for HTTPS check was not compiled in.

patched and linked with curl:
% zabbix_get -s -k 'net.tcp.service[https,google.com']
Comment 10 Danilo G. Baio freebsd_committer 2019-03-21 22:35:23 UTC
(In reply to Marcin Gryszkalis from comment #9)

Good catch, thanks for the information.

So, makes sense to have CURL option on all versions of zabbix-agent.
Comment 11 Danilo G. Baio freebsd_committer 2019-03-23 11:30:56 UTC
Created attachment 203066 [details]

Add option CURL on all zabbix agent
Comment 12 pg 2019-03-25 06:33:56 UTC
Comment on attachment 203066 [details]

Approved, thanks!
Comment 13 commit-hook freebsd_committer 2019-03-27 11:37:27 UTC
A commit references this bug:

Author: dbaio
Date: Wed Mar 27 11:37:12 UTC 2019
New revision: 496943
URL: https://svnweb.freebsd.org/changeset/ports/496943

  net-mgmt/zabbix*-agent: Add libcurl support

  This enables zabbix_agent simple_checks (net.tcp.service) for https.

  PR:		234831
  Reported by:	Marcin Gryszkalis <mg@fork.pl>
  Approved by:	Pakhom Golynga <pg@pakhom.spb.ru> (maintainer)

Comment 14 Danilo G. Baio freebsd_committer 2019-03-27 11:42:15 UTC
Committed, thanks!