Collect DPDK interface statistics.
See docs/BUILD.dpdkstat.md for detailed build instructions.
+ This plugin should be compiled with compiler defenses enabled, for
+ example -fstack-protector.
+
- drbd
Collect individual drbd resource statistics.
hugepages can be found here:
https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt.
+ This plugin should be compiled with compiler defenses enabled, for
+ example -fstack-protector.
+
- intel_pmu
The intel_pmu plugin reads performance counters provided by the Linux
kernel perf interface. The plugin uses jevents library to resolve named
-#! /bin/sh
+#!/bin/sh
GLOBAL_ERROR_INDICATOR=0
-check_for_application ()
+check_for_application()
{
- for PROG in "$@"
- do
- which "$PROG" >/dev/null 2>&1
- if test $? -ne 0; then
- cat >&2 <<EOF
+ for PROG in "$@"
+ do
+ which "$PROG" >/dev/null 2>&1
+ if test $? -ne 0; then
+ cat >&2 <<EOF
WARNING: \`$PROG' not found!
Please make sure that \`$PROG' is installed and is in one of the
directories listed in the PATH environment variable.
EOF
- GLOBAL_ERROR_INDICATOR=1
- fi
- done
+ GLOBAL_ERROR_INDICATOR=1
+ fi
+ done
}
check_for_application lex bison autoheader aclocal automake autoconf pkg-config
libtoolize=""
libtoolize --version >/dev/null 2>/dev/null
-if test $? -eq 0
-then
- libtoolize=libtoolize
+if test $? -eq 0; then
+ libtoolize=libtoolize
else
- glibtoolize --version >/dev/null 2>/dev/null
- if test $? -eq 0
- then
- libtoolize=glibtoolize
- else
- cat >&2 <<EOF
+ glibtoolize --version >/dev/null 2>/dev/null
+ if test $? -eq 0; then
+ libtoolize=glibtoolize
+ else
+ cat >&2 <<EOF
WARNING: Neither \`libtoolize' nor \`glibtoolize' have been found!
Please make sure that one of them is installed and is in one of the
directories listed in the PATH environment variable.
EOF
- GLOBAL_ERROR_INDICATOR=1
- fi
+ GLOBAL_ERROR_INDICATOR=1
+ fi
fi
-if test "$GLOBAL_ERROR_INDICATOR" != "0"
-then
- exit 1
+if test "$GLOBAL_ERROR_INDICATOR" != "0"; then
+ exit 1
fi
set -x
autoheader \
-&& aclocal \
+&& aclocal -I m4 \
&& $libtoolize --copy --force \
&& automake --add-missing --copy \
&& autoconf
=head1 CONFIGURATION
-This script reads it's configuration from F</etc/exec-munin.conf>. The
+This script reads its configuration from F</etc/exec-munin.conf>. The
configuration is read using C<Config::General> which understands a Apache-like
config syntax, so it's very similar to the F<collectd.conf> syntax, too.
=head1 CONFIGURATION
-This script reads it's configuration from F</etc/exec-nagios.conf>. The
+This script reads its configuration from F</etc/exec-nagios.conf>. The
configuration is read using C<Config::General> which understands a Apache-like
config syntax, so it's very similar to the F<collectd.conf> syntax, too.
}
/**
- * Draw RRD file based on it's structure
+ * Draw RRD file based on its structure
* @host
* @plugin
* @pinst
}
/**
- * Draw RRD file based on it's structure
+ * Draw RRD file based on its structure
* @timespan
* @host
* @plugin
# The dpdkstat plugin
+This plugin is optional and only has a specific use case: monitoring DPDK applications
+that don't expose stats in any other way than the DPDK xstats API.
+
**Data Plane Development Kit** (DPDK) is a set of drivers and libraries for fast
-packet processing.
+packet processing. Please note that this plugin is a polling based plugin rather
+than an events based plugin (using it will drive up core utilization on a system).
+
+**PLEASE DO NOT USE THIS PLUGIN FOR OVS-DPDK**. dpdkstat is really for DPDK
+applications that have no other way of exposing stats. For OVS or OVS-with-DPDK the
+Open vSwitch plugins available in collectd 5.8.0 should be used for
+collecting stats and events. In addition the OVS plugin is events based rather
+than polling based and will have a smaller footprint on the system.
## Summary
=item B<PUTVAL> I<Identifier> [I<OptionList>] I<Valuelist>
Submits one or more values (identified by I<Identifier>, see below) to the
-daemon which will dispatch it to all it's write-plugins.
+daemon which will dispatch it to all its write-plugins.
An I<Identifier> is of the form
C<I<host>B</>I<plugin>B<->I<instance>B</>I<type>B<->I<instance>> with both
=head1 RETURN VALUE
As usual for Nagios plugins, this program writes a short, one line status
-message to STDOUT and signals success or failure with it's return value. It
+message to STDOUT and signals success or failure with its return value. It
exits with a return value of B<0> for I<success>, B<1> for I<warning> and B<2>
for I<critical>. If the values are not available or some other error occurred,
it returns B<3> for I<unknown>.
"interesting". As a consequence collectd will issue a notification if they are
not received for B<Timeout> iterations. The B<Timeout> configuration option is
explained in section L<collectd.conf(5)/"GLOBAL OPTIONS">. If, for example,
-B<Timeout> is set to "2" (the default) and some hosts sends it's CPU statistics
+B<Timeout> is set to "2" (the default) and some hosts sends its CPU statistics
to the server every 60 seconds, a notification will be dispatched after about
120 seconds. It may take a little longer because the timeout is checked only
once each B<Interval> on the server.
=item B<PUTVAL> I<Identifier> [I<OptionList>] I<Valuelist>
Submits one or more values (identified by I<Identifier>, see below) to the
-daemon which will dispatch it to all it's write-plugins.
+daemon which will dispatch it to all its write-plugins.
An I<Identifier> is of the form
C<I<host>B</>I<plugin>B<->I<instance>B</>I<type>B<->I<instance>> with both
=head1 PLUGINS
-As noted above, the real power of collectd lies within it's plugins. A
+As noted above, the real power of collectd lies within its plugins. A
(hopefully complete) list of plugins and short descriptions can be found in the
F<README> file that is distributed with the sourcecode. If you're using a
package it's a good bet to search somewhere near F</usr/share/doc/collectd>.
/* #endif KERNEL_LINUX */
#elif defined(HAVE_LIBKSTAT)
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
/* colleague tells me that Sun doesn't sell systems with more than 100 or so
* CPUs.. */
#define MAX_NUMCPU 256
#include <statgrab.h>
#endif
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#ifndef COLLECTD_LOCALE
#define COLLECTD_LOCALE "C"
#endif
} /* static int change_basedir (char *dir) */
#if HAVE_LIBKSTAT
+extern kstat_ctl_t *kc;
static void update_kstat(void) {
if (kc == NULL) {
if ((kc = kstat_open()) == NULL)
return 0;
}
- NOTICE("Upstart detected, stopping now to signal readyness.");
+ NOTICE("Upstart detected, stopping now to signal readiness.");
raise(SIGSTOP);
unsetenv("UPSTART_JOB");
notifysocket);
return 0;
}
- NOTICE("Systemd detected, trying to signal readyness.");
+ NOTICE("Systemd detected, trying to signal readiness.");
unsetenv("NOTIFY_SOCKET");
#include <sys/capability.h>
#endif
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#ifdef HAVE_LIBKSTAT
extern kstat_ctl_t *kc;
#endif
#include "common.h"
#include "testing.h"
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
#include "plugin.h"
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
kstat_ctl_t *kc = NULL;
#endif /* HAVE_LIBKSTAT */
* Florian octo Forster <octo at collectd.org>
*/
-#include "common.h" /* for STATIC_ARRAY_SIZE */
#include "collectd.h"
+#include "common.h" /* for STATIC_ARRAY_SIZE */
#include "testing.h"
#include "utils_subst.h"
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
/* #endif KERNEL_FREEBSD */
#elif HAVE_LIBKSTAT
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
#define MAX_NUMDISK 1024
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMDISK];
*md_out = meta_data_create();
if (*md_out == nullptr) {
return grpc::Status(grpc::StatusCode::RESOURCE_EXHAUSTED,
- grpc::string("failed to metadata list"));
+ grpc::string("failed to create metadata list"));
}
for (auto kv : rpc_metadata) {
auto k = kv.first.c_str();
return -EINVAL;
}
+ if (g_ctx.hw_events) {
+ ERROR(PMU_PLUGIN ": Duplicate config for HardwareEvents.");
+ return -EINVAL;
+ }
+
g_ctx.hw_events = calloc(ci->values_num, sizeof(char *));
if (g_ctx.hw_events == NULL) {
ERROR(PMU_PLUGIN ": Failed to allocate hw events.");
char *s, *tmp;
for (s = strtok_r(events, ",", &tmp); s; s = strtok_r(NULL, ",", &tmp)) {
- /* Multiple events parsed in one entry */
- if (group_events_count == 1) {
- /* Mark previously added event as group leader */
- el->eventlist_last->group_leader = 1;
- }
-
/* Allocate memory for event struct that contains array of efd structs
for all cores */
struct event *e =
return -ENOMEM;
}
- if (resolve_event(s, &e->attr) == 0) {
- e->next = NULL;
- if (!el->eventlist)
- el->eventlist = e;
- if (el->eventlist_last)
- el->eventlist_last->next = e;
- el->eventlist_last = e;
- e->event = strdup(s);
- } else {
- DEBUG(PMU_PLUGIN ": Cannot resolve %s", s);
+ if (resolve_event(s, &e->attr) != 0) {
+ WARNING(PMU_PLUGIN ": Cannot resolve %s", s);
sfree(e);
+ continue;
}
+ /* Multiple events parsed in one entry */
+ if (group_events_count == 1) {
+ /* Mark previously added event as group leader */
+ el->eventlist_last->group_leader = 1;
+ }
+
+ e->next = NULL;
+ if (!el->eventlist)
+ el->eventlist = e;
+ if (el->eventlist_last)
+ el->eventlist_last->next = e;
+ el->eventlist_last = e;
+ e->event = strdup(s);
+
group_events_count++;
}
static _Bool report_inactive = 1;
#ifdef HAVE_LIBKSTAT
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
#define MAX_NUMIF 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
if (st->sel_enabled) {
int status = 0;
- /* register threshold event if threshold sensor support events */
- if ((ipmi_sensor_get_event_reading_type(sensor) ==
- IPMI_EVENT_READING_TYPE_THRESHOLD) &&
- (ipmi_sensor_get_threshold_access(sensor) !=
- IPMI_THRESHOLD_ACCESS_SUPPORT_NONE))
+ /* register threshold event handler */
+ if (ipmi_sensor_get_event_reading_type(sensor) ==
+ IPMI_EVENT_READING_TYPE_THRESHOLD)
status = ipmi_sensor_add_threshold_event_handler(
sensor, sensor_threshold_event_handler, st);
/* register discrete handler if discrete/specific sensor support events */
oconfig_item_t *child = ci->children + i;
if (strcasecmp("Sensor", child->key) == 0)
- ignorelist_add(st->ignorelist, ci->values[0].value.string);
+ ignorelist_add(st->ignorelist, child->values[0].value.string);
else if (strcasecmp("IgnoreSelected", child->key) == 0) {
_Bool t;
status = cf_util_get_boolean(child, &t);
}
/* Don't send `ADD' notifications during startup (~ 1 minute) */
- int cycles = 1 + (60 / CDTIME_T_TO_TIME_T(plugin_get_interval()));
+ int cycles = 1 + (int)(TIME_T_TO_CDTIME_T(60) / plugin_get_interval());
st = instances;
while (NULL != st) {
}
db->is_connected = 0;
+ /* Close the old connection before initializing a new one. */
+ if (db->con != NULL) {
+ mysql_close(db->con);
+ db->con = NULL;
+ }
+
+ db->con = mysql_init(NULL);
if (db->con == NULL) {
- db->con = mysql_init(NULL);
- if (db->con == NULL) {
- ERROR("mysql plugin: mysql_init failed: %s", mysql_error(db->con));
- return NULL;
- }
+ ERROR("mysql plugin: mysql_init failed: %s", mysql_error(db->con));
+ return NULL;
}
/* Configure TCP connect timeout (default: 0) */
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats64)) < 0) {
- char errbuf[1024];
ERROR("netlink plugin: link_filter_cb: IFLA_STATS64 mnl_attr_validate2 "
"failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ STRERRNO);
return MNL_CB_ERROR;
}
stats.stats64 = mnl_attr_get_payload(attr);
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*stats.stats32)) < 0) {
- char errbuf[1024];
ERROR("netlink plugin: link_filter_cb: IFLA_STATS mnl_attr_validate2 "
"failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ STRERRNO);
return MNL_CB_ERROR;
}
stats.stats32 = mnl_attr_get_payload(attr);
if (mnl_attr_get_type(attr) == TCA_STATS_BASIC) {
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*q_stats->bs)) < 0) {
- char errbuf[1024];
ERROR("netlink plugin: qos_attr_cb: TCA_STATS_BASIC mnl_attr_validate2 "
"failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ STRERRNO);
return MNL_CB_ERROR;
}
q_stats->bs = mnl_attr_get_payload(attr);
continue;
if (mnl_attr_validate2(attr, MNL_TYPE_UNSPEC, sizeof(*ts)) < 0) {
- char errbuf[1024];
ERROR("netlink plugin: qos_filter_cb: TCA_STATS mnl_attr_validate2 "
"failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ STRERRNO);
return MNL_CB_ERROR;
}
ts = mnl_attr_get_payload(attr);
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
- char errbuf[1024];
- ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed: %s", STRERRNO);
return (-1);
}
ret = mnl_socket_recvfrom(nl, buf, sizeof(buf));
}
if (ret < 0) {
- char errbuf[1024];
ERROR("netlink plugin: ir_read: mnl_socket_recvfrom failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ STRERRNO);
continue;
}
} /* for (type_index) */
if (!YAJL_IS_OBJECT(jobject))
return -1;
- /* zero the interface info structure */
- memset(ifinfo, 0, sizeof(*ifinfo));
-
/* try to find external_ids, name and link_state fields */
jexternal_ids = ovs_utils_get_value_by_key(jobject, "external_ids");
if (jexternal_ids == NULL || ifinfo == NULL)
return -1;
+ /* zero the interface info structure */
+ memset(ifinfo, 0, sizeof(*ifinfo));
+
/* get iface-id from external_ids field */
jvalue = ovs_utils_get_map_value(jexternal_ids, "iface-id");
if (jvalue != NULL && YAJL_IS_STRING(jvalue))
/* Create or get port by port uuid */
static port_list_t *ovs_stats_new_port(bridge_list_t *bridge,
const char *uuid) {
+ if (uuid == NULL)
+ return NULL;
+
port_list_t *port = ovs_stats_get_port(uuid);
if (port == NULL) {
yajl_val *array = YAJL_GET_ARRAY(br_ports)->values;
size_t array_len = YAJL_GET_ARRAY(br_ports)->len;
if (array != NULL && array_len > 0 && YAJL_IS_ARRAY(array[1])) {
- yajl_val *ports_arr = YAJL_GET_ARRAY(array[1])->values;
- size_t ports_num = YAJL_GET_ARRAY(array[1])->len;
- for (size_t i = 0; i < ports_num && ports_arr != NULL; i++)
- ovs_stats_new_port(
- br, YAJL_GET_STRING(ports_arr[i]->u.array.values[1]));
+ if (YAJL_GET_ARRAY(array[1]) == NULL)
+ goto failure;
+ else {
+ yajl_val *ports_arr = YAJL_GET_ARRAY(array[1])->values;
+ size_t ports_num = YAJL_GET_ARRAY(array[1])->len;
+ for (size_t i = 0; i < ports_num && ports_arr != NULL; i++) {
+ tmp = YAJL_GET_STRING(ports_arr[i]->u.array.values[1]);
+ if (tmp != NULL)
+ ovs_stats_new_port(br, tmp);
+ else
+ goto failure;
+ }
+ }
}
} else
ovs_stats_new_port(br, YAJL_GET_STRING(br_ports->u.array.values[1]));
}
}
} else {
- ERROR("Incorrect JSON Bridge data");
- return -1;
+ goto failure;
}
+
return 0;
+
+failure:
+ ERROR("Incorrect JSON Bridge data");
+ return -1;
}
/* Handle JSON with Bridge Table change event */
ovs_stats_update_iface_ext_ids(port,
YAJL_GET_ARRAY(iface_ext_ids)->values[1]);
if (iface_uuid && YAJL_IS_ARRAY(iface_uuid) &&
- YAJL_GET_ARRAY(iface_uuid)->len == 2)
+ YAJL_GET_ARRAY(iface_uuid)->len == 2 &&
+ YAJL_GET_STRING(YAJL_GET_ARRAY(iface_uuid)->values[1]) != NULL)
sstrncpy(port->iface_uuid,
YAJL_GET_STRING(YAJL_GET_ARRAY(iface_uuid)->values[1]),
sizeof(port->iface_uuid));
+ else {
+ ERROR("ovs_stats plugin: incorrect JSON interface data");
+ return -1;
+ }
return 0;
}
char *br_name_dup = strdup(br_name);
if (br_name_dup == NULL) {
ERROR("%s: strdup() copy bridge name fail", plugin_name);
+ sfree(bridge);
goto cleanup_fail;
}
#error "No applicable input method."
#endif
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#define MAX_NUMTAPE 256
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMTAPE];
* Global variables
*/
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
extern kstat_ctl_t *kc;
#endif /* #endif HAVE_LIBKSTAT */
return lcore_mask;
} else {
char low_str[DATA_MAX_NAME_LEN];
- char high_str[DATA_MAX_NAME_LEN];
+ char high_str[DATA_MAX_NAME_LEN * 2];
memset(high_str, 0, sizeof(high_str));
memset(low_str, 0, sizeof(low_str));
* When a value above this range is added, Histogram's range is increased by
* increasing the bin width (note that number of bins remains always at 1000).
* This operation of increasing bin width is little expensive as each bin need
-* to be visited to update it's count. To reduce frequent change of bin width,
+* to be visited to update its count. To reduce frequent change of bin width,
* new bin width will be the next nearest power of 2. Example: 2, 4, 8, 16, 32,
* 64, 128, 256, 512, 1024, 2048, 5086, ...
*
#include "testing.h"
#include "utils_mount.h"
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
ovs_db_t *ovs_db_init(const char *node, const char *service,
const char *unix_path, ovs_db_callback_t *cb) {
+ int ret;
+
/* sanity check */
if (node == NULL || service == NULL || unix_path == NULL)
return NULL;
/* init event thread */
if (ovs_db_event_thread_init(pdb) < 0) {
- ovs_db_destroy(pdb);
- return NULL;
+ ret = ovs_db_destroy(pdb);
+ if (ret > 0)
+ goto failure;
}
/* init polling thread */
if (ovs_db_poll_thread_init(pdb) < 0) {
- ovs_db_destroy(pdb);
- return NULL;
+ ret = ovs_db_destroy(pdb);
+ if (ret > 0) {
+ ovs_db_event_thread_data_destroy(pdb);
+ goto failure;
+ }
}
return pdb;
+
+failure:
+ pthread_mutex_destroy(&pdb->mutex);
+ sfree(pdb);
+ return NULL;
}
int ovs_db_send_request(ovs_db_t *pdb, const char *method, const char *params,
/* try to lock the structure before releasing */
if ((ret = pthread_mutex_lock(&pdb->mutex))) {
OVS_ERROR("pthread_mutex_lock() DB mutex lock failed (%d)", ret);
- return -1;
+ return ret;
}
/* stop poll thread and destroy thread's private data */
/* check first element of the array */
str_val = YAJL_GET_STRING(array_values[0]);
- if (strcmp("map", str_val) != 0)
+ if (str_val == NULL || strcmp("map", str_val) != 0)
return NULL;
/* try to find map value by map key */
+ if (YAJL_GET_ARRAY(array_values[1]) == NULL)
+ return NULL;
+
map_len = YAJL_GET_ARRAY(array_values[1])->len;
map_values = YAJL_GET_ARRAY(array_values[1])->values;
for (size_t i = 0; i < map_len; i++) {
/* check YAJL array */
- if (!YAJL_IS_ARRAY(map_values[i]))
+ if (!YAJL_IS_ARRAY(map_values[i]) || YAJL_GET_ARRAY(map_values[i]) == NULL)
break;
/* check a database pair value (2-element, first one represents a key
/* return map value if given key equals map key */
str_val = YAJL_GET_STRING(array_values[0]);
- if (strcmp(key, str_val) == 0)
+ if (str_val != NULL && strcmp(key, str_val) == 0)
return array_values[1];
}
return NULL;
#include "utils_avltree.h"
#include "utils_vl_lookup.h"
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
#if HAVE_LIBKSTAT
kstat_ctl_t *kc;
#endif /* HAVE_LIBKSTAT */
char *uuid = uuid_get_local();
if (uuid) {
- sstrncpy(hostname_g, uuid, DATA_MAX_NAME_LEN);
+ hostname_set(uuid);
sfree(uuid);
return 0;
}
}
#endif
+static rd_kafka_resp_err_t kafka_error() {
+#if RD_KAFKA_VERSION >= 0x000b00ff
+ return rd_kafka_last_error();
+#else
+ return rd_kafka_errno2err(errno);
+#endif
+}
+
static uint32_t kafka_hash(const char *keydata, size_t keylen) {
uint32_t hash = 5381;
for (; keylen > 0; keylen--)
if ((ctx->topic = rd_kafka_topic_new(ctx->kafka, ctx->topic_name,
topic_conf)) == NULL) {
ERROR("write_kafka plugin: cannot create topic : %s\n",
- rd_kafka_err2str(rd_kafka_errno2err(errno)));
+ rd_kafka_err2str(kafka_error()));
return errno;
}
static cdtime_t staleness_delta = PROMETHEUS_DEFAULT_STALENESS_DELTA;
-/* Unfortunately, protoc-c doesn't export it's implementation of varint, so we
+/* Unfortunately, protoc-c doesn't export its implementation of varint, so we
* need to implement our own. */
static size_t varint(uint8_t buffer[static VARINT_UINT32_BYTES],
uint32_t value) {
if (fd == -1)
continue;
+ int tmp = 1;
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)) != 0) {
+ WARNING("write_prometheus: setsockopt(SO_REUSEADDR) failed: %s",
+ STRERRNO);
+ close(fd);
+ fd = -1;
+ continue;
+ }
+
if (bind(fd, ai->ai_addr, ai->ai_addrlen) != 0) {
close(fd);
fd = -1;
}
#elif defined(KERNEL_SOLARIS)
+
+#if HAVE_KSTAT_H
+#include <kstat.h>
+#endif
+
extern kstat_ctl_t *kc;
static long long get_zfs_value(kstat_t *ksp, char *name) {