Re: [chrony-users] chrony-top

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


On Thu, May 27, 2021 at 11:39:48PM -0400, Marc Compere wrote:
> Can someone try this out and let me know if it works? It works on Ubuntu
> 20.04.2 quite well and reports something similar to the attached screenshot:
> [image: chrony_top_screenshot.png]
> 
> It must be run as sudo or root, so make sure you read the script before
> executing. It's simple and short. It makes a folder in /tmp to save output
> from `chronyc -nc clients`.

Interesting, thanks for posting.

I tried it on one of my servers which is logging 512k clients at the
same time and the script was a bit too heavy on the CPU. It takes a
long time to fetch all the clients and then sort them.

In recent chrony versions the clients command has the -r option to
reset the counters and the -p option to select clients that has at
least some number of accesses. Together, they can make an efficient
top-like utility, e.g.:

#!/bin/sh

#reset counters
chronyc -n clients -r -p -1 > /dev/null

while true; do
	sleep 1
	echo
	chronyc -c clients -r -p 1 | \
		awk -F , '{ printf "%40s\t%d\n", $1, $2 }' | \
		sort -n -r -k 2 | \
		head -n 20
done

The obvious drawback is that it's constantly resetting all the
counters, so there must be nothing else using them.

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "unsubscribe" in the subject.
For help email chrony-users-request@xxxxxxxxxxxxxxxxxxxx 
with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


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