From 3b500d7d31f99346a5debac85429e7c8a5b8c509 Mon Sep 17 00:00:00 2001 From: pitchum Date: Sun, 14 Mar 2021 15:16:39 +0100 Subject: [PATCH] Add a metrology script for collectd's Exec plugin --- metrology/collectd_exec_xmpp.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 metrology/collectd_exec_xmpp.sh diff --git a/metrology/collectd_exec_xmpp.sh b/metrology/collectd_exec_xmpp.sh new file mode 100755 index 0000000..a91523a --- /dev/null +++ b/metrology/collectd_exec_xmpp.sh @@ -0,0 +1,14 @@ +HOSTNAME="${COLLECTD_HOSTNAME:-localhost}" +INTERVAL="${COLLECTD_INTERVAL:-60}" + +# required by some ejabberdctl commands +export HOME=/var/lib/ejabberd + +while sleep "$INTERVAL"; do + echo "PUTVAL \"${HOSTNAME}/xmpp_registered_users/count\" interval=$INTERVAL $(date +%s):$(ejabberdctl registered_users chapril.org | wc -l)" + echo "PUTVAL \"${HOSTNAME}/xmpp_active_users/count\" interval=$INTERVAL $(date +%s):$(ejabberdctl connected_users_number)" + echo "PUTVAL \"${HOSTNAME}/xmpp_s2s_in/count\" interval=$INTERVAL $(date +%s):$(ejabberdctl incoming_s2s_number)" + echo "PUTVAL \"${HOSTNAME}/xmpp_s2s_out/count\" interval=$INTERVAL $(date +%s):$(ejabberdctl outgoing_s2s_number)" + echo "PUTVAL \"${HOSTNAME}/xmpp_muc_total/count\" interval=$INTERVAL $(date +%s):$(ejabberdctl muc_online_rooms muc.chapril.org | wc -l)" +done +