Skip to content

Instantly share code, notes, and snippets.

View gpeal's full-sized avatar

Gabriel Peal gpeal

View GitHub Profile
@gpeal
gpeal / s1-metrics-collector.sh
Created March 9, 2023 22:41
SentinelOne metrics collector
sentinelctl metrics enable ; sentinelctl metrics dump > /tmp/metrics.json ; count=0 ; while :; do clear; sentinelctl metrics dump > /tmp/metrics-tmp.log ; if grep -q "no metrics available" /tmp/metrics-tmp.log; then echo "Metrics Disabled" ; exit ; fi ; if [ $count = 0 ]; then echo "Starting Metrics Collection" ; count=$((count + 10)) ; else echo "Metrics have been collected for $count seconds" ; count=$((count + 10)) ; fi ; sleep 3 ; diff -u /tmp/metrics.json /tmp/metrics-tmp.log > /tmp/metrics-new.patch ; patch /tmp/metrics.json /tmp/metrics-new.patch ; sleep 3 ; echo "Collecting Metrics & writing to /tmp/metrics.json" ; sleep 4 ; done