Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save gerhard/4312f868445fb3242a6ba41873893f66 to your computer and use it in GitHub Desktop.
Save gerhard/4312f868445fb3242a6ba41873893f66 to your computer and use it in GitHub Desktop.
This will only work if they are aggregating logs to a central syslog server. Even though not ideal, Splunk will do.
# become root
sudo -i
# install script dependencies
apt-get install -y dstat jq
# in the background, run a shell process that will send system metrics to syslog every 30s
(dstat -clmdn --nocolor --tcp 30 | logger -t dstat) &
# in the background, run a shell process that will send ets table info to syslog every 30s
(while sleep 30; do curl -u USER:PASSWORD -s --connect-timeout 25 "127.0.0.1:15672/api/top/ets/rabbit%40STATSDB-NODE-NAME?row_count=10" | jq -c '.ets_tables[] | {owner: .owner_name, name: .name, memory: (.memory/(1024*1024))}'; done | logger -t ets-tables) &
# e.g. (while sleep 30; do curl -u admin:24jzhfJhVpBCt7o0Qalg -s --connect-timeout 25 "127.0.0.1:15672/api/top/ets/rabbit%404db64ea200a24c8d129f3ae600288a03?row_count=10" | jq -c '.ets_tables[] | {owner: .owner_name, name: .name, memory: (.memory/(1024*1024))}'; done | logger -t ets-tables) &
# stop being root
exit
# disconnect from bosh ssh
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment