Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Dec 2016 16:08:16 +0100
From:      Ed Schouten <ed@nuxi.nl>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Jonathan Anderson <jonathan@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>,  Allan Jude <allanjude@freebsd.org>
Subject:   Re: Sysctl as a Service, or: making sysctl(3) more friendly for monitoring systems
Message-ID:  <CABh_MK=jrpZCqgFmy-AB0VhVBp_cTDT468zsYe%2Btjmbub=PiMA@mail.gmail.com>
In-Reply-To: <CANCZdfrjsLdMoZ9Eg19-mEbyxUefJxUmeq=cT_bagrJqzWnUOg@mail.gmail.com>
References:  <CABh_MKk87hJTsu1ETX8Ffq9E8gqRPELeSEKzf1jKk_wwUROgAw@mail.gmail.com> <eea0aa41-2bbc-0ddc-d951-f495c5ba2341@freebsd.org> <200A5D70-24CE-4843-B99D-E10A2AF4F68F@FreeBSD.org> <CABh_MKkAoTj4wA9oTz-fK0rokgMfuiUWpLt6t=qRXy6vvCh7rg@mail.gmail.com> <CANCZdfrjsLdMoZ9Eg19-mEbyxUefJxUmeq=cT_bagrJqzWnUOg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Warner,

2016-12-13 1:57 GMT+01:00 Warner Losh <imp@bsdimp.com>:
> While we're here... there's one thing I'd love to see from  a
> hypothetical /dev/sysctl... When a sysctl value changes (or some
> subset), I'd like it to appear on a read-channel. That way, I could
> monitor temperature w/o needing to constantly poll for changes, for
> example.

Yes, that would be nice to have. Unfortunately, Prometheus is mostly
pull-based, so I guess such a feature wouldn't be needed in this case.

Anyway, I just finished implementing support for attaching labels to
sysctl nodes:

https://reviews.freebsd.org/D8775

This patch is slightly different from what I had envisioned. For
example, to translate this sysctl:

hw.acpi.thermal.tz1.temperature

to:

sysctl_hw_acpi_thermal_temperature_celcius{thermal_zone="tz1"}

my idea was to attach a "thermal_zone" label to the hw.acpi.thermal
node, indicating that the names of its children should be interpreted
a value for that label. Unfortunately, hw.acpi.thermal also has some
children that should not have that label attached:

hw.acpi.thermal.user_override
hw.acpi.thermal.polling_rate
hw.acpi.thermal.min_runtime

That's why I went for an approach where the label is attached to
hw.acpi.thermal.tz1, so that labelling can be controlled more
granularly.

Note that this change does not affect existing use of sysctl at all.
It's merely the case that they now have additional metadata that is
only used by the Prometheus exporter.

-- 
Ed Schouten <ed@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MK=jrpZCqgFmy-AB0VhVBp_cTDT468zsYe%2Btjmbub=PiMA>