Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Created December 18, 2020 18:39
Show Gist options
  • Save peterjaap/bc71c2bbf23890fc67a7f667d49c16fb to your computer and use it in GitHub Desktop.
Save peterjaap/bc71c2bbf23890fc67a7f667d49c16fb to your computer and use it in GitHub Desktop.
Hypernode incident quick analysis

Quick analysis script to check an incident.

Script

#!/bin/bash
echo "Quick analysis incident $1"
echo "\nTCP connections from specific IPs"
cat $1/*tcp-connections.txt | grep -v 127.0.0.1 | awk '{print $5}'  | cut -d ':' -f1 | sort | uniq -c | sort -n | tail -n 20
echo "\nCPU-intensive processes:"
sort -nk4 $1/*process-list.txt | tail -n3
echo "\nMySQL queries:"
cat $1/*mysql-process-list.txt | grep Query  | grep -v processlist
echo "\nFPM status:"
sort -nk3 $1/*fpm-status.txt | tail -n5

Usage

Place in ~ and run like this;

sh quickAnalysis.sh incidents/2020-12-18T17\:02\:11+00\:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment