Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions group_vars/galaxy_db_servers/vars.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---

galaxy_db_servers_group_templates:
- src: templates/telegraf/workflow_landing_requests.sh.j2
dest: "/usr/local/bin/workflow_landing_requests.sh"
owner: root
group: root
mode: '0755'
- src: templates/telegraf/tool_landing_requests.sh.j2
dest: "/usr/local/bin/tool_landing_requests.sh"
owner: root
group: root
mode: '0755'

# Always restart PostgreSQL on exit
galaxy_db_servers_group_systemd_overrides:
- name: "postgresql-{{ __postgresql_version_dotless }}"
Expand Down Expand Up @@ -169,6 +181,24 @@ galaxy_db_servers_group_telegraf_plugins_extra:
- interval = "1m"
- '[inputs.exec.tags]'
- ' influxdb_database = "{{ galaxy_instance_codename }}_sql"'
galaxy_workflow_landing_requests:
plugin: "exec"
config:
- commands = ["/usr/local/bin/workflow_landing_requests.sh"]
- timeout = "30s"
- data_format = "influx"
- interval = "5m"
- '[inputs.exec.tags]'
- ' influxdb_database = "{{ galaxy_instance_codename }}_sql"'
galaxy_tool_landing_requests:
plugin: "exec"
config:
- commands = ["/usr/local/bin/tool_landing_requests.sh"]
- timeout = "30s"
- data_format = "influx"
- interval = "5m"
- '[inputs.exec.tags]'
- ' influxdb_database = "{{ galaxy_instance_codename }}_sql"'
galaxy_disk_usage:
plugin: "exec"
config:
Expand Down
4 changes: 1 addition & 3 deletions inventory/tacc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,7 @@ all:
galaxy-main4.tacc.utexas.edu:
ansible_become: true
galaxy-db.tacc.utexas.edu:
# annoyingly, this overrides become on plays
#ansible_become: false
ansible_user: root
ansible_become: true
galaxy-vgp.tacc.utexas.edu:
#ansible_become: false
ansible_user: root
Expand Down
72 changes: 72 additions & 0 deletions templates/telegraf/tool_landing_requests.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
set -euo pipefail

# Query tool_landing_request table for metrics
# Output in InfluxDB line protocol format for Telegraf

PGDATABASE="galaxy_{{ galaxy_instance_codename }}"

# Total tool landing requests
total=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM tool_landing_request;")
echo "tool_landing_requests_total value=${total}i"

# Requests by day (last 30 days)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r day count; do
SELECT
DATE(create_time) as day,
COUNT(*) as count
FROM tool_landing_request
WHERE create_time >= NOW() - INTERVAL '30 days'
GROUP BY DATE(create_time)
ORDER BY day;
EOF
echo "tool_landing_requests_daily,day=${day} count=${count}i"
done

# Requests by tool_id (top 10)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r tool_id count; do
SELECT
COALESCE(tool_id, 'null') as tool_id,
COUNT(*) as count
FROM tool_landing_request
WHERE create_time >= NOW() - INTERVAL '7 days'
GROUP BY tool_id
ORDER BY count DESC
LIMIT 10;
EOF
tool_id_escaped=$(echo "$tool_id" | sed 's/[,= ]/\\&/g')
echo "tool_landing_requests_by_tool,tool_id=${tool_id_escaped} count=${count}i"
done

# Public vs Private requests (last 24 hours)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r visibility count; do
SELECT
CASE WHEN public THEN 'public' ELSE 'private' END as visibility,
COUNT(*) as count
FROM tool_landing_request
WHERE create_time >= NOW() - INTERVAL '24 hours'
GROUP BY public;
EOF
echo "tool_landing_requests_visibility,visibility=${visibility} count=${count}i"
done

