15
2
Fork 0

Compare commits

...

3 Commits

Author SHA1 Message Date
pitchum a5e45d737e Update nodeinfo2: Fix the way "active users count" is computed 2 years ago
pitchum 5609860818 Housekeeping: create a explicit folder name for experiments. 2 years ago
pitchum d39a247454 Improve script rapport_activites.sh 2 years ago
  1. 10
      nodeinfo2/update_nodeinfo
  2. 5
      rapport_activite/rapport_activites.sh

10
nodeinfo2/update_nodeinfo

@ -1,7 +1,7 @@
#! /bin/bash
TEMPLATE=/srv/xmpp.chapril.org/tools/nodeinfo2/template-x-nodeinfo2.json
TARGET_FILE=/srv/x-nodeinfo2.json
TARGET_FILE=/srv/xmpp.chapril.org/experimental/x-nodeinfo2.json
main() {
cat "${TEMPLATE}" \
@ -45,11 +45,9 @@ per_account_storage_usage() {
user_activity() {
days_back=${1:-30}
sql="select count(distinct username)
from archive
where peer not like 'irc%'
and kind = 'chat'
and created_at > current_timestamp - interval '${days_back} days'
sql="select count(distinct l.username)
from last l
where to_timestamp(cast(l.seconds as int)) > current_timestamp - interval '${days_back} days'
and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')"
psql -U ejabberd -h localhost ejabberd -c "${sql}" -t | grep -v '^$' | awk '{print $1}'

5
rapport_activite/rapport_activites.sh

@ -1,5 +1,7 @@
#! /bin/bash
STORAGE_DIR="/var/www/xmpp.chapril.org/upload/"
main() {
echo "h2. ## Global info"
echo ""
@ -11,7 +13,7 @@ main() {
echo "h2. ## HTTP upload storage:"
echo ""
echo "* User quota: $(get_hard_quota)M"
echo "* Total disk usage: $(du -sh /srv/ejabberd/chapril.org/upload/ | awk '{print $1}')"
echo "* Total disk usage: $(du -sh ${STORAGE_DIR} | awk '{print $1}')"
per_account_storage_usage
# echo "s2s outgoing connections: $(sudo -u ejabberd ejabberdctl incoming_s2s_number)"
# echo "s2s incoming connections: $(sudo -u ejabberd ejabberdctl outgoing_s2s_number)"
@ -22,7 +24,6 @@ get_hard_quota() {
}
per_account_storage_usage() {
STORAGE_DIR="/srv/ejabberd/chapril.org/upload/"
# TODO Directories to ignore because they are used for tests accounts (bart and lisa simpsons)
IGNORE_DIRS="35eae3ddc83d72e4d3fad3160a400db688d7d936 9be859c77649f33d207cbe0d74a126b2fd31cb33"

Loading…
Cancel
Save