From owner-freebsd-hackers@freebsd.org Tue Dec 13 15:08:47 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D13ECC7575D for ; Tue, 13 Dec 2016 15:08:47 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-yb0-x22b.google.com (mail-yb0-x22b.google.com [IPv6:2607:f8b0:4002:c09::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88C9D254 for ; Tue, 13 Dec 2016 15:08:47 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by mail-yb0-x22b.google.com with SMTP id v78so16563260ybe.3 for ; Tue, 13 Dec 2016 07:08:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuxi-nl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=n7tt7KZiTMC1Kh6VmsNQaAVeMD8L+4ZZiuUACuPQzDE=; b=icMa628J+X32+mTyXtUNCEERB3dTc92q5+JBSF64EZgqQhpFVZCgZpWgsgvhZm8+MQ Aym7vdj4+xd3HNQcg/f/QMqiA4p42v5ayvM4SaT6Es8KeuH9djmQzkypw6D9BL7uvupu Agb0XyseH0oxGqTTvuNhDM701GRbH5SeXpV+h4b0V8xEf2PbJLJT6ci8jScGwOIpvPQ0 /O8qoybCZR96FoBSyMLbm4fC07lAgnjlyBTCPQ21QULl+RiQykpOW+3Gxm3jkULDGDkh a7z6d5p6dHNWviPFTe15waARC9kVD2bUM3JdDOb+Vi2XQfV2oQt/aX2DNkYpDVhMHtUy Sl+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=n7tt7KZiTMC1Kh6VmsNQaAVeMD8L+4ZZiuUACuPQzDE=; b=Op01YDjy/v+qCLSW+O2xkffOb7nMPoBCLalZ8CoEb4bORujy8wy4cSCNjxfcJ0mePu YpfUaYtU8PNwNSBKjsc58CuWNHaTi7KZl1E2wv9e8WcWejbzcb0HcFQs6EiL/rmYCAMD UKJKRvl7ZWrUMGHhtRrTVKi4pFOaWGNQ7opp3m0owQVefe0CUyKl5xCkNO8X/hikkufd hzqlHRb/smmggDqujpdele9LIJnshSiPIno0Zt93dH3daSI/8QoNxOzfXlaP3FWw/UpU yHkiHgrZpbHjYdR4E7J0Mehi1KgKeCnjSdmVjBg89Yxzojy24Jfx43QCI64a+1yR4+qa f2KA== X-Gm-Message-State: AKaTC03DxDiUNJ2hLAcs57I9v15ChYd6e084jNWHWeD6F8ZfdSBTqzA5bC+h1oLtxjG0snhQvTpOuQEjFVzICg== X-Received: by 10.37.27.215 with SMTP id b206mr4921402ybb.24.1481641726491; Tue, 13 Dec 2016 07:08:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.0.212 with HTTP; Tue, 13 Dec 2016 07:08:16 -0800 (PST) In-Reply-To: References: <200A5D70-24CE-4843-B99D-E10A2AF4F68F@FreeBSD.org> From: Ed Schouten Date: Tue, 13 Dec 2016 16:08:16 +0100 Message-ID: Subject: Re: Sysctl as a Service, or: making sysctl(3) more friendly for monitoring systems To: Warner Losh Cc: Jonathan Anderson , FreeBSD Hackers , Allan Jude Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Dec 2016 15:08:47 -0000 Hi Warner, 2016-12-13 1:57 GMT+01:00 Warner Losh : > 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 Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717