Created
July 6, 2020 17:26
-
-
Save reard3n/15816bbdb2d98da957b67c8c68a47b35 to your computer and use it in GitHub Desktop.
This file contains 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 | |
while true | |
do | |
touch /tmp/csv.output | |
top -b -n1 | grep -A3 PID | grep -v PID | awk '{print $9","$10","$12}' > /tmp/procs | |
while read line | |
do | |
CSV=`hostname` | |
DATE=`date +%s` | |
CSV="$CSV,$DATE" | |
CSV="$CSV,$line" | |
echo $CSV >> /tmp/csv.output | |
done < /tmp/procs | |
rm /tmp/procs | |
sleep .3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment