Metrology: increase frequency of accounts and captchas measures

This commit is contained in:
pitchum 2021-04-18 12:35:05 +02:00 committed by root
parent 098fc2e302
commit 41855188a9

View File

@ -25,7 +25,8 @@ ejabberdctl_stats() {
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)"
echo "PUTVAL \"${HOSTNAME}/xmpp_accounts_created_lastday/count\" interval=$INTERVAL $(date +%s):$(count_accounts_created_lastday)"
echo "PUTVAL \"${HOSTNAME}/xmpp_accounts_created_lastday/count\" interval=$INTERVAL $(date +%s):$(_count_accounts_created_lastday)"
echo "PUTVAL \"${HOSTNAME}/xmpp_accounts_created_lasthour/count\" interval=$INTERVAL $(date +%s):$(_count_accounts_created_lasthour)"
echo -n "PUTVAL \"${HOSTNAME}/xmpp_public_rooms_occupants/count\" interval=$INTERVAL $(date +%s):" ; _xmpp_public_rooms_total_occupants
}
@ -39,15 +40,23 @@ http_upload_disk_usage() {
captcha_stats() {
echo "PUTVAL \"${HOSTNAME}/xmpp_captcha_lastday/count\" interval=$INTERVAL $(date +%s):$(find /var/lib/ejabberd/chapril_captchas/ -mindepth 1 -maxdepth 1 -type f -mtime -1 | grep -v EXPERIMENTAL | wc -l)"
echo "PUTVAL \"${HOSTNAME}/xmpp_captcha_lasthour/count\" interval=$INTERVAL $(date +%s):$(find /var/lib/ejabberd/chapril_captchas/ -mindepth 1 -maxdepth 1 -type f -mmin -60 | grep -v EXPERIMENTAL | wc -l)"
}
count_accounts_created_lastday() {
_count_accounts_created_lastday() {
_sql_ejabberd "
select count(*)
from users
where created_at > current_timestamp - interval '1 day'
"
}
_count_accounts_created_lasthour() {
_sql_ejabberd "
select count(*)
from users
where created_at > current_timestamp - interval '1 hour'
"
}
_xmpp_public_rooms_total_occupants() {
# keep results in a cache file for 5 minutes