Created
March 9, 2023 22:41
-
-
Save gpeal/418d88cd7c9f7e934fd5276989e860a8 to your computer and use it in GitHub Desktop.
SentinelOne metrics collector
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment