I'm currently debugging an issue where I see a large number of threads in my application hanging on to a database connection even though they are asleep, often the threads sleep for a significant length of time (10-300s) (they're sensor reading/normality checking threads; that's not important)
I wanted to know if there's a decent way to graph something like:
watch "echo select count(*) from pg_stat_activity where procpid <> pg_backend_pid(); | psql"
and have it shown in the CLI or as an image that I can simply open, or write the image at the end of the run?
Surely there's a unix tool for histograms over time using the CLI to draw it (curses)?