Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
mira-miracoli committed Mar 27, 2024
1 parent 66dc813 commit 5f5514c
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions parts/24-gunicorn.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
registered_subcommands="$registered_subcommands gunicorn"
_gunicorn_short_help="Gunicorn WSGI statistics"
registered_subcommands="$registered_subcommands gunicorn"
_gunicorn_short_help="Gunicorn WSGI statistics"
_gunicorn_long_help="
Various commands that contain the gunicorn service, such as active users... Please help to extend
Various commands that contain the gunicorn service, such as active users... Please help to extend
"

gunicorn_active-users() { ## : Shows active users in last 10 minutes
handle_help "$@" <<-EOF
See unique sorts IP adresses from 'GET /history/current_history_json' from last 10 minutes and prints it in influx line format
gunicorn_active-users() { ## : Shows active users in last 10 minutes
handle_help "$@" <<-EOF
See unique sorts IP adresses from 'GET /history/current_history_json' from last 10 minutes and prints it in influx line format
EOF

echo "active_users,timespan=last_10_min users=$(journalctl -u galaxy-gunicorn@*.service --since '10 minutes ago' | \
grep '/history/current_history_json' | awk '{print $11}' | sort -u | wc -l)"
echo "active_users,timespan=last_10_min users=$(journalctl -u galaxy-gunicorn@*.service --since '10 minutes ago' | \
grep '/history/current_history_json' | awk '{print $11}' | sort -u | wc -l)"
}

gunicorn_handler-restart() {
Expand Down Expand Up @@ -53,9 +53,9 @@ gunicorn_handler-restart() {
fi
}

gunicorn_lastlog(){ ## : Fetch the number of seconds since the last log message was written
handle_help "$@" <<-EOF
Lets you know if any of your workers or handlers have maybe stopped processing jobs.
gunicorn_lastlog(){ ## : Fetch the number of seconds since the last log message was written
handle_help "$@" <<-EOF
Lets you know if any of your workers or handlers have maybe stopped processing jobs.
$ gxadmin gunicorn lastlog
journalctl.lastlog,service=galaxy-gunicorn@0 seconds=0
Expand All @@ -66,14 +66,13 @@ gunicorn_lastlog(){ ## : Fetch the number of seconds since the last log message

NOW=$(date +%s)

for i in {0..10}; do
lines=$(journalctl -u galaxy-gunicorn@$i -n 1 --no-pager)
if [[ ! $lines == *"No entries"* ]]; then
timestamp=$(journalctl -u galaxy-handler@$i -n 1 --no-pager | grep -v 'Logs begin' | awk '{print $1" "$2" "$3}');
unix=$(date -d "$timestamp" +%s)
for i in {0..10}; do
lines=$(journalctl -u galaxy-gunicorn@$i -n 1 --no-pager)
if [[ ! $lines == *"No entries"* ]]; then
timestamp=$(journalctl -u galaxy-handler@$i -n 1 --no-pager | grep -v 'Logs begin' | awk '{print $1" "$2" "$3}');
unix=$(date -d "$timestamp" +%s)
date_diff=$((NOW - unix));
echo "journalctl.lastlog,service=galaxy-handler@$i seconds=$date_diff";
fi
done
}

}

0 comments on commit 5f5514c

Please sign in to comment.