]> xenbits.xensource.com Git - people/royger/freebsd.git/commit
Add support for attaching aggregation labels to sysctl objects.
authored <ed@FreeBSD.org>
Wed, 14 Dec 2016 12:47:34 +0000 (12:47 +0000)
committered <ed@FreeBSD.org>
Wed, 14 Dec 2016 12:47:34 +0000 (12:47 +0000)
commit2e5ad04e96dbde1fac8adbe3625a13537492f7e4
treeff8995416e511bb87a175d00a58f25aee7984016
parent64b6cb0328267353e70cf786fa36de505155ea96
Add support for attaching aggregation labels to sysctl objects.

I'm currently working on writing a metrics exporter for the Prometheus
monitoring system to provide access to sysctl metrics. Prometheus and
sysctl have some structural differences:

- sysctl is a tree of string component names.
- Prometheus uses a flat namespace for its metrics, but allows you to
  attach labels with values to them, so that you can do aggregation.

An initial version of my exporter simply translated

    hw.acpi.thermal.tz1.temperature

to

    sysctl_hw_acpi_thermal_tz1_temperature_celcius

while we should ideally have

    sysctl_hw_acpi_thermal_temperature_celcius{thermal_zone="tz1"}

allowing you to graph all thermal zones on a system in one go.

The change presented in this commit adds support for accomplishing this,
by providing the ability to attach labels to nodes. In the example I
gave above, the label "thermal_zone" would be attached to "tz1". As this
is a feature that will only be used very rarely, I decided to not change
the KPI too aggressively.

Discussed on: hackers@
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D8775
share/man/man9/Makefile
share/man/man9/sysctl.9
share/man/man9/sysctl_add_oid.9
sys/kern/kern_sysctl.c
sys/sys/sysctl.h