Add stats about MAM data: row count and total data size
This commit is contained in:
parent
27ed344758
commit
1b65fc9bdd
@ -27,6 +27,8 @@ ejabberdctl_stats() {
|
||||
|
||||
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 "PUTVAL \"${HOSTNAME}/xmpp_total_mam_rows/count\" interval=$INTERVAL $(date +%s):$(_count_mam_rows)"
|
||||
echo "PUTVAL \"${HOSTNAME}/xmpp_total_mam_size/count\" interval=$INTERVAL $(date +%s):$(_estimate_mam_size)"
|
||||
echo -n "PUTVAL \"${HOSTNAME}/xmpp_public_rooms_occupants/count\" interval=$INTERVAL $(date +%s):" ; _xmpp_public_rooms_total_occupants
|
||||
}
|
||||
|
||||
@ -58,6 +60,18 @@ _count_accounts_created_lasthour() {
|
||||
"
|
||||
}
|
||||
|
||||
_count_mam_rows() {
|
||||
_sql_ejabberd "SELECT reltuples::bigint AS estimate FROM pg_class WHERE relname = 'archive'"
|
||||
}
|
||||
|
||||
_estimate_mam_size() {
|
||||
_sql_ejabberd "
|
||||
select pg_relation_size(relid) as mam_size
|
||||
from pg_catalog.pg_statio_user_tables
|
||||
where relname = 'archive'
|
||||
"
|
||||
}
|
||||
|
||||
_xmpp_public_rooms_total_occupants() {
|
||||
# keep results in a cache file for 5 minutes
|
||||
local cache_file=/var/tmp/cache_collectd_xmpp_rooms.data
|
||||
|
Loading…
Reference in New Issue
Block a user