Created
December 21, 2016 09:26
-
-
Save davidonet/6d7554bd8bbb0a263a2d41d5b7481f3c to your computer and use it in GitHub Desktop.
Log cpuload and memory usage to graylog2 server using udp
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 | |
load=`cat /proc/loadavg | awk '{print $1}'` | |
mem=`free -o | awk 'NR==2{print $3}'` | |
echo '{"version": "1.1","host":"'$HOSTNAME'","short_message":"cpumem","level":4,"_load":'$load',"_mem":'$mem'}' | nc -c -w1 -u graylog.server 12201 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment