Re: [chrony-users] Monitoring chrony, Prometheus-friendly metrics

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-users Archives ]


On 4/10/20 12:08 AM, Watson Ladd wrote:
On Wed, Apr 8, 2020 at 3:23 PM Watson Ladd <watson@xxxxxxxxxxxxxx> wrote:

On Wed, Apr 8, 2020 at 5:58 AM Luca BRUNO <lucab@xxxxxxxxxxxxx> wrote:

Hi all,
I'm following up from this old thread from 2016 regarding monitoring
chrony [0], and from this more recent discussion in Prometheus land [1].

[0] https://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-users/2016/02/msg00003.html
[1] https://github.com/prometheus/node_exporter/issues/1666

I've got a python script lying around for exactly this. Let me get the
approvals sorted out to submit it/send it to you.

Here is the script. Same licensing terms as Chrony itself. I'll submit
a patch to put it in the contrib section shortly.

Note that we have a framework to turn a tool like this into part of
the scrape, so maybe a standalone monitor suits you a bit better.

And for the cherry on top here's a patch to make it compatible with
python3. Bytes vs. Strings and all that.

enjoy,
Hoplger
--- chrony_metrics.py~	2020-04-10 10:12:04.000000000 +0200
+++ chrony_metrics.py	2020-04-10 10:15:48.932272177 +0200
@@ -44,7 +44,7 @@ def get_cmdoutput(command):
     if return_code:
         raise RuntimeError('Call to "{}" returned error: \
     {}'.format(command, return_code))
-    return out
+    return out.decode("utf-8")
 
 
 def printPrometheusformat(metric, values):


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/