Compare commits

...

3 Commits

Author SHA1 Message Date
root
dd3a70f548 New metrics for XMPP IRC Bridge (Biboumi) 2021-02-08 20:31:02 +01:00
Adrien Bourmault
3e3c2753aa Better max for relayed data 2021-02-01 12:25:32 +01:00
Adrien Bourmault
d4d966ab19 Corrected a dumb error with date calculation 2021-02-01 12:05:11 +01:00
3 changed files with 76 additions and 10 deletions

View File

@ -70,9 +70,9 @@ INTRUS()
R=$(($R % 100)) R=$(($R % 100))
if [[ $R -lt 50 ]]; then if [[ $R -lt 50 ]]; then
echo "Tapez | $NEWINPUT |en supprimant les ${DIGIT[$INTRUS]}" echo "Tapez ce nombre en enlevant les ${DIGIT[$INTRUS]} | $NEWINPUT"
else else
echo "Saisissez | $NEWINPUT |en enlevant les ${DIGIT[$INTRUS]}" echo "Saisissez ce nombre sans les ${DIGIT[$INTRUS]} | $NEWINPUT"
fi fi
} }

View File

@ -70,9 +70,9 @@ INTRUS()
R=$(($R % 100)) R=$(($R % 100))
if [[ $R -lt 50 ]]; then if [[ $R -lt 50 ]]; then
echo "Tapez | $NEWINPUT |en supprimant les ${DIGIT[$INTRUS]}" echo "Tapez ce nombre en enlevant les ${DIGIT[$INTRUS]} | $NEWINPUT"
else else
echo "Saisissez | $NEWINPUT |en enlevant les ${DIGIT[$INTRUS]}" echo "Saisissez ce nombre sans les ${DIGIT[$INTRUS]} | $NEWINPUT"
fi fi
} }

View File

@ -26,11 +26,20 @@ main() {
echo "" echo ""
echo "h2. ## Audio/Video Call usage:" echo "h2. ## Audio/Video Call usage:"
echo "" echo ""
echo "* Number of calls relayed: $(zgrep $DATE /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)" echo "* Number of calls relayed: $(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Offering stun" | wc -l)"
echo "* Data relayed per protocol per call:" echo "* Data relayed per protocol per call:"
echo "** UDP: avg $(get_avg_UDP_turn_relayed_data) KiB, max $(get_max_UDP_turn_relayed_data) KiB, total $(get_total_UDP_turn_relayed_data) KiB" echo "** UDP: avg $(get_avg_UDP_turn_relayed_data) KiB, max $(get_max_UDP_turn_relayed_data) KiB, total $(get_total_UDP_turn_relayed_data) KiB"
echo "** TCP: avg $(get_avg_TCP_turn_relayed_data) KiB, max $(get_max_TCP_turn_relayed_data) KiB, total $(get_total_TCP_turn_relayed_data) KiB" echo "** TCP: avg $(get_avg_TCP_turn_relayed_data) KiB, max $(get_max_TCP_turn_relayed_data) KiB, total $(get_total_TCP_turn_relayed_data) KiB"
echo "** TLS: avg $(get_avg_TLS_turn_relayed_data) KiB, max $(get_max_TLS_turn_relayed_data) KiB, total $(get_total_TLS_turn_relayed_data) KiB" echo "** TLS: avg $(get_avg_TLS_turn_relayed_data) KiB, max $(get_max_TLS_turn_relayed_data) KiB, total $(get_total_TLS_turn_relayed_data) KiB"
echo ""
echo "h2. ## XMPP/IRC Bridge (Biboumi) usage:"
echo ""
echo "* Total users: $(count_biboumi_users)"
echo "** Active: $(count_biboumi_active_users '1 MONTH')"
echo "** Inactive: $(count_biboumi_inactive_users '1 MONTH')"
echo "* Total messages stored (MAM): $(count_biboumi_archived_messages)"
echo "* Total channels active: $(count_biboumi_active_chan)"
echo "** through $(count_biboumi_active_servers) IRC server(s)"
} }
get_hard_quota() { get_hard_quota() {
@ -90,7 +99,64 @@ count_removable_accounts() {
} }
count_archived_messages() { count_archived_messages() {
psql -U ejabberd -h localhost ejabberd -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}' sudo -Hiu postgres psql biboumi -c "select count(*) from archive where peer not like 'irc%' and username not in ('r.giskard', 'lisa.simpson', 'bart.simpson')" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_users() {
# Accounts inactive *and* who never read the welcome message.
sql="select count(distinct owner_)
from muclogline_"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_active_users() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct owner_)
from muclogline_
where to_timestamp(date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_inactive_users() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct owner_)
from muclogline_
where to_timestamp(date_) < current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_archived_messages() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct body_)
from muclogline_"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_active_servers() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct ircservername_)
from muclogline_
where to_timestamp(date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
}
count_biboumi_active_chan() {
# Accounts inactive *and* who never read the welcome message.
since=${1:-'1 MONTH'}
sql="select count(distinct ircchanname_)
from muclogline_
where to_timestamp(date_) > current_timestamp - interval '${since}'"
sudo -Hiu postgres psql biboumi -c "${sql}" -t | grep -v '^$' | awk '{print $1}'
} }
get_last_month() { get_last_month() {
@ -107,7 +173,7 @@ get_last_month() {
year="$(($(date +%Y)-1))" year="$(($(date +%Y)-1))"
yearMonth="$year-$precedingMonth" yearMonth="$year-$precedingMonth"
fi fi
echo "$year-$precedingMonth" echo $yearMonth
} }
get_total_UDP_turn_relayed_data() { get_total_UDP_turn_relayed_data() {
@ -138,7 +204,7 @@ get_total_TLS_turn_relayed_data() {
} }
get_max_UDP_turn_relayed_data() { get_max_UDP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | sort | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "UDP" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then if [ -z $n ]; then
echo 0 echo 0
else else
@ -147,7 +213,7 @@ get_max_UDP_turn_relayed_data() {
} }
get_max_TCP_turn_relayed_data() { get_max_TCP_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | sort | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TCP" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then if [ -z $n ]; then
echo 0 echo 0
else else
@ -156,7 +222,7 @@ get_max_TCP_turn_relayed_data() {
} }
get_max_TLS_turn_relayed_data() { get_max_TLS_turn_relayed_data() {
n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | sort | tail -n 1) n=$(zgrep "$DATE" /var/log/ejabberd/ejabberd.log* | grep -i -e "Relayed" | grep "TLS" | cut -d" " -f6-6 | sort -g | tail -n 1)
if [ -z $n ]; then if [ -z $n ]; then
echo 0 echo 0
else else