History log of /freebsd-current/usr.sbin/prometheus_sysctl_exporter/prometheus_sysctl_exporter.c
Revision Date Author Comments
# 4d65a7c6 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# b9600db4 26-Apr-2023 Peter Jeremy <peterj@FreeBSD.org>

prometheus_sysctl_exporter: Replace magic numbers with identifiers.

Identifiers make it clearer what is going on and makes it easier to
find consumers of sysctl functionality.

No functional change.

MFC after: 3 days
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D39797


# 982f980b 21-Jun-2022 Alan Somers <asomers@FreeBSD.org>

prometheus_sysctl_exporter: ignore ENOENT for mibs specified on the CLI

They might belong to kernel modules not currently loaded, or to other
kernel versions. Ignoring them allows the configuration to be shared
between multiple hosts.

MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: rew
Differential Revision: https://reviews.freebsd.org/D35540


# 8c47d8f5 18-Apr-2022 Alan Somers <asomers@FreeBSD.org>

prometheus_sysctl_exporter: fix metric aliasing

When exporting sysctls to Prometheus, the exporter replaces "." with
"_". This caused several metrics to alias, confusing the Prometheus
server. Fix it by:

* Renaming the "tcp_log_bucket" UMA zone to "tcp_log_id_bucket". Also,
rename "tcp_log_node" to "tcp_log_id_node" for consistency.

* Not exporting sysctls with "(LEGACY)" in the description. That is
used by ZFS sysctls that have been replaced by others, many of which
alias to the same Prometheus metric name (like "vfs.zfs.arc_max" and
"vfs.zfs.arc.max").

PR: 259607
Reported by: delphij
MFC after: 2 weeks
Sponsored by: Axcient
Reviewed by: delphij,rew,thj
Differential Revision: https://reviews.freebsd.org/D34952


# 9097ac9a 06-Oct-2021 Elyes HAOUAS <ehaouas@noos.fr>

Fix typo on "Celsius"

"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files


# 8ff2b522 07-Oct-2021 Robert Wing <rew@FreeBSD.org>

prometheus_sysctl_exporter(8): filter output using a regex

Add two options, -i and -e, for filtering prometheus metrics.

Each option takes a regular expression as an argument. The provided
regex will be tested against the prometheus metric name.

The -i option includes metrics matching the given regex.
The -e option excludes metrics matching the given regex.

Sponsored by: Modirum MDPay
Sponsored by: Klara Inc.
Reviewed by: 0mp, debdrup
Differential Revision: https://reviews.freebsd.org/D32269


# 4f6a15dd 29-Jul-2017 Ed Schouten <ed@FreeBSD.org>

Be a bit more liberal about sysctl naming.

On the systems on which I tested this exporter, I never ran into metrics
that were named in such a way that they couldn't be exported to
Prometheus metrics directly. Now it turns out that on systems with NUMA,
the sysctl tree contains metrics named dev.${driver}.${index}.%domain.
For these metrics, the % in the name is problematic, as Prometheus
doesn't allow this symbol to be used.

Remove the assertions that were originally put in place to prevent the
exporter from generating malformed output and add code to deal with it
accordingly. For metric names, convert any unsupported character to an
underscore. For label values, perform string escaping.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221035
Reported by: lifanov@


# de44cbc2 21-Dec-2016 Ed Schouten <ed@FreeBSD.org>

Add a Prometheus exporter for sysctl values.

Now that we have our sysctl tree annotated with aggregation labels,
let's go ahead and provide a very simple utility for exporting the
sysctl tree in Prometheus' format. It can either be used in conjunction
with the Prometheus node exporter or run through inetd(8).

The reason why I'm opting for having it in the base system is because it
has a pretty strong integration with some of sysctl's innards, such as
access to iterators, name lookups, metadata and type information. As I
am investigating whether we can add histograms as native types to sysctl
as well, this integration will only get stronger as we go along. That's
why it would be safer to oversee the development of this exporter
ourselves, as opposed to having it as an external project.

This exporter is remarkably compact, especially when compared to the
official Linux binary of the Prometheus node exporter (16 KB vs 12 MB).
I guess this could be an interesting aspect for monitoring embedded
FreeBSD-based systems.

Differential Revision: https://reviews.freebsd.org/D8792