From 5f5514c385613270ea97949a7519ffa64b9e0564 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Wed, 27 Mar 2024 11:44:42 +0100 Subject: [PATCH] whitespace --- parts/24-gunicorn.sh | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/parts/24-gunicorn.sh b/parts/24-gunicorn.sh index 003aa1d..3924c24 100644 --- a/parts/24-gunicorn.sh +++ b/parts/24-gunicorn.sh @@ -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() { @@ -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 @@ -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 -} - +} \ No newline at end of file