Re: [chrony-users] chrony-top |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-users Archives
]
- To: chrony-users@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-users] chrony-top
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Mon, 31 May 2021 09:36:14 +0200
- Authentication-results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mlichvar@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622446580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/qNheaHO0ciCbMG+uGy77O8daNPAl3GE+VJFd2nXtpc=; b=OucMsgSKD6xsPS4wgHJli9mOKdaM/2aYbYUtdExM/YgX+cukiRVqPXi8ETPdUaGiBSWKNB sfsimRyfbDTyzJJGEAA9ttTNlVS76TKVGDRSXw7ndBGZPDDXvLGWlNfGmHUXZZdKZgUsU+ dEc6WzJ2t0cYrBC11Sm9znFQYTZJkGQ=
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.