# Requests with user vs anonymous (last 24 hours)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r user_type count; do
SELECT
CASE WHEN user_id IS NULL THEN 'anonymous' ELSE 'registered' END as user_type,
COUNT(*) as count
FROM tool_landing_request
WHERE create_time >= NOW() - INTERVAL '24 hours'
GROUP BY (user_id IS NULL);
EOF
echo "tool_landing_requests_user_type,user_type=${user_type} count=${count}i"
done

# Recent activity (last 1 hour, 24 hours, 7 days)
recent_1h=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM tool_landing_request WHERE create_time >= NOW() - INTERVAL '1 hour';")
recent_24h=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM tool_landing_request WHERE create_time >= NOW() - INTERVAL '24 hours';")
recent_7d=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM tool_landing_request WHERE create_time >= NOW() - INTERVAL '7 days';")

echo "tool_landing_requests_recent,period=1h value=${recent_1h}i"
echo "tool_landing_requests_recent,period=24h value=${recent_24h}i"
echo "tool_landing_requests_recent,period=7d value=${recent_7d}i"
72 changes: 72 additions & 0 deletions templates/telegraf/workflow_landing_requests.sh.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
set -euo pipefail

# Query workflow_landing_request table for metrics
# Output in InfluxDB line protocol format for Telegraf

PGDATABASE="galaxy_{{ galaxy_instance_codename }}"

# Total workflow landing requests
total=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM workflow_landing_request;")
echo "workflow_landing_requests_total value=${total}i"

# Requests by day (last 30 days)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r day count; do
SELECT
DATE(create_time) as day,
COUNT(*) as count
FROM workflow_landing_request
WHERE create_time >= NOW() - INTERVAL '30 days'
GROUP BY DATE(create_time)
ORDER BY day;
EOF
echo "workflow_landing_requests_daily,day=${day} count=${count}i"
done

# Requests by workflow_id (top 10)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r workflow_id count; do
SELECT
COALESCE(workflow_id::text, 'null') as workflow_id,
COUNT(*) as count
FROM workflow_landing_request
WHERE create_time >= NOW() - INTERVAL '7 days'
GROUP BY workflow_id
ORDER BY count DESC
LIMIT 10;
EOF
workflow_id_escaped=$(echo "$workflow_id" | sed 's/[,= ]/\\&/g')
echo "workflow_landing_requests_by_workflow,workflow_id=${workflow_id_escaped} count=${count}i"
done

# Public vs Private requests (last 24 hours)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r visibility count; do
SELECT
CASE WHEN public THEN 'public' ELSE 'private' END as visibility,
COUNT(*) as count
FROM workflow_landing_request
WHERE create_time >= NOW() - INTERVAL '24 hours'
GROUP BY public;
EOF
echo "workflow_landing_requests_visibility,visibility=${visibility} count=${count}i"
done

# Requests with user vs anonymous (last 24 hours)
psql -d "$PGDATABASE" -t -A -F',' <<EOF | while IFS=',' read -r user_type count; do
SELECT
CASE WHEN user_id IS NULL THEN 'anonymous' ELSE 'registered' END as user_type,
COUNT(*) as count
FROM workflow_landing_request
WHERE create_time >= NOW() - INTERVAL '24 hours'
GROUP BY (user_id IS NULL);
EOF
echo "workflow_landing_requests_user_type,user_type=${user_type} count=${count}i"
done

# Recent activity (last 1 hour, 24 hours, 7 days)
recent_1h=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM workflow_landing_request WHERE create_time >= NOW() - INTERVAL '1 hour';")
recent_24h=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM workflow_landing_request WHERE create_time >= NOW() - INTERVAL '24 hours';")
recent_7d=$(psql -d "$PGDATABASE" -t -A -c "SELECT COUNT(*) FROM workflow_landing_request WHERE create_time >= NOW() - INTERVAL '7 days';")

echo "workflow_landing_requests_recent,period=1h value=${recent_1h}i"
echo "workflow_landing_requests_recent,period=24h value=${recent_24h}i"
echo "workflow_landing_requests_recent,period=7d value=${recent_7d}i"