From 0039036f930212e7184a174b963a3681cb61dd94 Mon Sep 17 00:00:00 2001 From: Jurijs Klopovskis Date: Fri, 8 Oct 2021 14:52:18 +0300 Subject: ...G...... [ZBX-20008] removed curl and ldap linkage from agent2 cherry-picked from 938d0afc139eb45eb6d8dfab67a0f57f45e35eee conflicts: tests/libs/zbxserver/Makefile.am --- src/libs/zbxsysinfo/Makefile.am | 3 +++ src/libs/zbxsysinfo/common/Makefile.am | 12 +++++++++--- src/libs/zbxsysinfo/common/common.c | 5 ----- src/libs/zbxsysinfo/common/http_metrics.c | 30 ++++++++++++++++++++++++++++++ src/libs/zbxsysinfo/common/http_metrics.h | 27 +++++++++++++++++++++++++++ src/libs/zbxsysinfo/sysinfo.c | 15 +++++++++++++++ src/zabbix_agent/Makefile.am | 2 ++ src/zabbix_proxy/Makefile.am | 2 ++ src/zabbix_server/Makefile.am | 2 ++ 9 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 src/libs/zbxsysinfo/common/http_metrics.c create mode 100644 src/libs/zbxsysinfo/common/http_metrics.h (limited to 'src') diff --git a/src/libs/zbxsysinfo/Makefile.am b/src/libs/zbxsysinfo/Makefile.am index 7bfedfeedbd..6ac138b4fbb 100644 --- a/src/libs/zbxsysinfo/Makefile.am +++ b/src/libs/zbxsysinfo/Makefile.am @@ -34,6 +34,7 @@ noinst_LIBRARIES = \ libzbxagentsysinfo_a_CFLAGS = \ -DWITH_AGENT_METRICS \ -DWITH_COMMON_METRICS \ + -DWITH_HTTP_METRICS \ -DWITH_SIMPLE_METRICS \ -DWITH_SPECIFIC_METRICS \ -DWITH_HOSTNAME_METRIC @@ -53,6 +54,7 @@ libzbxagent2sysinfo_a_SOURCES = \ # SERVER version of sysinfo library libzbxserversysinfo_a_CFLAGS = \ -DWITH_COMMON_METRICS \ + -DWITH_HTTP_METRICS \ -DWITH_SIMPLE_METRICS libzbxserversysinfo_a_SOURCES = \ @@ -61,6 +63,7 @@ libzbxserversysinfo_a_SOURCES = \ # PROXY version of sysinfo library libzbxproxysysinfo_a_CFLAGS = \ -DWITH_COMMON_METRICS \ + -DWITH_HTTP_METRICS \ -DWITH_SIMPLE_METRICS \ -DWITH_HOSTNAME_METRIC diff --git a/src/libs/zbxsysinfo/common/Makefile.am b/src/libs/zbxsysinfo/common/Makefile.am index c63ec6be318..d6326a28ab2 100644 --- a/src/libs/zbxsysinfo/common/Makefile.am +++ b/src/libs/zbxsysinfo/common/Makefile.am @@ -1,6 +1,6 @@ ## Process this file with automake to produce Makefile.in -noinst_LIBRARIES = libcommonsysinfo.a +noinst_LIBRARIES = libcommonsysinfo.a libcommonsysinfo_http.a libcommonsysinfo_httpmetrics.a libcommonsysinfo_a_CFLAGS = -I@top_srcdir@/src/zabbix_agent/ @@ -15,11 +15,17 @@ libcommonsysinfo_a_SOURCES = \ dns.h \ file.c \ file.h \ - http.c \ - http.h \ net.c \ net.h \ system.c \ system.h \ zabbix_stats.c \ zabbix_stats.h + +libcommonsysinfo_http_a_SOURCES = \ + http.c \ + http.h + +libcommonsysinfo_httpmetrics_a_SOURCES = \ + http_metrics.c \ + http_metrics.h diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c index 9fa1705fe30..89016fbafcf 100644 --- a/src/libs/zbxsysinfo/common/common.c +++ b/src/libs/zbxsysinfo/common/common.c @@ -24,7 +24,6 @@ #include "file.h" #include "dir.h" -#include "http.h" #include "net.h" #include "dns.h" #include "system.h" @@ -60,10 +59,6 @@ ZBX_METRIC parameters_common[] = {"system.localtime", CF_HAVEPARAMS, SYSTEM_LOCALTIME, "utc"}, {"system.run", CF_HAVEPARAMS, SYSTEM_RUN, "echo test"}, - {"web.page.get", CF_HAVEPARAMS, WEB_PAGE_GET, "localhost,,80"}, - {"web.page.perf", CF_HAVEPARAMS, WEB_PAGE_PERF, "localhost,,80"}, - {"web.page.regexp", CF_HAVEPARAMS, WEB_PAGE_REGEXP, "localhost,,80,OK"}, - {"vfs.file.size", CF_HAVEPARAMS, VFS_FILE_SIZE, VFS_TEST_FILE}, {"vfs.file.time", CF_HAVEPARAMS, VFS_FILE_TIME, VFS_TEST_FILE ",modify"}, {"vfs.file.exists", CF_HAVEPARAMS, VFS_FILE_EXISTS, VFS_TEST_FILE}, diff --git a/src/libs/zbxsysinfo/common/http_metrics.c b/src/libs/zbxsysinfo/common/http_metrics.c new file mode 100644 index 00000000000..5d41a0f3d14 --- /dev/null +++ b/src/libs/zbxsysinfo/common/http_metrics.c @@ -0,0 +1,30 @@ +/* +** Zabbix +** Copyright (C) 2001-2021 Zabbix SIA +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#include "http.h" + +ZBX_METRIC parameters_common_http[] = +/* KEY FLAG FUNCTION TEST PARAMETERS */ +{ + {"web.page.get", CF_HAVEPARAMS, WEB_PAGE_GET, "localhost,,80"}, + {"web.page.perf", CF_HAVEPARAMS, WEB_PAGE_PERF, "localhost,,80"}, + {"web.page.regexp", CF_HAVEPARAMS, WEB_PAGE_REGEXP, "localhost,,80,OK"}, + + {NULL} +}; diff --git a/src/libs/zbxsysinfo/common/http_metrics.h b/src/libs/zbxsysinfo/common/http_metrics.h new file mode 100644 index 00000000000..8799a0d455c --- /dev/null +++ b/src/libs/zbxsysinfo/common/http_metrics.h @@ -0,0 +1,27 @@ +/* +** Zabbix +** Copyright (C) 2001-2021 Zabbix SIA +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +**/ + +#include "sysinfo.h" + +#ifndef ZABBIX_SYSINFO_COMMON_HTTP_METRICS_H +#define ZABBIX_SYSINFO_COMMON_HTTP_METRICS_H + +extern ZBX_METRIC parameters_common_http[]; + +#endif /* ZABBIX_SYSINFO_COMMON_HTTP_METRICS_H */ diff --git a/src/libs/zbxsysinfo/sysinfo.c b/src/libs/zbxsysinfo/sysinfo.c index 1cdec05eb76..872ed360218 100644 --- a/src/libs/zbxsysinfo/sysinfo.c +++ b/src/libs/zbxsysinfo/sysinfo.c @@ -38,6 +38,10 @@ # include "common/common.h" #endif +#ifdef WITH_HTTP_METRICS +# include "common/http_metrics.h" +#endif + #ifdef WITH_SIMPLE_METRICS # include "simple/simple.h" #endif @@ -241,6 +245,17 @@ void init_metrics(void) } #endif +#ifdef WITH_HTTP_METRICS + for (i = 0; NULL != parameters_common_http[i].key; i++) + { + if (SUCCEED != add_metric(¶meters_common_http[i], error, sizeof(error))) + { + zabbix_log(LOG_LEVEL_CRIT, "cannot add item key: %s", error); + exit(EXIT_FAILURE); + } + } +#endif + #ifdef WITH_SPECIFIC_METRICS for (i = 0; NULL != parameters_specific[i].key; i++) { diff --git a/src/zabbix_agent/Makefile.am b/src/zabbix_agent/Makefile.am index 55aa04c00d4..d53a732b716 100644 --- a/src/zabbix_agent/Makefile.am +++ b/src/zabbix_agent/Makefile.am @@ -47,6 +47,8 @@ zabbix_agentd_LDADD = \ $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \ $(top_builddir)/src/libs/zbxsysinfo/agent/libagentsysinfo.a \ $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \ $(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \ $(top_builddir)/src/libs/zbxlog/libzbxlog.a \ $(top_builddir)/src/libs/zbxregexp/libzbxregexp.a \ diff --git a/src/zabbix_proxy/Makefile.am b/src/zabbix_proxy/Makefile.am index e9953bc6027..d38d8249bf6 100644 --- a/src/zabbix_proxy/Makefile.am +++ b/src/zabbix_proxy/Makefile.am @@ -47,6 +47,8 @@ zabbix_proxy_LDADD = \ $(top_builddir)/src/zabbix_server/availability/libavailability.a \ $(top_builddir)/src/libs/zbxsysinfo/libzbxproxysysinfo.a \ $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \ $(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \ $(top_builddir)/src/libs/zbxsysinfo/$(ARCH)/libspechostnamesysinfo.a \ $(top_builddir)/src/libs/zbxlog/libzbxlog.a \ diff --git a/src/zabbix_server/Makefile.am b/src/zabbix_server/Makefile.am index 6c2a565f9a8..9790ad6d39f 100644 --- a/src/zabbix_server/Makefile.am +++ b/src/zabbix_server/Makefile.am @@ -78,6 +78,8 @@ zabbix_server_LDADD = \ $(top_builddir)/src/libs/zbxprometheus/libzbxprometheus.a \ $(top_builddir)/src/libs/zbxsysinfo/libzbxserversysinfo.a \ $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_httpmetrics.a \ + $(top_builddir)/src/libs/zbxsysinfo/common/libcommonsysinfo_http.a \ $(top_builddir)/src/libs/zbxsysinfo/simple/libsimplesysinfo.a \ $(top_builddir)/src/libs/zbxlog/libzbxlog.a \ $(top_builddir)/src/libs/zbxdbcache/libzbxdbcache.a \ -- cgit v1.2.3