Created
July 11, 2018 13:39
-
-
Save mdelillo/4cfc5ba66ae8c3fdda23abb630f8dd97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
credhub_pid=$(cat /var/vcap/sys/run/credhub/pid) | |
uaa_pid=$(cat /var/vcap/data/sys/run/uaa/uaa.pid) | |
lsof_output="$(lsof)" | |
total_open_files=$(echo "$lsof_output" | wc -l) | |
credhub_open_files=$(echo "$lsof_output" | grep "java *$credhub_pid" | wc -l) | |
uaa_open_files=$(echo "$lsof_output" | grep "java *$uaa_pid" | wc -l) | |
credhub_connections=$(echo "$lsof_output" | grep "java *$credhub_pid" | grep ESTABLISHED | wc -l) | |
uaa_connections=$(echo "$lsof_output" | grep "java *$uaa_pid" | grep ESTABLISHED | wc -l) | |
credhub_web_connections=$(echo "$lsof_output" | grep "java *$credhub_pid" | grep ESTABLISHED | grep ":8844->" | grep ".bc.googleusercontent.com" | wc -l) | |
credhub_postgres_connections=$(echo "$lsof_output" | grep "java *$credhub_pid" | grep ESTABLISHED | grep ":postgresql" | wc -l) | |
uaa_postgres_connections=$(echo "$lsof_output" | grep "java *$uaa_pid" | grep ESTABLISHED | grep ":postgresql" | wc -l) | |
echo "Total open files: $total_open_files | |
Credhub open files: $credhub_open_files | |
Credhub connections: $credhub_connections | |
***Credhub <-> Web: $credhub_web_connections*** | |
Credhub <-> Postgres: $credhub_postgres_connections | |
UAA open files: $uaa_open_files | |
UAA connections: $uaa_connections | |
UAA <-> Postgres: $uaa_postgres_connections |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment