1 |
commit: 230977ee8c2ce01b6b5d1e8c5900f6c4e496c550 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Aug 2 18:40:08 2018 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Aug 2 18:40:33 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=230977ee |
7 |
|
8 |
app-metrics/collectd: drop old |
9 |
|
10 |
Package-Manager: Portage-2.3.44, Repoman-2.3.10 |
11 |
|
12 |
app-metrics/collectd/Manifest | 1 - |
13 |
app-metrics/collectd/collectd-5.7.2-r3.ebuild | 548 ----------- |
14 |
.../collectd/files/collectd-5.6.0-gentoo.patch | 153 --- |
15 |
.../files/collectd-5.7.2-CVE-2017-16820.patch | 39 - |
16 |
.../collectd/files/collectd-5.7.2-issue-2443.patch | 160 --- |
17 |
.../files/collectd-5.7.2-varnish-5.2+.patch | 1018 -------------------- |
18 |
6 files changed, 1919 deletions(-) |
19 |
|
20 |
diff --git a/app-metrics/collectd/Manifest b/app-metrics/collectd/Manifest |
21 |
index 9fb11846c23..36255f3caad 100644 |
22 |
--- a/app-metrics/collectd/Manifest |
23 |
+++ b/app-metrics/collectd/Manifest |
24 |
@@ -1,2 +1 @@ |
25 |
-DIST collectd-5.7.2.tar.bz2 1798777 BLAKE2B 4af359a773457bb9c05b6a301d7728eea7598c200f7ca534875b07d1d011b280ab138f680d9607723f14523dd71dcbec3a41e0d8d183848c8ef809cef86c2b8f SHA512 8844b67159f8da2203b5ac57ef19fce0a01050a016174d196b48b5fb24925ad2935af9bdd9af06097ff663499abc496cdcc2d9e9a10f403f8d707c465c1a88f3 |
26 |
DIST collectd-5.8.0.tar.bz2 1686017 BLAKE2B 26d995cdb9c25869bf96a056e6ba879de9f009fd4bbf1364a7dedba93b822e57c4b606ca8c84da68cc29db8e77333047695e85d7eb101080de9cee783240f5ea SHA512 1b3d0cc44e2ca54e13eebf292074f1efa8b33d6800d04405e0eaaa2dd1cb2416c6eae580729fb5aead23a5039f41ffe8a9989a907a8c18be8f867f1099fc0008 |
27 |
|
28 |
diff --git a/app-metrics/collectd/collectd-5.7.2-r3.ebuild b/app-metrics/collectd/collectd-5.7.2-r3.ebuild |
29 |
deleted file mode 100644 |
30 |
index 32854c2b44a..00000000000 |
31 |
--- a/app-metrics/collectd/collectd-5.7.2-r3.ebuild |
32 |
+++ /dev/null |
33 |
@@ -1,548 +0,0 @@ |
34 |
-# Copyright 1999-2018 Gentoo Foundation |
35 |
-# Distributed under the terms of the GNU General Public License v2 |
36 |
- |
37 |
-EAPI="6" |
38 |
- |
39 |
-PYTHON_COMPAT=( python{2_7,3_4,3_5,3_6} ) |
40 |
-JAVA_PKG_OPT_USE="collectd_plugins_java" |
41 |
- |
42 |
-inherit autotools fcaps flag-o-matic java-pkg-opt-2 linux-info multilib perl-functions python-single-r1 systemd tmpfiles user |
43 |
- |
44 |
-DESCRIPTION="Collects system statistics and provides mechanisms to store the values" |
45 |
- |
46 |
-HOMEPAGE="https://collectd.org/" |
47 |
-SRC_URI="${HOMEPAGE%/}/files/${P}.tar.bz2" |
48 |
- |
49 |
-LICENSE="GPL-2" |
50 |
-SLOT="0" |
51 |
-KEYWORDS="alpha amd64 arm x86" |
52 |
-IUSE="contrib debug java kernel_Darwin kernel_FreeBSD kernel_linux perl selinux static-libs udev xfs" |
53 |
- |
54 |
-# The plugin lists have to follow here since they extend IUSE |
55 |
- |
56 |
-# Plugins that don't build (e.g. dependencies not in Gentoo) |
57 |
-# apple_sensors: Requires libIOKit |
58 |
-# aquaero: Requires aerotools-ng/libaquaero5 |
59 |
-# barometer: Requires libi2c (i2c_smbus_read_i2c_block_data) |
60 |
-# dpdkstat: Requires dpdk |
61 |
-# grpc: Requires libgrpc |
62 |
-# intel_rdt Requires libpqos from intel-cmt-cat project |
63 |
-# lpar: Requires libperfstat (AIX only) |
64 |
-# mic: Requires Intel Many Integrated Core Architecture API |
65 |
-# (part of Intel's Xeon Phi software) |
66 |
-# netapp: Requires libnetapp (http://communities.netapp.com/docs/DOC-1110) |
67 |
-# pf: Requires BSD packet filter |
68 |
-# pinba: Requires MySQL Pinba engine (http://pinba.org/) |
69 |
-# tape: Requires libkstat (Solaris only) |
70 |
-# write_mongodb: https://github.com/collectd/collectd/issues/492 |
71 |
-# write_riemann: Requires riemann-c-client |
72 |
-# xmms: Requires libxmms (v1) |
73 |
-# zone: Solaris only... |
74 |
-COLLECTD_IMPOSSIBLE_PLUGINS="apple_sensors aquaero barometer dpdkstat grpc |
75 |
- intel_rdt lpar mic netapp pf pinba tape write_mongodb |
76 |
- write_riemann xmms zone" |
77 |
- |
78 |
-# Plugins that have been (compile) tested and can be enabled via COLLECTD_PLUGINS |
79 |
-COLLECTD_TESTED_PLUGINS="aggregation amqp apache apcups ascent battery bind |
80 |
- ceph cgroups chrony conntrack contextswitch cpu cpufreq cpusleep |
81 |
- csv curl curl_json curl_xml dbi df disk dns drbd email |
82 |
- entropy ethstat exec fhcount filecount fscache gmond gps hddtemp |
83 |
- hugepages interface ipc ipmi iptables ipvs irq java lua |
84 |
- load logfile log_logstash lvm madwifi match_empty_counter |
85 |
- match_hashed match_regex match_timediff match_value mbmon md |
86 |
- memcachec memcached memory modbus mqtt multimeter mysql netlink |
87 |
- network network nfs nginx notify_desktop notify_email notify_nagios |
88 |
- ntpd numa nut olsrd onewire openldap openvpn oracle perl ping |
89 |
- postgresql powerdns processes protocols python python redis |
90 |
- routeros rrdcached rrdtool sensors serial sigrok smart snmp statsd |
91 |
- swap syslog table tail tail_csv target_notification target_replace |
92 |
- target_scale target_set tcpconns teamspeak2 ted thermal threshold |
93 |
- tokyotyrant turbostat unixsock uptime users uuid varnish virt |
94 |
- vmem vserver wireless write_graphite write_http write_kafka |
95 |
- write_log write_prometheus write_redis write_sensu write_tsdb |
96 |
- xencpu zfs_arc zookeeper" |
97 |
- |
98 |
-COLLECTD_DISABLED_PLUGINS="${COLLECTD_IMPOSSIBLE_PLUGINS}" |
99 |
- |
100 |
-COLLECTD_ALL_PLUGINS=${COLLECTD_TESTED_PLUGINS} |
101 |
- |
102 |
-for plugin in ${COLLECTD_ALL_PLUGINS}; do |
103 |
- IUSE="${IUSE} collectd_plugins_${plugin}" |
104 |
-done |
105 |
-unset plugin |
106 |
- |
107 |
-# Now come the dependencies. |
108 |
- |
109 |
-COMMON_DEPEND=" |
110 |
- dev-libs/libgcrypt:= |
111 |
- dev-libs/libltdl:0= |
112 |
- perl? ( dev-lang/perl:=[ithreads] ) |
113 |
- udev? ( virtual/udev ) |
114 |
- xfs? ( sys-fs/xfsprogs ) |
115 |
- collectd_plugins_amqp? ( net-libs/rabbitmq-c ) |
116 |
- collectd_plugins_apache? ( net-misc/curl:0= ) |
117 |
- collectd_plugins_ascent? ( net-misc/curl:0= dev-libs/libxml2:2= ) |
118 |
- collectd_plugins_bind? ( net-misc/curl:0= dev-libs/libxml2:2= ) |
119 |
- collectd_plugins_ceph? ( dev-libs/yajl:= ) |
120 |
- collectd_plugins_curl? ( net-misc/curl:0= ) |
121 |
- collectd_plugins_curl_json? ( net-misc/curl:0= dev-libs/yajl:= ) |
122 |
- collectd_plugins_curl_xml? ( net-misc/curl:0= dev-libs/libxml2:2= ) |
123 |
- collectd_plugins_dbi? ( dev-db/libdbi ) |
124 |
- collectd_plugins_dns? ( net-libs/libpcap ) |
125 |
- collectd_plugins_gmond? ( sys-cluster/ganglia ) |
126 |
- collectd_plugins_gps? ( sci-geosciences/gpsd:= ) |
127 |
- collectd_plugins_ipmi? ( >=sys-libs/openipmi-2.0.16-r1 ) |
128 |
- collectd_plugins_iptables? ( >=net-firewall/iptables-1.4.13:0= ) |
129 |
- collectd_plugins_log_logstash? ( dev-libs/yajl:= ) |
130 |
- collectd_plugins_lua? ( dev-lang/lua:0= ) |
131 |
- collectd_plugins_lvm? ( sys-fs/lvm2 ) |
132 |
- collectd_plugins_memcachec? ( dev-libs/libmemcached ) |
133 |
- collectd_plugins_modbus? ( dev-libs/libmodbus ) |
134 |
- collectd_plugins_mqtt? ( app-misc/mosquitto ) |
135 |
- collectd_plugins_mysql? ( virtual/libmysqlclient:= ) |
136 |
- collectd_plugins_netlink? ( net-libs/libmnl ) |
137 |
- collectd_plugins_nginx? ( net-misc/curl:0= ) |
138 |
- collectd_plugins_notify_desktop? ( x11-libs/libnotify ) |
139 |
- collectd_plugins_notify_email? ( net-libs/libesmtp ) |
140 |
- collectd_plugins_nut? ( >=sys-power/nut-2.7.2-r2 ) |
141 |
- collectd_plugins_openldap? ( net-nds/openldap ) |
142 |
- collectd_plugins_onewire? ( >=sys-fs/owfs-3.1:= ) |
143 |
- collectd_plugins_oracle? ( dev-db/oracle-instantclient-basic ) |
144 |
- collectd_plugins_perl? ( dev-lang/perl:=[ithreads] ) |
145 |
- collectd_plugins_ping? ( net-libs/liboping ) |
146 |
- collectd_plugins_postgresql? ( dev-db/postgresql:= ) |
147 |
- collectd_plugins_python? ( ${PYTHON_DEPS} ) |
148 |
- collectd_plugins_redis? ( dev-libs/hiredis:= ) |
149 |
- collectd_plugins_routeros? ( net-libs/librouteros ) |
150 |
- collectd_plugins_rrdcached? ( net-analyzer/rrdtool:= ) |
151 |
- collectd_plugins_rrdtool? ( net-analyzer/rrdtool:= ) |
152 |
- collectd_plugins_sensors? ( sys-apps/lm_sensors ) |
153 |
- collectd_plugins_sigrok? ( <sci-libs/libsigrok-0.4:= dev-libs/glib:2 ) |
154 |
- collectd_plugins_smart? ( dev-libs/libatasmart ) |
155 |
- collectd_plugins_snmp? ( net-analyzer/net-snmp ) |
156 |
- collectd_plugins_tokyotyrant? ( net-misc/tokyotyrant ) |
157 |
- collectd_plugins_varnish? ( www-servers/varnish ) |
158 |
- collectd_plugins_virt? ( app-emulation/libvirt:= dev-libs/libxml2:2= ) |
159 |
- collectd_plugins_write_http? ( net-misc/curl:0= dev-libs/yajl:= ) |
160 |
- collectd_plugins_write_kafka? ( >=dev-libs/librdkafka-0.9.0.99:= dev-libs/yajl:= ) |
161 |
- collectd_plugins_write_prometheus? ( >=dev-libs/protobuf-c-1.2.1-r1:= net-libs/libmicrohttpd:= ) |
162 |
- collectd_plugins_write_redis? ( dev-libs/hiredis:= ) |
163 |
- collectd_plugins_xencpu? ( app-emulation/xen-tools:= ) |
164 |
- |
165 |
- kernel_FreeBSD? ( |
166 |
- collectd_plugins_disk? ( sys-libs/libstatgrab:= ) |
167 |
- collectd_plugins_interface? ( sys-libs/libstatgrab:= ) |
168 |
- collectd_plugins_load? ( sys-libs/libstatgrab:= ) |
169 |
- collectd_plugins_memory? ( sys-libs/libstatgrab:= ) |
170 |
- collectd_plugins_swap? ( sys-libs/libstatgrab:= ) |
171 |
- collectd_plugins_users? ( sys-libs/libstatgrab:= ) |
172 |
- )" |
173 |
- |
174 |
-# Enforcing !=sys-kernel/linux-headers-4.5 > due to #577846 |
175 |
-DEPEND="${COMMON_DEPEND} |
176 |
- collectd_plugins_iptables? ( || ( <=sys-kernel/linux-headers-4.4 >=sys-kernel/linux-headers-4.6 ) ) |
177 |
- collectd_plugins_java? ( >=virtual/jdk-1.6 ) |
178 |
- virtual/pkgconfig" |
179 |
- |
180 |
-RDEPEND="${COMMON_DEPEND} |
181 |
- collectd_plugins_java? ( >=virtual/jre-1.6 ) |
182 |
- collectd_plugins_syslog? ( virtual/logger ) |
183 |
- selinux? ( sec-policy/selinux-collectd ) |
184 |
- !<sys-apps/openrc-0.18.2" |
185 |
- |
186 |
-REQUIRED_USE=" |
187 |
- collectd_plugins_python? ( ${PYTHON_REQUIRED_USE} ) |
188 |
- collectd_plugins_smart? ( udev )" |
189 |
- |
190 |
-PATCHES=( |
191 |
- "${FILESDIR}"/${PN}-5.6.0-gentoo.patch |
192 |
- "${FILESDIR}"/${PN}-5.7.2-issue-2443.patch |
193 |
- "${FILESDIR}"/${PN}-5.7.2-CVE-2017-16820.patch |
194 |
- "${FILESDIR}"/${PN}-5.7.2-varnish-5.2+.patch |
195 |
-) |
196 |
- |
197 |
-# @FUNCTION: collectd_plugin_kernel_linux |
198 |
-# @DESCRIPTION: |
199 |
-# USAGE: <plugin name> <kernel_options> <severity> |
200 |
-# kernel_options is a list of kernel configurations options; the check tests whether at least |
201 |
-# one of them is enabled. If no, depending on the third argument an elog, ewarn, or eerror message |
202 |
-# is emitted. |
203 |
-collectd_plugin_kernel_linux() { |
204 |
- local multi_opt opt |
205 |
- if has ${1} ${COLLECTD_ALL_PLUGINS}; then |
206 |
- if use collectd_plugins_${1}; then |
207 |
- for opt in ${2}; do |
208 |
- if linux_chkconfig_present ${opt}; then |
209 |
- return 0; |
210 |
- fi |
211 |
- done |
212 |
- multi_opt=${2//\ /\ or\ } |
213 |
- case ${3} in |
214 |
- (info) |
215 |
- elog "The ${1} plugin can use kernel features that are disabled now; enable ${multi_opt} in your kernel" |
216 |
- ;; |
217 |
- (warn) |
218 |
- ewarn "The ${1} plugin uses kernel features that are disabled now; enable ${multi_opt} in your kernel" |
219 |
- ;; |
220 |
- (error) |
221 |
- eerror "The ${1} plugin needs kernel features that are disabled now; enable ${multi_opt} in your kernel" |
222 |
- ;; |
223 |
- (*) |
224 |
- die "function collectd_plugin_kernel_linux called with invalid third argument" |
225 |
- ;; |
226 |
- esac |
227 |
- fi |
228 |
- fi |
229 |
-} |
230 |
- |
231 |
-collectd_linux_kernel_checks() { |
232 |
- if ! linux_chkconfig_present PROC_FS; then |
233 |
- ewarn "/proc file system support is disabled, many plugins will not be able to read any statistics from your system unless you enable PROC_FS in your kernel" |
234 |
- fi |
235 |
- |
236 |
- if ! linux_chkconfig_present SYSFS; then |
237 |
- ewarn "/sys file system support is disabled, many plugins will not be able to read any statistics from your system unless you enable SYSFS in your kernel" |
238 |
- fi |
239 |
- |
240 |
- # battery.c: /proc/pmu/battery_%i |
241 |
- # battery.c: /proc/acpi/battery |
242 |
- collectd_plugin_kernel_linux battery ACPI_BATTERY warn |
243 |
- |
244 |
- # cgroups.c: /sys/fs/cgroup/ |
245 |
- collectd_plugin_kernel_linux cgroups CGROUPS warn |
246 |
- |
247 |
- # cpufreq.c: /sys/devices/system/cpu/cpu%d/cpufreq/ |
248 |
- collectd_plugin_kernel_linux cpufreq SYSFS warn |
249 |
- collectd_plugin_kernel_linux cpufreq CPU_FREQ_STAT warn |
250 |
- |
251 |
- # drbd.c: /proc/drbd |
252 |
- collectd_plugin_kernel_linux drbd BLK_DEV_DRBD warn |
253 |
- |
254 |
- # conntrack.c: /proc/sys/net/netfilter/* |
255 |
- collectd_plugin_kernel_linux conntrack NETFILTER warn |
256 |
- |
257 |
- # fscache.c: /proc/fs/fscache/stats |
258 |
- collectd_plugin_kernel_linux fscache FSCACHE warn |
259 |
- |
260 |
- # nfs.c: /proc/net/rpc/nfs |
261 |
- # nfs.c: /proc/net/rpc/nfsd |
262 |
- collectd_plugin_kernel_linux nfs NFS_COMMON warn |
263 |
- |
264 |
- # serial.c: /proc/tty/driver/serial |
265 |
- # serial.c: /proc/tty/driver/ttyS |
266 |
- collectd_plugin_kernel_linux serial SERIAL_CORE warn |
267 |
- |
268 |
- # swap.c: /proc/meminfo |
269 |
- collectd_plugin_kernel_linux swap SWAP warn |
270 |
- |
271 |
- # thermal.c: /proc/acpi/thermal_zone |
272 |
- # thermal.c: /sys/class/thermal |
273 |
- collectd_plugin_kernel_linux thermal ACPI_THERMAL warn |
274 |
- |
275 |
- # turbostat.c: /dev/cpu/%d/msr |
276 |
- collectd_plugin_kernel_linux turbostat X86_MSR warn |
277 |
- |
278 |
- # vmem.c: /proc/vmstat |
279 |
- collectd_plugin_kernel_linux vmem VM_EVENT_COUNTERS warn |
280 |
- |
281 |
- # vserver.c: /proc/virtual |
282 |
- collectd_plugin_kernel_linux vserver VSERVER warn |
283 |
- |
284 |
- # uuid.c: /sys/hypervisor/uuid |
285 |
- collectd_plugin_kernel_linux uuid SYSFS info |
286 |
- |
287 |
- # wireless.c: /proc/net/wireless |
288 |
- collectd_plugin_kernel_linux wireless "WIRELESS MAC80211 IEEE80211" warn |
289 |
- |
290 |
- # zfs_arc.c: /proc/spl/kstat/zfs/arcstats |
291 |
- collectd_plugin_kernel_linux zfs_arc "SPL ZFS" warn |
292 |
-} |
293 |
- |
294 |
-pkg_setup() { |
295 |
- if use kernel_linux; then |
296 |
- linux-info_pkg_setup |
297 |
- |
298 |
- if linux_config_exists; then |
299 |
- einfo "Checking your linux kernel configuration:" |
300 |
- collectd_linux_kernel_checks |
301 |
- else |
302 |
- elog "Cannot find a linux kernel configuration. Continuing anyway." |
303 |
- fi |
304 |
- fi |
305 |
- |
306 |
- if use collectd_plugins_java; then |
307 |
- java-pkg-opt-2_pkg_setup |
308 |
- fi |
309 |
- |
310 |
- use collectd_plugins_python && python-single-r1_pkg_setup |
311 |
- |
312 |
- enewgroup collectd |
313 |
- enewuser collectd -1 -1 /var/lib/collectd collectd |
314 |
-} |
315 |
- |
316 |
-src_prepare() { |
317 |
- default |
318 |
- |
319 |
- # There's some strange prefix handling in the default config file, resulting in |
320 |
- # paths like "/usr/var/..." |
321 |
- sed -i -e "s:@prefix@/var:/var:g" src/collectd.conf.in || die |
322 |
- |
323 |
- # fix installdirs for perl, bug 444360 |
324 |
- sed -i -e 's/INSTALL_BASE=$(DESTDIR)$(prefix) //' bindings/Makefile.am || die |
325 |
- |
326 |
- # Adjust upstream's systemd unit |
327 |
- # - Get rid of EnvironmentFile directive; These files don't exist on Gentoo! |
328 |
- # - Add User=collectd to run collectd as user "collectd" per default |
329 |
- sed -i \ |
330 |
- -e '/^EnvironmentFile=.*/d' \ |
331 |
- -e '/^\[Service\]/aUser=collectd' \ |
332 |
- contrib/systemd.${PN}.service || die |
333 |
- |
334 |
- if use collectd_plugins_java; then |
335 |
- # Set javac -source and -target flags according to (R)DEPEND. |
336 |
- sed -i -e "s/\$(JAVAC)/\0 $(java-pkg_javac-args)/g" bindings/java/Makefile.am || die |
337 |
- fi |
338 |
- |
339 |
- ebegin "Removing bundled libltdl" |
340 |
- rm -rf libltdl || die |
341 |
- eend 0 |
342 |
- |
343 |
- eautoreconf |
344 |
-} |
345 |
- |
346 |
-src_configure() { |
347 |
- # Now come the lists of os-dependent plugins. Any plugin that is not listed anywhere here |
348 |
- # should work independent of the operating system. |
349 |
- |
350 |
- local linux_plugins="barometer battery cpu cpufreq disk |
351 |
- drbd entropy ethstat hugepages interface iptables |
352 |
- ipvs irq ipc load memory md netlink nfs numa processes |
353 |
- serial swap tcpconns thermal turbostat users vmem wireless |
354 |
- zfc_arc" |
355 |
- |
356 |
- local need_libstatgrab=0 |
357 |
- local libstatgrab_plugins="cpu disk interface load memory swap users" |
358 |
- local bsd_plugins="cpu tcpconns ${libstatgrab_plugins} zfc_arc" |
359 |
- |
360 |
- local darwin_plugins="apple_sensors battery cpu disk interface memory processes tcpconns" |
361 |
- |
362 |
- local osdependent_plugins="${linux_plugins} ${bsd_plugins} ${darwin_plugins}" |
363 |
- local myos_plugins="" |
364 |
- if use kernel_linux; then |
365 |
- einfo "Enabling Linux plugins." |
366 |
- myos_plugins=${linux_plugins} |
367 |
- elif use kernel_FreeBSD; then |
368 |
- einfo "Enabling FreeBSD plugins." |
369 |
- myos_plugins=${bsd_plugins} |
370 |
- elif use kernel_Darwin; then |
371 |
- einfo "Enabling Darwin plugins." |
372 |
- myos_plugins=${darwin_plugins} |
373 |
- fi |
374 |
- |
375 |
- local myconf="--disable-werror" |
376 |
- |
377 |
- # Do we debug? |
378 |
- myconf+=" $(use_enable debug)" |
379 |
- |
380 |
- # udev support? |
381 |
- # Required for smart plugin via REQUIRED_USE; Optional for disk plugin |
382 |
- if use udev; then |
383 |
- myconf+=" --with-libudev" |
384 |
- else |
385 |
- myconf+=" --without-libudev" |
386 |
- fi |
387 |
- |
388 |
- local plugin |
389 |
- |
390 |
- # Disable what needs to be disabled. |
391 |
- for plugin in ${COLLECTD_DISABLED_PLUGINS}; do |
392 |
- myconf+=" --disable-${plugin}" |
393 |
- done |
394 |
- |
395 |
- # Set enable/disable for each single plugin. |
396 |
- for plugin in ${COLLECTD_ALL_PLUGINS}; do |
397 |
- if has ${plugin} ${osdependent_plugins}; then |
398 |
- # plugin is os-dependent ... |
399 |
- if has ${plugin} ${myos_plugins}; then |
400 |
- # ... and available in this os |
401 |
- myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})" |
402 |
- # ... must we link against libstatgrab? Bug #541518 |
403 |
- if use kernel_FreeBSD && has ${plugin} ${libstatgrab_plugins}; then |
404 |
- einfo "We must link against libstatgrab due to plugin \"${plugin}\" ..." |
405 |
- need_libstatgrab=1 |
406 |
- fi |
407 |
- else |
408 |
- # ... and NOT available in this os |
409 |
- if use collectd_plugins_${plugin}; then |
410 |
- ewarn "You try to enable the ${plugin} plugin, but it is not available for this" |
411 |
- ewarn "kernel. Disabling it automatically." |
412 |
- fi |
413 |
- myconf+=" --disable-${plugin}" |
414 |
- fi |
415 |
- elif [[ "${plugin}" = "collectd_plugins_perl" ]]; then |
416 |
- if use collectd_plugins_perl && ! use perl; then |
417 |
- ewarn "Perl plugin disabled as perl bindings disabled by -perl use flag" |
418 |
- myconf+= --disable-perl |
419 |
- else |
420 |
- myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})" |
421 |
- fi |
422 |
- else |
423 |
- myconf+=" $(use_enable collectd_plugins_${plugin} ${plugin})" |
424 |
- fi |
425 |
- done |
426 |
- |
427 |
- if [ "${need_libstatgrab}" -eq 1 ]; then |
428 |
- myconf+=" --with-libstatgrab" |
429 |
- else |
430 |
- myconf+=" --without-libstatgrab" |
431 |
- fi |
432 |
- |
433 |
- # JAVA_HOME is set by eclasses. |
434 |
- if use collectd_plugins_java; then |
435 |
- myconf+=" --with-java" |
436 |
- fi |
437 |
- |
438 |
- # Need libiptc ONLY for iptables. If we try to use it otherwise bug 340109 happens. |
439 |
- # lots of libs are only needed for plugins, if they are disabled, also disable the lib |
440 |
- use collectd_plugins_iptables || myconf+=" --with-libiptc=no" |
441 |
- use collectd_plugins_openldap || myconf+=" --with-libldap=no" |
442 |
- use collectd_plugins_redis || use collectd_plugins_write_redis || myconf+=" --with-libhiredis=no" |
443 |
- use collectd_plugins_smart || myconf+=" --with-libatasmart=no" |
444 |
- use collectd_plugins_gps || myconf+=" --with-libgps=no" |
445 |
- |
446 |
- if use perl; then |
447 |
- myconf+=" --with-perl-bindings=INSTALLDIRS=vendor" |
448 |
- else |
449 |
- myconf+=" --without-perl-bindings" |
450 |
- fi |
451 |
- |
452 |
- # No need for v5upgrade |
453 |
- myconf+=" --disable-target_v5upgrade" |
454 |
- |
455 |
- # Python |
456 |
- if use collectd_plugins_python; then |
457 |
- myconf+=" --with-libpython=yes" |
458 |
- export PYTHON_CONFIG=$(python_get_PYTHON_CONFIG) |
459 |
- else |
460 |
- myconf+=" --with-libpython=no" |
461 |
- fi |
462 |
- |
463 |
- # XFS support |
464 |
- myconf+=" $(use_enable xfs)" |
465 |
- |
466 |
- # Finally, run econf. |
467 |
- KERNEL_DIR="${KERNEL_DIR}" econf --config-cache \ |
468 |
- $(use_enable static-libs static) \ |
469 |
- --localstatedir=/var ${myconf} |
470 |
-} |
471 |
- |
472 |
-src_install() { |
473 |
- emake DESTDIR="${D%/}" install |
474 |
- |
475 |
- perl_delete_localpod |
476 |
- |
477 |
- find "${ED}"usr/ -name "*.la" -delete || die |
478 |
- |
479 |
- if use collectd_plugins_java; then |
480 |
- java-pkg_regjar "${ED}"usr/share/${PN}/java/*.jar |
481 |
- fi |
482 |
- |
483 |
- fowners root:collectd /etc/collectd.conf |
484 |
- fperms u=rw,g=r,o= /etc/collectd.conf |
485 |
- |
486 |
- dodoc AUTHORS ChangeLog README |
487 |
- |
488 |
- if use contrib ; then |
489 |
- insinto /usr/share/doc/${PF} |
490 |
- doins -r contrib |
491 |
- fi |
492 |
- |
493 |
- keepdir /var/lib/${PN} |
494 |
- fowners collectd:collectd /var/lib/${PN} |
495 |
- |
496 |
- newinitd "${FILESDIR}/${PN}.initd-r2" ${PN} |
497 |
- newconfd "${FILESDIR}/${PN}.confd-r2" ${PN} |
498 |
- systemd_newunit "contrib/systemd.${PN}.service" ${PN}.service |
499 |
- |
500 |
- insinto /etc/logrotate.d |
501 |
- newins "${FILESDIR}/${PN}.logrotate" ${PN} |
502 |
- |
503 |
- newtmpfiles "${FILESDIR}"/${PN}.tmpfile ${PN}.conf |
504 |
- |
505 |
- sed -i -e 's:^.*PIDFile "/var/run/collectd.pid":#PIDFile "/run/collectd.pid":' "${ED}"etc/collectd.conf || die |
506 |
- sed -i -e 's:^# SocketFile "/var/run/collectd-unixsock":# SocketFile "/run/collectd/collectd.socket":' "${ED}"etc/collectd.conf || die |
507 |
- sed -i -e 's:^.*LoadPlugin perl$:# The new, correct way to load the perl plugin -- \n# <LoadPlugin perl>\n# Globals true\n# </LoadPlugin>:' "${ED}"etc/collectd.conf || die |
508 |
- sed -i -e 's:^.*LoadPlugin python$:# The new, correct way to load the python plugin -- \n# <LoadPlugin python>\n# Globals true\n# </LoadPlugin>:' "${ED}"etc/collectd.conf || die |
509 |
-} |
510 |
- |
511 |
-pkg_postinst() { |
512 |
- tmpfiles_process "${PN}.conf" |
513 |
- |
514 |
- if use filecaps; then |
515 |
- local caps=() |
516 |
- use collectd_plugins_ceph && caps+=('CAP_DAC_OVERRIDE') |
517 |
- use collectd_plugins_exec && caps+=('CAP_SETUID' 'CAP_SETGID') |
518 |
- use collectd_plugins_iptables && caps+=('CAP_NET_ADMIN') |
519 |
- use collectd_plugins_filecount && caps+=('CAP_DAC_READ_SEARCH') |
520 |
- |
521 |
- if use collectd_plugins_dns || use collectd_plugins_ping; then |
522 |
- caps+=('CAP_NET_RAW') |
523 |
- fi |
524 |
- |
525 |
- if use collectd_plugins_turbostat || use collectd_plugins_smart; then |
526 |
- caps+=('CAP_SYS_RAWIO') |
527 |
- fi |
528 |
- |
529 |
- if [ ${#caps[@]} -gt 0 ]; then |
530 |
- local caps_str=$(IFS=","; echo "${caps[*]}") |
531 |
- fcaps ${caps_str} usr/sbin/collectd |
532 |
- elog "Capabilities for ${EROOT}usr/sbin/collectd set to:" |
533 |
- elog " ${caps_str}+EP" |
534 |
- elog |
535 |
- |
536 |
- local systemd_unit="$(systemd_get_systemunitdir)/collectd.service" |
537 |
- if [[ -e "${systemd_unit}" ]]; then |
538 |
- caps_str="${caps[*]}" |
539 |
- sed -i -e "s:^CapabilityBoundingSet=.*:CapabilityBoundingSet=${caps_str}:" "${systemd_unit}" || \ |
540 |
- die "Failed to set CapabilityBoundingSet in '${systemd_unit}'" |
541 |
- |
542 |
- elog "CapabilityBoundingSet in '${systemd_unit}'" |
543 |
- elog "updated to match capabilities set above." |
544 |
- elog |
545 |
- else |
546 |
- if has_version "sys-apps/systemd"; then |
547 |
- # Bug 596852 |
548 |
- ewarn "Failed to update CapabilityBoundingSet in '${systemd_unit}'" |
549 |
- ewarn "because unit was not found. Please file a bug about this." |
550 |
- fi |
551 |
- fi |
552 |
- fi |
553 |
- fi |
554 |
- |
555 |
- elog "Note: Collectd is only the collector." |
556 |
- elog " You need to install 'data' sources (applications) locally or" |
557 |
- elog " remotely on your own." |
558 |
- |
559 |
- elog |
560 |
- elog "Collectd is configured to run as unprivileged user by default." |
561 |
- elog "You may want to revisit the configuration." |
562 |
- elog |
563 |
- |
564 |
- if use collectd_plugins_email; then |
565 |
- ewarn "The email plug-in is deprecated. To submit statistics please use the unixsock plugin." |
566 |
- fi |
567 |
- |
568 |
- if use collectd_plugins_smart; then |
569 |
- elog "" |
570 |
- elog "If you are using smart plugin and don't run collectd as root make sure" |
571 |
- elog "that the collectd user is allowed to access the disk you want to monitor" |
572 |
- elog "(can be done via udev rule for example) and that collectd has the required" |
573 |
- elog "capabilities set (which is the default when package was emerged with" |
574 |
- elog "'filecaps' USE flag set)." |
575 |
- fi |
576 |
- |
577 |
- if use contrib; then |
578 |
- elog "The scripts in /usr/share/doc/${PF}/collection3 for generating graphs need dev-perl/HTML-Parser," |
579 |
- elog "dev-perl/config-general, dev-perl/regexp-common, and net-analyzer/rrdtool[perl] to be installed." |
580 |
- fi |
581 |
-} |
582 |
|
583 |
diff --git a/app-metrics/collectd/files/collectd-5.6.0-gentoo.patch b/app-metrics/collectd/files/collectd-5.6.0-gentoo.patch |
584 |
deleted file mode 100644 |
585 |
index dd8c1576354..00000000000 |
586 |
--- a/app-metrics/collectd/files/collectd-5.6.0-gentoo.patch |
587 |
+++ /dev/null |
588 |
@@ -1,153 +0,0 @@ |
589 |
-From 8fe20883e248572690798e4dd1423511aa2f4e5d Mon Sep 17 00:00:00 2001 |
590 |
-From: Thomas Deutschmann <whissi@g.o> |
591 |
-Date: Thu, 22 Sep 2016 00:53:58 +0200 |
592 |
-Subject: [PATCH 1/3] Remove bundled libltdl |
593 |
- |
594 |
---- |
595 |
- Makefile.am | 6 ------ |
596 |
- configure.ac | 8 ++++---- |
597 |
- 2 files changed, 4 insertions(+), 10 deletions(-) |
598 |
- |
599 |
-diff --git a/Makefile.am b/Makefile.am |
600 |
-index 03bdd39..ad04a3c 100644 |
601 |
---- a/Makefile.am |
602 |
-+++ b/Makefile.am |
603 |
-@@ -1,11 +1,5 @@ |
604 |
--ACLOCAL_AMFLAGS = -I libltdl/m4 |
605 |
-- |
606 |
- SUBDIRS = |
607 |
- |
608 |
--if BUILD_INCLUDED_LTDL |
609 |
--SUBDIRS += libltdl |
610 |
--endif |
611 |
-- |
612 |
- SUBDIRS += proto src bindings . |
613 |
- |
614 |
- AM_CPPFLAGS = $(LTDLINCL) |
615 |
-diff --git a/configure.ac b/configure.ac |
616 |
-index 9a6da11..68e15e0 100644 |
617 |
---- a/configure.ac |
618 |
-+++ b/configure.ac |
619 |
-@@ -3,7 +3,6 @@ AC_PREREQ([2.60]) |
620 |
- AC_INIT([collectd],[m4_esyscmd(./version-gen.sh)]) |
621 |
- AC_CONFIG_SRCDIR(src/target_set.c) |
622 |
- AC_CONFIG_HEADERS(src/config.h) |
623 |
--AC_CONFIG_AUX_DIR([libltdl/config]) |
624 |
- |
625 |
- dnl older automake's default of ARFLAGS=cru is noisy on newer binutils; |
626 |
- dnl we don't really need the 'u' even in older toolchains. Then there is |
627 |
-@@ -13,7 +12,6 @@ m4_divert_text([DEFAULTS], [: "${ARFLAGS=cr} ${AR_FLAGS=cr}"]) |
628 |
- m4_ifdef([LT_PACKAGE_VERSION], |
629 |
- # libtool >= 2.2 |
630 |
- [ |
631 |
-- LT_CONFIG_LTDL_DIR([libltdl]) |
632 |
- LT_INIT([dlopen]) |
633 |
- LTDL_INIT([convenience]) |
634 |
- AC_DEFINE(LIBTOOL_VERSION, 2, [Define to used libtool version.]) |
635 |
-@@ -25,12 +23,14 @@ m4_ifdef([LT_PACKAGE_VERSION], |
636 |
- AC_SUBST(LTDLINCL) |
637 |
- AC_SUBST(LIBLTDL) |
638 |
- AC_LIBTOOL_DLOPEN |
639 |
-- AC_CONFIG_SUBDIRS(libltdl) |
640 |
- AC_DEFINE(LIBTOOL_VERSION, 1, [Define to used libtool version.]) |
641 |
- ] |
642 |
- ) |
643 |
- |
644 |
--AM_CONDITIONAL([BUILD_INCLUDED_LTDL], [test "x$LTDLDEPS" != "x"]) |
645 |
-+if test "x$LTDLDEPS" != "x" |
646 |
-+then |
647 |
-+ AC_MSG_ERROR(["system's libltdl is too old! Should never happen. Please file a bug at https://bugs.gentoo.org"]) |
648 |
-+fi |
649 |
- |
650 |
- AM_INIT_AUTOMAKE([subdir-objects tar-pax dist-bzip2 no-dist-gzip foreign]) |
651 |
- m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
652 |
--- |
653 |
-2.10.0 |
654 |
- |
655 |
- |
656 |
-From 0b00f519ce183b8ceaab5cf8e56f574ecd2cb7c4 Mon Sep 17 00:00:00 2001 |
657 |
-From: Thomas Deutschmann <whissi@g.o> |
658 |
-Date: Thu, 22 Sep 2016 00:54:08 +0200 |
659 |
-Subject: [PATCH 2/3] Remove libhal dependency |
660 |
- |
661 |
-X-Gentoo-Bug: 353839 |
662 |
-X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=353839 |
663 |
---- |
664 |
- configure.ac | 24 ------------------------ |
665 |
- 1 file changed, 24 deletions(-) |
666 |
- |
667 |
-diff --git a/configure.ac b/configure.ac |
668 |
-index 68e15e0..1700c44 100644 |
669 |
---- a/configure.ac |
670 |
-+++ b/configure.ac |
671 |
-@@ -1663,30 +1663,6 @@ AM_CONDITIONAL(BUILD_WITH_LIBRESOLV, test "x$with_libresolv" = "xyes") |
672 |
- |
673 |
- dnl Check for HAL (hardware abstraction library) |
674 |
- with_libhal="no" |
675 |
--PKG_CHECK_MODULES([HAL], [hal], |
676 |
-- [ |
677 |
-- SAVE_LIBS="$LIBS" |
678 |
-- LIBS="$HAL_LIBS $LIBS" |
679 |
-- AC_CHECK_LIB([hal], [libhal_device_property_exists], |
680 |
-- [ |
681 |
-- SAVE_CPPFLAGS="$CPPFLAGS" |
682 |
-- CPPFLAGS="$HAL_CFLAGS $CPPFLAGS" |
683 |
-- AC_CHECK_HEADERS([libhal.h], |
684 |
-- [ |
685 |
-- with_libhal="yes" |
686 |
-- BUILD_WITH_LIBHAL_CFLAGS="$HAL_CFLAGS" |
687 |
-- BUILD_WITH_LIBHAL_LIBS="$HAL_LIBS" |
688 |
-- ]) |
689 |
-- CPPFLAGS="$SAVE_CPPFLAGS" |
690 |
-- ], |
691 |
-- [ : ] |
692 |
-- ) |
693 |
-- LIBS="$SAVE_LIBS" |
694 |
-- ], |
695 |
-- [ : ] |
696 |
--) |
697 |
--AC_SUBST(BUILD_WITH_LIBHAL_CFLAGS) |
698 |
--AC_SUBST(BUILD_WITH_LIBHAL_LIBS) |
699 |
- |
700 |
- |
701 |
- SAVE_LIBS="$LIBS" |
702 |
--- |
703 |
-2.10.0 |
704 |
- |
705 |
- |
706 |
-From 380c61888bed5856319fa32816d8f2f4c88ee7bc Mon Sep 17 00:00:00 2001 |
707 |
-From: Thomas Deutschmann <whissi@g.o> |
708 |
-Date: Thu, 22 Sep 2016 00:54:19 +0200 |
709 |
-Subject: [PATCH 3/3] Link Oracle plug-in against libocci |
710 |
- |
711 |
-Author: Aurelien Minet |
712 |
-X-Gentoo-Bug: 347607 |
713 |
-X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=347607 |
714 |
---- |
715 |
- configure.ac | 4 ++-- |
716 |
- 1 file changed, 2 insertions(+), 2 deletions(-) |
717 |
- |
718 |
-diff --git a/configure.ac b/configure.ac |
719 |
-index 1700c44..83909a0 100644 |
720 |
---- a/configure.ac |
721 |
-+++ b/configure.ac |
722 |
-@@ -3587,14 +3587,14 @@ AC_ARG_WITH(oracle, [AS_HELP_STRING([--with-oracle@<:@=ORACLE_HOME@:>@], [Path t |
723 |
- ]) |
724 |
- if test "x$ORACLE_HOME" != "x" |
725 |
- then |
726 |
-- with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public" |
727 |
-+ with_oracle_cppflags="-I$ORACLE_HOME/rdbms/public -locci" |
728 |
- |
729 |
- if test -e "$ORACLE_HOME/lib/ldflags" |
730 |
- then |
731 |
- with_oracle_libs=`cat "$ORACLE_HOME/lib/ldflags"` |
732 |
- fi |
733 |
- #with_oracle_libs="-L$ORACLE_HOME/lib $with_oracle_libs -lclntsh" |
734 |
-- with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh" |
735 |
-+ with_oracle_libs="-L$ORACLE_HOME/lib -lclntsh -locci" |
736 |
- fi |
737 |
- if test "x$with_oracle" = "xyes" |
738 |
- then |
739 |
--- |
740 |
-2.10.0 |
741 |
- |
742 |
|
743 |
diff --git a/app-metrics/collectd/files/collectd-5.7.2-CVE-2017-16820.patch b/app-metrics/collectd/files/collectd-5.7.2-CVE-2017-16820.patch |
744 |
deleted file mode 100644 |
745 |
index 0090f2940bf..00000000000 |
746 |
--- a/app-metrics/collectd/files/collectd-5.7.2-CVE-2017-16820.patch |
747 |
+++ /dev/null |
748 |
@@ -1,39 +0,0 @@ |
749 |
-CVE-2017-16820: Fix double free of request PDU |
750 |
- |
751 |
-https://github.com/collectd/collectd/commit/d16c24542b2f96a194d43a73c2e5778822b9cb47 |
752 |
- |
753 |
---- a/src/snmp.c |
754 |
-+++ b/src/snmp.c |
755 |
-@@ -1357,11 +1357,13 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { |
756 |
- if (oid_list_todo_num == 0) { |
757 |
- /* The request is still empty - so we are finished */ |
758 |
- DEBUG("snmp plugin: all variables have left their subtree"); |
759 |
-+ snmp_free_pdu(req); |
760 |
- status = 0; |
761 |
- break; |
762 |
- } |
763 |
- |
764 |
- res = NULL; |
765 |
-+ /* snmp_sess_synch_response always frees our req PDU */ |
766 |
- status = snmp_sess_synch_response(host->sess_handle, req, &res); |
767 |
- if ((status != STAT_SUCCESS) || (res == NULL)) { |
768 |
- char *errstr = NULL; |
769 |
-@@ -1376,8 +1378,6 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { |
770 |
- snmp_free_pdu(res); |
771 |
- res = NULL; |
772 |
- |
773 |
-- /* snmp_synch_response already freed our PDU */ |
774 |
-- req = NULL; |
775 |
- sfree(errstr); |
776 |
- csnmp_host_close_session(host); |
777 |
- |
778 |
-@@ -1492,9 +1492,6 @@ static int csnmp_read_table(host_definition_t *host, data_definition_t *data) { |
779 |
- snmp_free_pdu(res); |
780 |
- res = NULL; |
781 |
- |
782 |
-- if (req != NULL) |
783 |
-- snmp_free_pdu(req); |
784 |
-- req = NULL; |
785 |
- |
786 |
- if (status == 0) |
787 |
- csnmp_dispatch_table(host, data, instance_list_head, value_list_head); |
788 |
|
789 |
diff --git a/app-metrics/collectd/files/collectd-5.7.2-issue-2443.patch b/app-metrics/collectd/files/collectd-5.7.2-issue-2443.patch |
790 |
deleted file mode 100644 |
791 |
index 19410c139b0..00000000000 |
792 |
--- a/app-metrics/collectd/files/collectd-5.7.2-issue-2443.patch |
793 |
+++ /dev/null |
794 |
@@ -1,160 +0,0 @@ |
795 |
-turbostat: import msr-index header from linux to allow building against |
796 |
- >=linux-4.12 |
797 |
- |
798 |
-Backport of https://github.com/collectd/collectd/pull/2446 |
799 |
- |
800 |
---- a/configure.ac |
801 |
-+++ b/configure.ac |
802 |
-@@ -805,28 +805,6 @@ AC_CACHE_CHECK([whether clock_boottime and clock_monotonic are supported], |
803 |
- |
804 |
- |
805 |
- # For the turbostat plugin |
806 |
--have_asm_msrindex_h="no" |
807 |
--AC_CHECK_HEADERS(asm/msr-index.h, [have_asm_msrindex_h="yes"]) |
808 |
-- |
809 |
--if test "x$have_asm_msrindex_h" = "xyes" |
810 |
--then |
811 |
-- AC_CACHE_CHECK([whether asm/msr-index.h has MSR_PKG_C10_RESIDENCY], |
812 |
-- [c_cv_have_usable_asm_msrindex_h], |
813 |
-- AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
814 |
--[[[ |
815 |
--#include<asm/msr-index.h> |
816 |
--]]], |
817 |
--[[[ |
818 |
--int y = MSR_PKG_C10_RESIDENCY; |
819 |
--return(y); |
820 |
--]]] |
821 |
-- )], |
822 |
-- [c_cv_have_usable_asm_msrindex_h="yes"], |
823 |
-- [c_cv_have_usable_asm_msrindex_h="no"], |
824 |
-- ) |
825 |
-- ) |
826 |
--fi |
827 |
-- |
828 |
- have_cpuid_h="no" |
829 |
- AC_CHECK_HEADERS(cpuid.h, [have_cpuid_h="yes"]) |
830 |
- |
831 |
-@@ -6108,7 +6086,7 @@ then |
832 |
- then |
833 |
- plugin_ipvs="yes" |
834 |
- fi |
835 |
-- if test "x$c_cv_have_usable_asm_msrindex_h" = "xyes" && test "x$have_cpuid_h" = "xyes" |
836 |
-+ if test "x$have_cpuid_h" = "xyes" |
837 |
- then |
838 |
- plugin_turbostat="yes" |
839 |
- fi |
840 |
---- a/src/Makefile.am |
841 |
-+++ b/src/Makefile.am |
842 |
-@@ -1212,7 +1212,9 @@ endif |
843 |
- |
844 |
- if BUILD_PLUGIN_TURBOSTAT |
845 |
- pkglib_LTLIBRARIES += turbostat.la |
846 |
--turbostat_la_SOURCES = turbostat.c |
847 |
-+turbostat_la_SOURCES = \ |
848 |
-+ turbostat.c \ |
849 |
-+ msr-index.h |
850 |
- turbostat_la_LDFLAGS = $(PLUGIN_LDFLAGS) |
851 |
- endif |
852 |
- |
853 |
---- /dev/null |
854 |
-+++ b/src/msr-index.h |
855 |
-@@ -0,0 +1,88 @@ |
856 |
-+/* |
857 |
-+ * Partial header file imported from the linux kernel |
858 |
-+ * (arch/x86/include/asm/msr-index.h) |
859 |
-+ * as it is not provided by the kernel sources anymore |
860 |
-+ * |
861 |
-+ * Only the minimal blocks of macro have been included |
862 |
-+ * ---- |
863 |
-+ * This program is free software; you can redistribute it and/or modify it |
864 |
-+ * under the terms and conditions of the GNU General Public License, |
865 |
-+ * version 2, as published by the Free Software Foundation. |
866 |
-+ * |
867 |
-+ * This program is distributed in the hope it will be useful, but WITHOUT |
868 |
-+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
869 |
-+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
870 |
-+ * more details. |
871 |
-+ * |
872 |
-+ * You should have received a copy of the GNU General Public License along with |
873 |
-+ * this program; if not, write to the Free Software Foundation, Inc., |
874 |
-+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. |
875 |
-+ * ---- |
876 |
-+ */ |
877 |
-+ |
878 |
-+#ifndef _ASM_X86_MSR_INDEX_H |
879 |
-+#define _ASM_X86_MSR_INDEX_H |
880 |
-+ |
881 |
-+/* |
882 |
-+ * CPU model specific register (MSR) numbers. |
883 |
-+ * |
884 |
-+ * Do not add new entries to this file unless the definitions are shared |
885 |
-+ * between multiple compilation units. |
886 |
-+ */ |
887 |
-+ |
888 |
-+/* Intel MSRs. Some also available on other CPUs */ |
889 |
-+ |
890 |
-+/* C-state Residency Counters */ |
891 |
-+#define MSR_PKG_C3_RESIDENCY 0x000003f8 |
892 |
-+#define MSR_PKG_C6_RESIDENCY 0x000003f9 |
893 |
-+#define MSR_ATOM_PKG_C6_RESIDENCY 0x000003fa |
894 |
-+#define MSR_PKG_C7_RESIDENCY 0x000003fa |
895 |
-+#define MSR_CORE_C3_RESIDENCY 0x000003fc |
896 |
-+#define MSR_CORE_C6_RESIDENCY 0x000003fd |
897 |
-+#define MSR_CORE_C7_RESIDENCY 0x000003fe |
898 |
-+#define MSR_KNL_CORE_C6_RESIDENCY 0x000003ff |
899 |
-+#define MSR_PKG_C2_RESIDENCY 0x0000060d |
900 |
-+#define MSR_PKG_C8_RESIDENCY 0x00000630 |
901 |
-+#define MSR_PKG_C9_RESIDENCY 0x00000631 |
902 |
-+#define MSR_PKG_C10_RESIDENCY 0x00000632 |
903 |
-+ |
904 |
-+/* Run Time Average Power Limiting (RAPL) Interface */ |
905 |
-+ |
906 |
-+#define MSR_RAPL_POWER_UNIT 0x00000606 |
907 |
-+ |
908 |
-+#define MSR_PKG_POWER_LIMIT 0x00000610 |
909 |
-+#define MSR_PKG_ENERGY_STATUS 0x00000611 |
910 |
-+#define MSR_PKG_PERF_STATUS 0x00000613 |
911 |
-+#define MSR_PKG_POWER_INFO 0x00000614 |
912 |
-+ |
913 |
-+#define MSR_DRAM_POWER_LIMIT 0x00000618 |
914 |
-+#define MSR_DRAM_ENERGY_STATUS 0x00000619 |
915 |
-+#define MSR_DRAM_PERF_STATUS 0x0000061b |
916 |
-+#define MSR_DRAM_POWER_INFO 0x0000061c |
917 |
-+ |
918 |
-+#define MSR_PP0_POWER_LIMIT 0x00000638 |
919 |
-+#define MSR_PP0_ENERGY_STATUS 0x00000639 |
920 |
-+#define MSR_PP0_POLICY 0x0000063a |
921 |
-+#define MSR_PP0_PERF_STATUS 0x0000063b |
922 |
-+ |
923 |
-+#define MSR_PP1_POWER_LIMIT 0x00000640 |
924 |
-+#define MSR_PP1_ENERGY_STATUS 0x00000641 |
925 |
-+#define MSR_PP1_POLICY 0x00000642 |
926 |
-+ |
927 |
-+ |
928 |
-+ |
929 |
-+/* Intel defined MSRs. */ |
930 |
-+#define MSR_IA32_TSC 0x00000010 |
931 |
-+#define MSR_SMI_COUNT 0x00000034 |
932 |
-+ |
933 |
-+#define MSR_IA32_MPERF 0x000000e7 |
934 |
-+#define MSR_IA32_APERF 0x000000e8 |
935 |
-+ |
936 |
-+#define MSR_IA32_THERM_STATUS 0x0000019c |
937 |
-+ |
938 |
-+#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2 |
939 |
-+ |
940 |
-+#define MSR_IA32_PACKAGE_THERM_STATUS 0x000001b1 |
941 |
-+ |
942 |
-+ |
943 |
-+#endif /* _ASM_X86_MSR_INDEX_H */ |
944 |
---- a/src/turbostat.c |
945 |
-+++ b/src/turbostat.c |
946 |
-@@ -41,7 +41,7 @@ |
947 |
- #include "plugin.h" |
948 |
- #include "utils_time.h" |
949 |
- |
950 |
--#include <asm/msr-index.h> |
951 |
-+#include "msr-index.h" |
952 |
- #include <cpuid.h> |
953 |
- #ifdef HAVE_SYS_CAPABILITY_H |
954 |
- #include <sys/capability.h> |
955 |
|
956 |
diff --git a/app-metrics/collectd/files/collectd-5.7.2-varnish-5.2+.patch b/app-metrics/collectd/files/collectd-5.7.2-varnish-5.2+.patch |
957 |
deleted file mode 100644 |
958 |
index 60830042fa6..00000000000 |
959 |
--- a/app-metrics/collectd/files/collectd-5.7.2-varnish-5.2+.patch |
960 |
+++ /dev/null |
961 |
@@ -1,1018 +0,0 @@ |
962 |
-Fix building against >=www-servers/varnish-5.2 |
963 |
- |
964 |
-https://github.com/collectd/collectd/commit/3c42182e912e3d634fe8c4f6a636053959fcde49 |
965 |
-https://github.com/collectd/collectd/commit/3ab73ae8b23b9816fb69fde630c5ad667aa1e09f |
966 |
-https://github.com/collectd/collectd/commit/7978b43670472a000831f7ff37a6a30771a6ee6f |
967 |
-https://github.com/collectd/collectd/commit/68123637814ea09efff5bf56f3209eefbe41287a |
968 |
-https://github.com/collectd/collectd/commit/8192bfcf975ff6275505c99193a23e2a066927d0 |
969 |
-https://github.com/collectd/collectd/commit/c1e2bf3d2bfa1a1da3a6b42186577f635795e7f8 |
970 |
- |
971 |
---- a/configure.ac |
972 |
-+++ b/configure.ac |
973 |
-@@ -5614,13 +5614,18 @@ then |
974 |
- |
975 |
- CPPFLAGS="$CPPFLAGS $with_libvarnish_cflags" |
976 |
- |
977 |
-- AC_CHECK_HEADERS(vapi/vsc.h, |
978 |
-- [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])], |
979 |
-- [AC_CHECK_HEADERS(vsc.h, |
980 |
-- [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])], |
981 |
-- [AC_CHECK_HEADERS(varnishapi.h, |
982 |
-- [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])], |
983 |
-- [with_libvarnish="no (found none of the varnish header files)"])])]) |
984 |
-+ $PKG_CONFIG --atleast-version=5.2 'varnishapi' 2>/dev/null |
985 |
-+ if test $? -eq 0; then |
986 |
-+ AC_DEFINE([HAVE_VARNISH_V5], [1], [Varnish 5 API support]) |
987 |
-+ else |
988 |
-+ AC_CHECK_HEADERS(vapi/vsc.h, |
989 |
-+ [AC_DEFINE([HAVE_VARNISH_V4], [1], [Varnish 4 API support])], |
990 |
-+ [AC_CHECK_HEADERS(vsc.h, |
991 |
-+ [AC_DEFINE([HAVE_VARNISH_V3], [1], [Varnish 3 API support])], |
992 |
-+ [AC_CHECK_HEADERS(varnishapi.h, |
993 |
-+ [AC_DEFINE([HAVE_VARNISH_V2], [1], [Varnish 2 API support])], |
994 |
-+ [with_libvarnish="no (found none of the varnish header files)"])])]) |
995 |
-+ fi |
996 |
- |
997 |
- CPPFLAGS="$SAVE_CPPFLAGS" |
998 |
- fi |
999 |
---- a/src/varnish.c |
1000 |
-+++ b/src/varnish.c |
1001 |
-@@ -21,6 +21,7 @@ |
1002 |
- * Jérôme Renard <jerome.renard at gmail.com> |
1003 |
- * Marc Fournier <marc.fournier at camptocamp.com> |
1004 |
- * Florian octo Forster <octo at collectd.org> |
1005 |
-+ * Denes Matetelki <dmatetelki at varnish-software.com> |
1006 |
- **/ |
1007 |
- |
1008 |
- #include "collectd.h" |
1009 |
-@@ -28,7 +29,7 @@ |
1010 |
- #include "common.h" |
1011 |
- #include "plugin.h" |
1012 |
- |
1013 |
--#if HAVE_VARNISH_V4 |
1014 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1015 |
- #include <vapi/vsc.h> |
1016 |
- #include <vapi/vsm.h> |
1017 |
- typedef struct VSC_C_main c_varnish_stats_t; |
1018 |
-@@ -69,17 +70,25 @@ struct user_config_s { |
1019 |
- _Bool collect_sms; |
1020 |
- #if HAVE_VARNISH_V2 |
1021 |
- _Bool collect_sm; |
1022 |
-+#endif |
1023 |
-+#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1024 |
- _Bool collect_sma; |
1025 |
- #endif |
1026 |
- _Bool collect_struct; |
1027 |
- _Bool collect_totals; |
1028 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1029 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1030 |
- _Bool collect_uptime; |
1031 |
- #endif |
1032 |
- _Bool collect_vcl; |
1033 |
- _Bool collect_workers; |
1034 |
--#if HAVE_VARNISH_V4 |
1035 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1036 |
- _Bool collect_vsm; |
1037 |
-+ _Bool collect_lck; |
1038 |
-+ _Bool collect_mempool; |
1039 |
-+ _Bool collect_mgt; |
1040 |
-+ _Bool collect_smf; |
1041 |
-+ _Bool collect_vbe; |
1042 |
-+ _Bool collect_mse; |
1043 |
- #endif |
1044 |
- }; |
1045 |
- typedef struct user_config_s user_config_t; /* }}} */ |
1046 |
-@@ -98,60 +107,70 @@ static int varnish_submit(const char *plugin_instance, /* {{{ */ |
1047 |
- |
1048 |
- if (plugin_instance == NULL) |
1049 |
- plugin_instance = "default"; |
1050 |
-- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s", |
1051 |
-- plugin_instance, category); |
1052 |
-+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s", |
1053 |
-+ plugin_instance, category); |
1054 |
- |
1055 |
- sstrncpy(vl.type, type, sizeof(vl.type)); |
1056 |
- |
1057 |
- if (type_instance != NULL) |
1058 |
- sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); |
1059 |
- |
1060 |
-- return (plugin_dispatch_values(&vl)); |
1061 |
-+ return plugin_dispatch_values(&vl); |
1062 |
- } /* }}} int varnish_submit */ |
1063 |
- |
1064 |
- static int varnish_submit_gauge(const char *plugin_instance, /* {{{ */ |
1065 |
- const char *category, const char *type, |
1066 |
- const char *type_instance, |
1067 |
- uint64_t gauge_value) { |
1068 |
-- return (varnish_submit(plugin_instance, category, type, type_instance, |
1069 |
-- (value_t){.gauge = (gauge_t)gauge_value})); |
1070 |
-+ return varnish_submit(plugin_instance, category, type, type_instance, |
1071 |
-+ (value_t){ |
1072 |
-+ .gauge = (gauge_t)gauge_value, |
1073 |
-+ }); |
1074 |
- } /* }}} int varnish_submit_gauge */ |
1075 |
- |
1076 |
- static int varnish_submit_derive(const char *plugin_instance, /* {{{ */ |
1077 |
- const char *category, const char *type, |
1078 |
- const char *type_instance, |
1079 |
- uint64_t derive_value) { |
1080 |
-- return (varnish_submit(plugin_instance, category, type, type_instance, |
1081 |
-- (value_t){.derive = (derive_t)derive_value})); |
1082 |
-+ return varnish_submit(plugin_instance, category, type, type_instance, |
1083 |
-+ (value_t){ |
1084 |
-+ .derive = (derive_t)derive_value, |
1085 |
-+ }); |
1086 |
- } /* }}} int varnish_submit_derive */ |
1087 |
- |
1088 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1089 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1090 |
- static int varnish_monitor(void *priv, |
1091 |
- const struct VSC_point *const pt) /* {{{ */ |
1092 |
- { |
1093 |
- uint64_t val; |
1094 |
- const user_config_t *conf; |
1095 |
-- const char *class; |
1096 |
- const char *name; |
1097 |
- |
1098 |
- if (pt == NULL) |
1099 |
-- return (0); |
1100 |
-+ return 0; |
1101 |
- |
1102 |
- conf = priv; |
1103 |
- |
1104 |
--#if HAVE_VARNISH_V4 |
1105 |
-- class = pt->section->fantom->type; |
1106 |
-- name = pt->desc->name; |
1107 |
-+#if HAVE_VARNISH_V5 |
1108 |
-+ char namebuff[DATA_MAX_NAME_LEN]; |
1109 |
- |
1110 |
-- if (strcmp(class, "MAIN") != 0) |
1111 |
-- return (0); |
1112 |
-+ char const *c = strrchr(pt->name, '.'); |
1113 |
-+ if (c == NULL) { |
1114 |
-+ return EINVAL; |
1115 |
-+ } |
1116 |
-+ sstrncpy(namebuff, c + 1, sizeof(namebuff)); |
1117 |
-+ name = namebuff; |
1118 |
-+ |
1119 |
-+#elif HAVE_VARNISH_V4 |
1120 |
-+ if (strcmp(pt->section->fantom->type, "MAIN") != 0) |
1121 |
-+ return 0; |
1122 |
- |
1123 |
-+ name = pt->desc->name; |
1124 |
- #elif HAVE_VARNISH_V3 |
1125 |
-- class = pt->class; |
1126 |
-- name = pt->name; |
1127 |
-+ if (strcmp(pt->class, "") != 0) |
1128 |
-+ return 0; |
1129 |
- |
1130 |
-- if (strcmp(class, "") != 0) |
1131 |
-- return (0); |
1132 |
-+ name = pt->name; |
1133 |
- #endif |
1134 |
- |
1135 |
- val = *(const volatile uint64_t *)pt->ptr; |
1136 |
-@@ -178,6 +197,14 @@ static int varnish_monitor(void *priv, |
1137 |
- else if (strcmp(name, "client_req") == 0) |
1138 |
- return varnish_submit_derive(conf->instance, "connections", "connections", |
1139 |
- "received", val); |
1140 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1141 |
-+ else if (strcmp(name, "client_req_400") == 0) |
1142 |
-+ return varnish_submit_derive(conf->instance, "connections", "connections", |
1143 |
-+ "error_400", val); |
1144 |
-+ else if (strcmp(name, "client_req_417") == 0) |
1145 |
-+ return varnish_submit_derive(conf->instance, "connections", "connections", |
1146 |
-+ "error_417", val); |
1147 |
-+#endif |
1148 |
- } |
1149 |
- |
1150 |
- #ifdef HAVE_VARNISH_V3 |
1151 |
-@@ -207,6 +234,9 @@ static int varnish_monitor(void *priv, |
1152 |
- else if (strcmp(name, "esi_warnings") == 0) |
1153 |
- return varnish_submit_derive(conf->instance, "esi", "total_operations", |
1154 |
- "warning", val); |
1155 |
-+ else if (strcmp(name, "esi_maxdepth") == 0) |
1156 |
-+ return varnish_submit_derive(conf->instance, "esi", "total_operations", |
1157 |
-+ "max_depth", val); |
1158 |
- } |
1159 |
- |
1160 |
- if (conf->collect_backend) { |
1161 |
-@@ -282,6 +312,20 @@ static int varnish_monitor(void *priv, |
1162 |
- else if (strcmp(name, "fetch_304") == 0) |
1163 |
- return varnish_submit_derive(conf->instance, "fetch", "http_requests", |
1164 |
- "no_body_304", val); |
1165 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1166 |
-+ else if (strcmp(name, "fetch_no_thread") == 0) |
1167 |
-+ return varnish_submit_derive(conf->instance, "fetch", "http_requests", |
1168 |
-+ "no_thread", val); |
1169 |
-+ else if (strcmp(name, "fetch_none") == 0) |
1170 |
-+ return varnish_submit_derive(conf->instance, "fetch", "http_requests", |
1171 |
-+ "none", val); |
1172 |
-+ else if (strcmp(name, "busy_sleep") == 0) |
1173 |
-+ return varnish_submit_derive(conf->instance, "fetch", "http_requests", |
1174 |
-+ "busy_sleep", val); |
1175 |
-+ else if (strcmp(name, "busy_wakeup") == 0) |
1176 |
-+ return varnish_submit_derive(conf->instance, "fetch", "http_requests", |
1177 |
-+ "busy_wakeup", val); |
1178 |
-+#endif |
1179 |
- } |
1180 |
- |
1181 |
- if (conf->collect_hcb) { |
1182 |
-@@ -327,6 +371,14 @@ static int varnish_monitor(void *priv, |
1183 |
- else if (strcmp(name, "n_objoverflow") == 0) |
1184 |
- return varnish_submit_derive(conf->instance, "objects", "total_objects", |
1185 |
- "workspace_overflow", val); |
1186 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1187 |
-+ else if (strcmp(name, "exp_mailed") == 0) |
1188 |
-+ return varnish_submit_gauge(conf->instance, "struct", "objects", |
1189 |
-+ "exp_mailed", val); |
1190 |
-+ else if (strcmp(name, "exp_received") == 0) |
1191 |
-+ return varnish_submit_gauge(conf->instance, "struct", "objects", |
1192 |
-+ "exp_received", val); |
1193 |
-+#endif |
1194 |
- } |
1195 |
- |
1196 |
- #if HAVE_VARNISH_V3 |
1197 |
-@@ -351,7 +403,7 @@ static int varnish_monitor(void *priv, |
1198 |
- "duplicate", val); |
1199 |
- } |
1200 |
- #endif |
1201 |
--#if HAVE_VARNISH_V4 |
1202 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1203 |
- if (conf->collect_ban) { |
1204 |
- if (strcmp(name, "bans") == 0) |
1205 |
- return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1206 |
-@@ -377,6 +429,33 @@ static int varnish_monitor(void *priv, |
1207 |
- else if (strcmp(name, "bans_dups") == 0) |
1208 |
- return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1209 |
- "duplicate", val); |
1210 |
-+ else if (strcmp(name, "bans_tested") == 0) |
1211 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1212 |
-+ "tested", val); |
1213 |
-+ else if (strcmp(name, "bans_lurker_contention") == 0) |
1214 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1215 |
-+ "lurker_contention", val); |
1216 |
-+ else if (strcmp(name, "bans_lurker_obj_killed") == 0) |
1217 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1218 |
-+ "lurker_obj_killed", val); |
1219 |
-+ else if (strcmp(name, "bans_lurker_tested") == 0) |
1220 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1221 |
-+ "lurker_tested", val); |
1222 |
-+ else if (strcmp(name, "bans_lurker_tests_tested") == 0) |
1223 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1224 |
-+ "lurker_tests_tested", val); |
1225 |
-+ else if (strcmp(name, "bans_obj_killed") == 0) |
1226 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1227 |
-+ "obj_killed", val); |
1228 |
-+ else if (strcmp(name, "bans_persisted_bytes") == 0) |
1229 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_bytes", |
1230 |
-+ "persisted_bytes", val); |
1231 |
-+ else if (strcmp(name, "bans_persisted_fragmentation") == 0) |
1232 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_bytes", |
1233 |
-+ "persisted_fragmentation", val); |
1234 |
-+ else if (strcmp(name, "bans_tests_tested") == 0) |
1235 |
-+ return varnish_submit_derive(conf->instance, "ban", "total_operations", |
1236 |
-+ "tests_tested", val); |
1237 |
- } |
1238 |
- #endif |
1239 |
- |
1240 |
-@@ -411,6 +490,15 @@ static int varnish_monitor(void *priv, |
1241 |
- else if (strcmp(name, "sess_herd") == 0) |
1242 |
- return varnish_submit_derive(conf->instance, "session", |
1243 |
- "total_operations", "herd", val); |
1244 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1245 |
-+ else if (strcmp(name, "sess_closed_err") == 0) |
1246 |
-+ return varnish_submit_derive(conf->instance, "session", |
1247 |
-+ "total_operations", "closed_err", val); |
1248 |
-+ else if (strcmp(name, "sess_dropped") == 0) |
1249 |
-+ return varnish_submit_derive(conf->instance, "session", |
1250 |
-+ "total_operations", "dropped_for_thread", |
1251 |
-+ val); |
1252 |
-+#endif |
1253 |
- } |
1254 |
- |
1255 |
- if (conf->collect_shm) { |
1256 |
-@@ -510,12 +598,18 @@ static int varnish_monitor(void *priv, |
1257 |
- else if (strcmp(name, "s_req_bodybytes") == 0) |
1258 |
- return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1259 |
- "req_body", val); |
1260 |
-+ else if (strcmp(name, "s_req_protobytes") == 0) |
1261 |
-+ return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1262 |
-+ "req_proto", val); |
1263 |
- else if (strcmp(name, "s_resp_hdrbytes") == 0) |
1264 |
- return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1265 |
- "resp_header", val); |
1266 |
- else if (strcmp(name, "s_resp_bodybytes") == 0) |
1267 |
- return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1268 |
- "resp_body", val); |
1269 |
-+ else if (strcmp(name, "s_resp_protobytes") == 0) |
1270 |
-+ return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1271 |
-+ "resp_proto", val); |
1272 |
- else if (strcmp(name, "s_pipe_hdrbytes") == 0) |
1273 |
- return varnish_submit_derive(conf->instance, "totals", "total_bytes", |
1274 |
- "pipe_header", val); |
1275 |
-@@ -580,8 +674,8 @@ static int varnish_monitor(void *priv, |
1276 |
- return varnish_submit_derive(conf->instance, "workers", "total_threads", |
1277 |
- "dropped", val); |
1278 |
- else if (strcmp(name, "thread_queue_len") == 0) |
1279 |
-- return varnish_submit_derive(conf->instance, "workers", "queue_length", |
1280 |
-- "threads", val); |
1281 |
-+ return varnish_submit_gauge(conf->instance, "workers", "queue_length", |
1282 |
-+ "threads", val); |
1283 |
- else if (strcmp(name, "n_wrk") == 0) |
1284 |
- return varnish_submit_gauge(conf->instance, "workers", "threads", |
1285 |
- "worker", val); |
1286 |
-@@ -609,9 +703,17 @@ static int varnish_monitor(void *priv, |
1287 |
- else if (strcmp(name, "n_wrk_lqueue") == 0) |
1288 |
- return varnish_submit_derive(conf->instance, "workers", "total_requests", |
1289 |
- "queue_length", val); |
1290 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1291 |
-+ else if (strcmp(name, "pools") == 0) |
1292 |
-+ return varnish_submit_gauge(conf->instance, "workers", "pools", "pools", |
1293 |
-+ val); |
1294 |
-+ else if (strcmp(name, "busy_killed") == 0) |
1295 |
-+ return varnish_submit_derive(conf->instance, "workers", "http_requests", |
1296 |
-+ "busy_killed", val); |
1297 |
-+#endif |
1298 |
- } |
1299 |
- |
1300 |
--#if HAVE_VARNISH_V4 |
1301 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1302 |
- if (conf->collect_vsm) { |
1303 |
- if (strcmp(name, "vsm_free") == 0) |
1304 |
- return varnish_submit_gauge(conf->instance, "vsm", "bytes", "free", val); |
1305 |
-@@ -627,9 +729,262 @@ static int varnish_monitor(void *priv, |
1306 |
- return varnish_submit_derive(conf->instance, "vsm", "total_bytes", |
1307 |
- "overflowed", val); |
1308 |
- } |
1309 |
-+ |
1310 |
-+ if (conf->collect_vbe) { |
1311 |
-+ /* @TODO figure out the collectd type for bitmap |
1312 |
-+ if (strcmp(name, "happy") == 0) |
1313 |
-+ return varnish_submit_derive(conf->instance, "vbe", |
1314 |
-+ "bitmap", "happy_hprobes", val); |
1315 |
-+ */ |
1316 |
-+ if (strcmp(name, "bereq_hdrbytes") == 0) |
1317 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1318 |
-+ "bereq_hdrbytes", val); |
1319 |
-+ else if (strcmp(name, "bereq_bodybytes") == 0) |
1320 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1321 |
-+ "bereq_bodybytes", val); |
1322 |
-+ else if (strcmp(name, "bereq_protobytes") == 0) |
1323 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1324 |
-+ "bereq_protobytes", val); |
1325 |
-+ else if (strcmp(name, "beresp_hdrbytes") == 0) |
1326 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1327 |
-+ "beresp_hdrbytes", val); |
1328 |
-+ else if (strcmp(name, "beresp_bodybytes") == 0) |
1329 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1330 |
-+ "beresp_bodybytes", val); |
1331 |
-+ else if (strcmp(name, "beresp_protobytes") == 0) |
1332 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1333 |
-+ "beresp_protobytes", val); |
1334 |
-+ else if (strcmp(name, "pipe_hdrbytes") == 0) |
1335 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1336 |
-+ "pipe_hdrbytes", val); |
1337 |
-+ else if (strcmp(name, "pipe_out") == 0) |
1338 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1339 |
-+ "pipe_out", val); |
1340 |
-+ else if (strcmp(name, "pipe_in") == 0) |
1341 |
-+ return varnish_submit_derive(conf->instance, "vbe", "total_bytes", |
1342 |
-+ "pipe_in", val); |
1343 |
-+ else if (strcmp(name, "conn") == 0) |
1344 |
-+ return varnish_submit_derive(conf->instance, "vbe", "connections", |
1345 |
-+ "c_conns", val); |
1346 |
-+ else if (strcmp(name, "req") == 0) |
1347 |
-+ return varnish_submit_derive(conf->instance, "vbe", "http_requests", |
1348 |
-+ "b_reqs", val); |
1349 |
-+ } |
1350 |
-+ |
1351 |
-+ /* All Stevedores support these counters */ |
1352 |
-+ if (conf->collect_sma || conf->collect_smf || conf->collect_mse) { |
1353 |
-+ |
1354 |
-+ char category[4]; |
1355 |
-+ if (conf->collect_sma) |
1356 |
-+ strncpy(category, "sma", 4); |
1357 |
-+ else if (conf->collect_smf) |
1358 |
-+ strncpy(category, "smf", 4); |
1359 |
-+ else |
1360 |
-+ strncpy(category, "mse", 4); |
1361 |
-+ |
1362 |
-+ if (strcmp(name, "c_req") == 0) |
1363 |
-+ return varnish_submit_derive(conf->instance, category, "total_operations", |
1364 |
-+ "alloc_req", val); |
1365 |
-+ else if (strcmp(name, "c_fail") == 0) |
1366 |
-+ return varnish_submit_derive(conf->instance, category, "total_operations", |
1367 |
-+ "alloc_fail", val); |
1368 |
-+ else if (strcmp(name, "c_bytes") == 0) |
1369 |
-+ return varnish_submit_derive(conf->instance, category, "total_bytes", |
1370 |
-+ "bytes_allocated", val); |
1371 |
-+ else if (strcmp(name, "c_freed") == 0) |
1372 |
-+ return varnish_submit_derive(conf->instance, category, "total_bytes", |
1373 |
-+ "bytes_freed", val); |
1374 |
-+ else if (strcmp(name, "g_alloc") == 0) |
1375 |
-+ return varnish_submit_derive(conf->instance, category, "total_operations", |
1376 |
-+ "alloc_outstanding", val); |
1377 |
-+ else if (strcmp(name, "g_bytes") == 0) |
1378 |
-+ return varnish_submit_gauge(conf->instance, category, "bytes", |
1379 |
-+ "bytes_outstanding", val); |
1380 |
-+ else if (strcmp(name, "g_space") == 0) |
1381 |
-+ return varnish_submit_gauge(conf->instance, category, "bytes", |
1382 |
-+ "bytes_available", val); |
1383 |
-+ } |
1384 |
-+ |
1385 |
-+ /* No SMA specific counters */ |
1386 |
-+ |
1387 |
-+ if (conf->collect_smf) { |
1388 |
-+ if (strcmp(name, "g_smf") == 0) |
1389 |
-+ return varnish_submit_gauge(conf->instance, "smf", "objects", |
1390 |
-+ "n_struct_smf", val); |
1391 |
-+ else if (strcmp(name, "g_smf_frag") == 0) |
1392 |
-+ return varnish_submit_gauge(conf->instance, "smf", "objects", |
1393 |
-+ "n_small_free_smf", val); |
1394 |
-+ else if (strcmp(name, "g_smf_large") == 0) |
1395 |
-+ return varnish_submit_gauge(conf->instance, "smf", "objects", |
1396 |
-+ "n_large_free_smf", val); |
1397 |
-+ } |
1398 |
-+ |
1399 |
-+ if (conf->collect_mgt) { |
1400 |
-+ if (strcmp(name, "uptime") == 0) |
1401 |
-+ return varnish_submit_gauge(conf->instance, "mgt", "uptime", |
1402 |
-+ "mgt_proc_uptime", val); |
1403 |
-+ else if (strcmp(name, "child_start") == 0) |
1404 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1405 |
-+ "child_start", val); |
1406 |
-+ else if (strcmp(name, "child_exit") == 0) |
1407 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1408 |
-+ "child_exit", val); |
1409 |
-+ else if (strcmp(name, "child_stop") == 0) |
1410 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1411 |
-+ "child_stop", val); |
1412 |
-+ else if (strcmp(name, "child_died") == 0) |
1413 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1414 |
-+ "child_died", val); |
1415 |
-+ else if (strcmp(name, "child_dump") == 0) |
1416 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1417 |
-+ "child_dump", val); |
1418 |
-+ else if (strcmp(name, "child_panic") == 0) |
1419 |
-+ return varnish_submit_derive(conf->instance, "mgt", "total_operations", |
1420 |
-+ "child_panic", val); |
1421 |
-+ } |
1422 |
-+ |
1423 |
-+ if (conf->collect_lck) { |
1424 |
-+ if (strcmp(name, "creat") == 0) |
1425 |
-+ return varnish_submit_gauge(conf->instance, "lck", "objects", "created", |
1426 |
-+ val); |
1427 |
-+ else if (strcmp(name, "destroy") == 0) |
1428 |
-+ return varnish_submit_gauge(conf->instance, "lck", "objects", "destroyed", |
1429 |
-+ val); |
1430 |
-+ else if (strcmp(name, "locks") == 0) |
1431 |
-+ return varnish_submit_derive(conf->instance, "lck", "total_operations", |
1432 |
-+ "lock_ops", val); |
1433 |
-+ } |
1434 |
-+ |
1435 |
-+ if (conf->collect_mempool) { |
1436 |
-+ if (strcmp(name, "live") == 0) |
1437 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1438 |
-+ "in_use", val); |
1439 |
-+ else if (strcmp(name, "pool") == 0) |
1440 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1441 |
-+ "in_pool", val); |
1442 |
-+ else if (strcmp(name, "sz_wanted") == 0) |
1443 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "bytes", |
1444 |
-+ "size_requested", val); |
1445 |
-+ else if (strcmp(name, "sz_actual") == 0) |
1446 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "bytes", |
1447 |
-+ "size_allocated", val); |
1448 |
-+ else if (strcmp(name, "allocs") == 0) |
1449 |
-+ return varnish_submit_derive(conf->instance, "mempool", |
1450 |
-+ "total_operations", "allocations", val); |
1451 |
-+ else if (strcmp(name, "frees") == 0) |
1452 |
-+ return varnish_submit_derive(conf->instance, "mempool", |
1453 |
-+ "total_operations", "frees", val); |
1454 |
-+ else if (strcmp(name, "recycle") == 0) |
1455 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1456 |
-+ "recycled", val); |
1457 |
-+ else if (strcmp(name, "timeout") == 0) |
1458 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1459 |
-+ "timed_out", val); |
1460 |
-+ else if (strcmp(name, "toosmall") == 0) |
1461 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1462 |
-+ "too_small", val); |
1463 |
-+ else if (strcmp(name, "surplus") == 0) |
1464 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1465 |
-+ "surplus", val); |
1466 |
-+ else if (strcmp(name, "randry") == 0) |
1467 |
-+ return varnish_submit_gauge(conf->instance, "mempool", "objects", |
1468 |
-+ "ran_dry", val); |
1469 |
-+ } |
1470 |
-+ |
1471 |
-+ if (conf->collect_mse) { |
1472 |
-+ if (strcmp(name, "c_full") == 0) |
1473 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1474 |
-+ "full_allocs", val); |
1475 |
-+ else if (strcmp(name, "c_truncated") == 0) |
1476 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1477 |
-+ "truncated_allocs", val); |
1478 |
-+ else if (strcmp(name, "c_expanded") == 0) |
1479 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1480 |
-+ "expanded_allocs", val); |
1481 |
-+ else if (strcmp(name, "c_failed") == 0) |
1482 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1483 |
-+ "failed_allocs", val); |
1484 |
-+ else if (strcmp(name, "c_bytes") == 0) |
1485 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_bytes", |
1486 |
-+ "bytes_allocated", val); |
1487 |
-+ else if (strcmp(name, "c_freed") == 0) |
1488 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_bytes", |
1489 |
-+ "bytes_freed", val); |
1490 |
-+ else if (strcmp(name, "g_fo_alloc") == 0) |
1491 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1492 |
-+ "fo_allocs_outstanding", val); |
1493 |
-+ else if (strcmp(name, "g_fo_bytes") == 0) |
1494 |
-+ return varnish_submit_gauge(conf->instance, "mse", "bytes", |
1495 |
-+ "fo_bytes_outstanding", val); |
1496 |
-+ else if (strcmp(name, "g_membuf_alloc") == 0) |
1497 |
-+ return varnish_submit_gauge(conf->instance, "mse", "objects", |
1498 |
-+ "membufs_allocated", val); |
1499 |
-+ else if (strcmp(name, "g_membuf_inuse") == 0) |
1500 |
-+ return varnish_submit_gauge(conf->instance, "mse", "objects", |
1501 |
-+ "membufs_inuse", val); |
1502 |
-+ else if (strcmp(name, "g_bans_bytes") == 0) |
1503 |
-+ return varnish_submit_gauge(conf->instance, "mse", "bytes", |
1504 |
-+ "persisted_banspace_used", val); |
1505 |
-+ else if (strcmp(name, "g_bans_space") == 0) |
1506 |
-+ return varnish_submit_gauge(conf->instance, "mse", "bytes", |
1507 |
-+ "persisted_banspace_available", val); |
1508 |
-+ else if (strcmp(name, "g_bans_persisted") == 0) |
1509 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1510 |
-+ "bans_persisted", val); |
1511 |
-+ else if (strcmp(name, "g_bans_lost") == 0) |
1512 |
-+ return varnish_submit_derive(conf->instance, "mse", "total_operations", |
1513 |
-+ "bans_lost", val); |
1514 |
-+ |
1515 |
-+ /* mse seg */ |
1516 |
-+ else if (strcmp(name, "g_journal_bytes") == 0) |
1517 |
-+ return varnish_submit_gauge(conf->instance, "mse_reg", "bytes", |
1518 |
-+ "journal_bytes_used", val); |
1519 |
-+ else if (strcmp(name, "g_journal_space") == 0) |
1520 |
-+ return varnish_submit_gauge(conf->instance, "mse_reg", "bytes", |
1521 |
-+ "journal_bytes_free", val); |
1522 |
-+ |
1523 |
-+ /* mse segagg */ |
1524 |
-+ else if (strcmp(name, "g_bigspace") == 0) |
1525 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "bytes", |
1526 |
-+ "big_extents_bytes_available", val); |
1527 |
-+ else if (strcmp(name, "g_extfree") == 0) |
1528 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "objects", |
1529 |
-+ "free_extents", val); |
1530 |
-+ else if (strcmp(name, "g_sparenode") == 0) |
1531 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "objects", |
1532 |
-+ "spare_nodes_available", val); |
1533 |
-+ else if (strcmp(name, "g_objnode") == 0) |
1534 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "objects", |
1535 |
-+ "object_nodes_in_use", val); |
1536 |
-+ else if (strcmp(name, "g_extnode") == 0) |
1537 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "objects", |
1538 |
-+ "extent_nodes_in_use", val); |
1539 |
-+ else if (strcmp(name, "g_bigextfree") == 0) |
1540 |
-+ return varnish_submit_gauge(conf->instance, "mse_segagg", "objects", |
1541 |
-+ "free_big_extents", val); |
1542 |
-+ else if (strcmp(name, "c_pruneloop") == 0) |
1543 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1544 |
-+ "total_operations", "prune_loops", val); |
1545 |
-+ else if (strcmp(name, "c_pruned") == 0) |
1546 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1547 |
-+ "total_objects", "pruned_objects", val); |
1548 |
-+ else if (strcmp(name, "c_spared") == 0) |
1549 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1550 |
-+ "total_operations", "spared_objects", val); |
1551 |
-+ else if (strcmp(name, "c_skipped") == 0) |
1552 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1553 |
-+ "total_operations", "missed_objects", val); |
1554 |
-+ else if (strcmp(name, "c_nuked") == 0) |
1555 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1556 |
-+ "total_operations", "nuked_objects", val); |
1557 |
-+ else if (strcmp(name, "c_sniped") == 0) |
1558 |
-+ return varnish_submit_derive(conf->instance, "mse_segagg", |
1559 |
-+ "total_operations", "sniped_objects", val); |
1560 |
-+ } |
1561 |
-+ |
1562 |
- #endif |
1563 |
- |
1564 |
-- return (0); |
1565 |
-+ return 0; |
1566 |
- |
1567 |
- } /* }}} static int varnish_monitor */ |
1568 |
- #else /* if HAVE_VARNISH_V2 */ |
1569 |
-@@ -971,21 +1326,32 @@ static void varnish_monitor(const user_config_t *conf, /* {{{ */ |
1570 |
- } /* }}} void varnish_monitor */ |
1571 |
- #endif |
1572 |
- |
1573 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1574 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1575 |
- static int varnish_read(user_data_t *ud) /* {{{ */ |
1576 |
- { |
1577 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1578 |
- struct VSM_data *vd; |
1579 |
-- const c_varnish_stats_t *stats; |
1580 |
- _Bool ok; |
1581 |
-+ const c_varnish_stats_t *stats; |
1582 |
-+#elif HAVE_VARNISH_V5 |
1583 |
-+ struct vsm *vd; |
1584 |
-+ struct vsc *vsc; |
1585 |
-+ int vsm_status; |
1586 |
-+#endif |
1587 |
- |
1588 |
- user_config_t *conf; |
1589 |
- |
1590 |
- if ((ud == NULL) || (ud->data == NULL)) |
1591 |
-- return (EINVAL); |
1592 |
-+ return EINVAL; |
1593 |
- |
1594 |
- conf = ud->data; |
1595 |
- |
1596 |
- vd = VSM_New(); |
1597 |
-+ |
1598 |
-+#if HAVE_VARNISH_V5 |
1599 |
-+ vsc = VSC_New(); |
1600 |
-+#endif |
1601 |
-+ |
1602 |
- #if HAVE_VARNISH_V3 |
1603 |
- VSC_Setup(vd); |
1604 |
- #endif |
1605 |
-@@ -993,48 +1359,85 @@ static int varnish_read(user_data_t *ud) /* {{{ */ |
1606 |
- if (conf->instance != NULL) { |
1607 |
- int status; |
1608 |
- |
1609 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1610 |
- status = VSM_n_Arg(vd, conf->instance); |
1611 |
-+#elif HAVE_VARNISH_V5 |
1612 |
-+ status = VSM_Arg(vd, 'n', conf->instance); |
1613 |
-+#endif |
1614 |
-+ |
1615 |
- if (status < 0) { |
1616 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1617 |
- VSM_Delete(vd); |
1618 |
-- ERROR("varnish plugin: VSM_n_Arg (\"%s\") failed " |
1619 |
-+#elif HAVE_VARNISH_V5 |
1620 |
-+ VSC_Destroy(&vsc, vd); |
1621 |
-+ VSM_Destroy(&vd); |
1622 |
-+#endif |
1623 |
-+ ERROR("varnish plugin: VSM_Arg (\"%s\") failed " |
1624 |
- "with status %i.", |
1625 |
- conf->instance, status); |
1626 |
-- return (-1); |
1627 |
-+ return -1; |
1628 |
- } |
1629 |
- } |
1630 |
- |
1631 |
- #if HAVE_VARNISH_V3 |
1632 |
- ok = (VSC_Open(vd, /* diag = */ 1) == 0); |
1633 |
--#else /* if HAVE_VARNISH_V4 */ |
1634 |
-+#elif HAVE_VARNISH_V4 |
1635 |
- ok = (VSM_Open(vd) == 0); |
1636 |
- #endif |
1637 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1638 |
- if (!ok) { |
1639 |
- VSM_Delete(vd); |
1640 |
- ERROR("varnish plugin: Unable to open connection."); |
1641 |
-- |
1642 |
-- return (-1); |
1643 |
-+ return -1; |
1644 |
- } |
1645 |
-+#endif |
1646 |
- |
1647 |
- #if HAVE_VARNISH_V3 |
1648 |
- stats = VSC_Main(vd); |
1649 |
--#else /* if HAVE_VARNISH_V4 */ |
1650 |
-+#elif HAVE_VARNISH_V4 |
1651 |
- stats = VSC_Main(vd, NULL); |
1652 |
- #endif |
1653 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1654 |
- if (!stats) { |
1655 |
- VSM_Delete(vd); |
1656 |
- ERROR("varnish plugin: Unable to get statistics."); |
1657 |
-+ return -1; |
1658 |
-+ } |
1659 |
-+#endif |
1660 |
-+ |
1661 |
-+#if HAVE_VARNISH_V5 |
1662 |
-+ if (VSM_Attach(vd, STDERR_FILENO)) { |
1663 |
-+ ERROR("varnish plugin: Cannot attach to varnish. %s", VSM_Error(vd)); |
1664 |
-+ VSC_Destroy(&vsc, vd); |
1665 |
-+ VSM_Destroy(&vd); |
1666 |
-+ return -1; |
1667 |
-+ } |
1668 |
- |
1669 |
-- return (-1); |
1670 |
-+ vsm_status = VSM_Status(vd); |
1671 |
-+ if (vsm_status & ~(VSM_MGT_RUNNING | VSM_WRK_RUNNING)) { |
1672 |
-+ ERROR("varnish plugin: Unable to get statistics."); |
1673 |
-+ VSC_Destroy(&vsc, vd); |
1674 |
-+ VSM_Destroy(&vd); |
1675 |
-+ return -1; |
1676 |
- } |
1677 |
-+#endif |
1678 |
- |
1679 |
- #if HAVE_VARNISH_V3 |
1680 |
- VSC_Iter(vd, varnish_monitor, conf); |
1681 |
--#else /* if HAVE_VARNISH_V4 */ |
1682 |
-+#elif HAVE_VARNISH_V4 |
1683 |
- VSC_Iter(vd, NULL, varnish_monitor, conf); |
1684 |
-+#elif HAVE_VARNISH_V5 |
1685 |
-+ VSC_Iter(vsc, vd, varnish_monitor, conf); |
1686 |
- #endif |
1687 |
-+ |
1688 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1689 |
- VSM_Delete(vd); |
1690 |
-+#elif HAVE_VARNISH_V5 |
1691 |
-+ VSC_Destroy(&vsc, vd); |
1692 |
-+ VSM_Destroy(&vd); |
1693 |
-+#endif |
1694 |
- |
1695 |
-- return (0); |
1696 |
-+ return 0; |
1697 |
- } /* }}} */ |
1698 |
- #else /* if HAVE_VARNISH_V2 */ |
1699 |
- static int varnish_read(user_data_t *ud) /* {{{ */ |
1700 |
-@@ -1044,7 +1447,7 @@ static int varnish_read(user_data_t *ud) /* {{{ */ |
1701 |
- user_config_t *conf; |
1702 |
- |
1703 |
- if ((ud == NULL) || (ud->data == NULL)) |
1704 |
-- return (EINVAL); |
1705 |
-+ return EINVAL; |
1706 |
- |
1707 |
- conf = ud->data; |
1708 |
- |
1709 |
-@@ -1052,12 +1455,12 @@ static int varnish_read(user_data_t *ud) /* {{{ */ |
1710 |
- if (stats == NULL) { |
1711 |
- ERROR("Varnish plugin : unable to load statistics"); |
1712 |
- |
1713 |
-- return (-1); |
1714 |
-+ return -1; |
1715 |
- } |
1716 |
- |
1717 |
- varnish_monitor(conf, stats); |
1718 |
- |
1719 |
-- return (0); |
1720 |
-+ return 0; |
1721 |
- } /* }}} */ |
1722 |
- #endif |
1723 |
- |
1724 |
-@@ -1075,7 +1478,7 @@ static void varnish_config_free(void *ptr) /* {{{ */ |
1725 |
- static int varnish_config_apply_default(user_config_t *conf) /* {{{ */ |
1726 |
- { |
1727 |
- if (conf == NULL) |
1728 |
-- return (EINVAL); |
1729 |
-+ return EINVAL; |
1730 |
- |
1731 |
- conf->collect_backend = 1; |
1732 |
- conf->collect_cache = 1; |
1733 |
-@@ -1096,21 +1499,29 @@ static int varnish_config_apply_default(user_config_t *conf) /* {{{ */ |
1734 |
- conf->collect_shm = 1; |
1735 |
- #if HAVE_VARNISH_V2 |
1736 |
- conf->collect_sm = 0; |
1737 |
-+#endif |
1738 |
-+#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1739 |
- conf->collect_sma = 0; |
1740 |
- #endif |
1741 |
- conf->collect_sms = 0; |
1742 |
- conf->collect_struct = 0; |
1743 |
- conf->collect_totals = 0; |
1744 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1745 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1746 |
- conf->collect_uptime = 0; |
1747 |
- #endif |
1748 |
- conf->collect_vcl = 0; |
1749 |
- conf->collect_workers = 0; |
1750 |
--#if HAVE_VARNISH_V4 |
1751 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1752 |
- conf->collect_vsm = 0; |
1753 |
-+ conf->collect_lck = 0; |
1754 |
-+ conf->collect_mempool = 0; |
1755 |
-+ conf->collect_mgt = 0; |
1756 |
-+ conf->collect_smf = 0; |
1757 |
-+ conf->collect_vbe = 0; |
1758 |
-+ conf->collect_mse = 0; |
1759 |
- #endif |
1760 |
- |
1761 |
-- return (0); |
1762 |
-+ return 0; |
1763 |
- } /* }}} int varnish_config_apply_default */ |
1764 |
- |
1765 |
- static int varnish_init(void) /* {{{ */ |
1766 |
-@@ -1118,11 +1529,11 @@ static int varnish_init(void) /* {{{ */ |
1767 |
- user_config_t *conf; |
1768 |
- |
1769 |
- if (have_instance) |
1770 |
-- return (0); |
1771 |
-+ return 0; |
1772 |
- |
1773 |
- conf = calloc(1, sizeof(*conf)); |
1774 |
- if (conf == NULL) |
1775 |
-- return (ENOMEM); |
1776 |
-+ return ENOMEM; |
1777 |
- |
1778 |
- /* Default settings: */ |
1779 |
- conf->instance = NULL; |
1780 |
-@@ -1133,11 +1544,12 @@ static int varnish_init(void) /* {{{ */ |
1781 |
- /* group = */ "varnish", |
1782 |
- /* name = */ "varnish/localhost", |
1783 |
- /* callback = */ varnish_read, |
1784 |
-- /* interval = */ 0, &(user_data_t){ |
1785 |
-- .data = conf, .free_func = varnish_config_free, |
1786 |
-- }); |
1787 |
-+ /* interval = */ 0, |
1788 |
-+ &(user_data_t){ |
1789 |
-+ .data = conf, .free_func = varnish_config_free, |
1790 |
-+ }); |
1791 |
- |
1792 |
-- return (0); |
1793 |
-+ return 0; |
1794 |
- } /* }}} int varnish_init */ |
1795 |
- |
1796 |
- static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1797 |
-@@ -1147,7 +1559,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1798 |
- |
1799 |
- conf = calloc(1, sizeof(*conf)); |
1800 |
- if (conf == NULL) |
1801 |
-- return (ENOMEM); |
1802 |
-+ return ENOMEM; |
1803 |
- conf->instance = NULL; |
1804 |
- |
1805 |
- varnish_config_apply_default(conf); |
1806 |
-@@ -1158,7 +1570,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1807 |
- status = cf_util_get_string(ci, &conf->instance); |
1808 |
- if (status != 0) { |
1809 |
- sfree(conf); |
1810 |
-- return (status); |
1811 |
-+ return status; |
1812 |
- } |
1813 |
- assert(conf->instance != NULL); |
1814 |
- |
1815 |
-@@ -1170,7 +1582,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1816 |
- WARNING("Varnish plugin: \"Instance\" blocks accept only " |
1817 |
- "one argument."); |
1818 |
- sfree(conf); |
1819 |
-- return (EINVAL); |
1820 |
-+ return EINVAL; |
1821 |
- } |
1822 |
- |
1823 |
- for (int i = 0; i < ci->children_num; i++) { |
1824 |
-@@ -1218,11 +1630,11 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1825 |
- else if (strcasecmp("CollectSMS", child->key) == 0) |
1826 |
- cf_util_get_boolean(child, &conf->collect_sms); |
1827 |
- else if (strcasecmp("CollectSMA", child->key) == 0) |
1828 |
--#if HAVE_VARNISH_V2 |
1829 |
-+#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1830 |
- cf_util_get_boolean(child, &conf->collect_sma); |
1831 |
- #else |
1832 |
- WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1833 |
-- child->key, "v2"); |
1834 |
-+ child->key, "v2 and v4"); |
1835 |
- #endif |
1836 |
- else if (strcasecmp("CollectSM", child->key) == 0) |
1837 |
- #if HAVE_VARNISH_V2 |
1838 |
-@@ -1236,7 +1648,7 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1839 |
- else if (strcasecmp("CollectTotals", child->key) == 0) |
1840 |
- cf_util_get_boolean(child, &conf->collect_totals); |
1841 |
- else if (strcasecmp("CollectUptime", child->key) == 0) |
1842 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1843 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1844 |
- cf_util_get_boolean(child, &conf->collect_uptime); |
1845 |
- #else |
1846 |
- WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1847 |
-@@ -1247,11 +1659,60 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1848 |
- else if (strcasecmp("CollectWorkers", child->key) == 0) |
1849 |
- cf_util_get_boolean(child, &conf->collect_workers); |
1850 |
- else if (strcasecmp("CollectVSM", child->key) == 0) |
1851 |
--#if HAVE_VARNISH_V4 |
1852 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1853 |
- cf_util_get_boolean(child, &conf->collect_vsm); |
1854 |
- #else |
1855 |
- WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1856 |
- child->key, "v4"); |
1857 |
-+#endif |
1858 |
-+ else if (strcasecmp("CollectLock", child->key) == 0) |
1859 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1860 |
-+ cf_util_get_boolean(child, &conf->collect_lck); |
1861 |
-+#else |
1862 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1863 |
-+ child->key, "v4"); |
1864 |
-+#endif |
1865 |
-+ else if (strcasecmp("CollectMempool", child->key) == 0) |
1866 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1867 |
-+ cf_util_get_boolean(child, &conf->collect_mempool); |
1868 |
-+#else |
1869 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1870 |
-+ child->key, "v4"); |
1871 |
-+#endif |
1872 |
-+ else if (strcasecmp("CollectManagement", child->key) == 0) |
1873 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1874 |
-+ cf_util_get_boolean(child, &conf->collect_mgt); |
1875 |
-+#else |
1876 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1877 |
-+ child->key, "v4"); |
1878 |
-+#endif |
1879 |
-+ else if (strcasecmp("CollectSMF", child->key) == 0) |
1880 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1881 |
-+ cf_util_get_boolean(child, &conf->collect_smf); |
1882 |
-+#else |
1883 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1884 |
-+ child->key, "v4"); |
1885 |
-+#endif |
1886 |
-+ else if (strcasecmp("CollectSMF", child->key) == 0) |
1887 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1888 |
-+ cf_util_get_boolean(child, &conf->collect_smf); |
1889 |
-+#else |
1890 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1891 |
-+ child->key, "v4"); |
1892 |
-+#endif |
1893 |
-+ else if (strcasecmp("CollectVBE", child->key) == 0) |
1894 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1895 |
-+ cf_util_get_boolean(child, &conf->collect_vbe); |
1896 |
-+#else |
1897 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1898 |
-+ child->key, "v4"); |
1899 |
-+#endif |
1900 |
-+ else if (strcasecmp("CollectMSE", child->key) == 0) |
1901 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1902 |
-+ cf_util_get_boolean(child, &conf->collect_mse); |
1903 |
-+#else |
1904 |
-+ WARNING("Varnish plugin: \"%s\" is available for Varnish %s only.", |
1905 |
-+ child->key, "Plus v4"); |
1906 |
- #endif |
1907 |
- else { |
1908 |
- WARNING("Varnish plugin: Ignoring unknown " |
1909 |
-@@ -1275,38 +1736,44 @@ static int varnish_config_instance(const oconfig_item_t *ci) /* {{{ */ |
1910 |
- #endif |
1911 |
- && !conf->collect_session && !conf->collect_shm && !conf->collect_sms |
1912 |
- #if HAVE_VARNISH_V2 |
1913 |
-- && !conf->collect_sma && !conf->collect_sm |
1914 |
-+ && !conf->collect_sm |
1915 |
-+#endif |
1916 |
-+#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1917 |
-+ && !conf->collect_sma |
1918 |
- #endif |
1919 |
- && !conf->collect_struct && !conf->collect_totals |
1920 |
--#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 |
1921 |
-+#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1922 |
- && !conf->collect_uptime |
1923 |
- #endif |
1924 |
- && !conf->collect_vcl && !conf->collect_workers |
1925 |
--#if HAVE_VARNISH_V4 |
1926 |
-- && !conf->collect_vsm |
1927 |
-+#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5 |
1928 |
-+ && !conf->collect_vsm && !conf->collect_vbe && !conf->collect_smf && |
1929 |
-+ !conf->collect_mgt && !conf->collect_lck && !conf->collect_mempool && |
1930 |
-+ !conf->collect_mse |
1931 |
- #endif |
1932 |
- ) { |
1933 |
- WARNING("Varnish plugin: No metric has been configured for " |
1934 |
- "instance \"%s\". Disabling this instance.", |
1935 |
- (conf->instance == NULL) ? "localhost" : conf->instance); |
1936 |
- sfree(conf); |
1937 |
-- return (EINVAL); |
1938 |
-+ return EINVAL; |
1939 |
- } |
1940 |
- |
1941 |
-- ssnprintf(callback_name, sizeof(callback_name), "varnish/%s", |
1942 |
-- (conf->instance == NULL) ? "localhost" : conf->instance); |
1943 |
-+ snprintf(callback_name, sizeof(callback_name), "varnish/%s", |
1944 |
-+ (conf->instance == NULL) ? "localhost" : conf->instance); |
1945 |
- |
1946 |
- plugin_register_complex_read( |
1947 |
- /* group = */ "varnish", |
1948 |
- /* name = */ callback_name, |
1949 |
- /* callback = */ varnish_read, |
1950 |
-- /* interval = */ 0, &(user_data_t){ |
1951 |
-- .data = conf, .free_func = varnish_config_free, |
1952 |
-- }); |
1953 |
-+ /* interval = */ 0, |
1954 |
-+ &(user_data_t){ |
1955 |
-+ .data = conf, .free_func = varnish_config_free, |
1956 |
-+ }); |
1957 |
- |
1958 |
- have_instance = 1; |
1959 |
- |
1960 |
-- return (0); |
1961 |
-+ return 0; |
1962 |
- } /* }}} int varnish_config_instance */ |
1963 |
- |
1964 |
- static int varnish_config(oconfig_item_t *ci) /* {{{ */ |
1965 |
-@@ -1323,7 +1790,7 @@ static int varnish_config(oconfig_item_t *ci) /* {{{ */ |
1966 |
- } |
1967 |
- } |
1968 |
- |
1969 |
-- return (0); |
1970 |
-+ return 0; |
1971 |
- } /* }}} int varnish_config */ |
1972 |
- |
1973 |
- void module_register(void) /* {{{ */ |
1974 |
-@@ -1331,5 +1798,3 @@ void module_register(void) /* {{{ */ |
1975 |
- plugin_register_complex_config("varnish", varnish_config); |
1976 |
- plugin_register_init("varnish", varnish_init); |
1977 |
- } /* }}} */ |
1978 |
-- |
1979 |
--/* vim: set sw=8 noet fdm=marker : */ |