From b64b741b288c85ab3da46ca0ba339756b88a2496 Mon Sep 17 00:00:00 2001 From: pitchum Date: Tue, 16 Mar 2021 08:41:16 +0100 Subject: [PATCH] Add a POC for XMPP clients stats --- metrology/collectd_exec_xmpp.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/metrology/collectd_exec_xmpp.sh b/metrology/collectd_exec_xmpp.sh index 0b3ebb1..0e830a1 100755 --- a/metrology/collectd_exec_xmpp.sh +++ b/metrology/collectd_exec_xmpp.sh @@ -11,6 +11,7 @@ main() { while ejabberdctl_stats http_upload_disk_usage + #client_stats # XXX pas encore activée sleep "$INTERVAL" do true; done } @@ -32,4 +33,15 @@ http_upload_disk_usage() { echo "PUTVAL \"${HOSTNAME}/xmpp_upload_data_avg/count\" interval=$INTERVAL $(date +%s):${avg}" } +client_stats(){ + return 0 + # Fonction pas encore activée car je n'aime pas l'idée de créer dans influxdb autant de noms de métriques que de clients XMPP. + # Il faut encore étudier le format d'envoi de collectd. + while read -r line ; do + clientname=$(echo ${line} | awk '{print $2}') + count=$(echo ${line} | awk '{print $1}') + echo "PUTVAL \"${HOSTNAME}/xmpp_client_${clientname}/count\" interval=$INTERVAL $(date +%s):${count}" + done < <(ejabberdctl connected_users | sed -r 's;^.*@chapril.org/([^. -]+).*;\1;' | sort | uniq -c | sort -n) +} + main