Last active
December 28, 2015 19:29
-
-
Save gwoo/7550891 to your computer and use it in GitHub Desktop.
Install GMon on Linux.
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
#!/usr/bin/env bash | |
cd /usr/bin | |
rm gmon-linux-amd64 gmon | |
curl -C - -O -L -k github.com/gwoo/gmon/releases/download/v0.2/gmon-linux-amd64 | |
chmod a+x /usr/bin/gmon-linux-amd64 | |
ln -s /usr/bin/gmon-linux-amd64 /usr/bin/gmon | |
touch /etc/gmon.json | |
mkdir -p /etc/gmon.d | |
cd /etc/gmon.d | |
curl -s -C - -O -L -k raw.github.com/gwoo/gmon-scripts/master/linux/cpu.sh | |
curl -s -C - -O -L -k raw.github.com/gwoo/gmon-scripts/master/linux/memory.sh | |
curl -s -C - -O -L -k raw.github.com/gwoo/gmon-scripts/master/linux/disk.sh | |
chmod a+x /etc/gmon.d/* | |
cat > "/etc/init/gmon.conf" << "EOF" | |
description "GMon Agent" | |
author "GWoo" | |
# run when the local FS becomes available | |
start on local-filesystems | |
stop on shutdown | |
# Respawn, limit 10 times in 5 seconds | |
respawn | |
respawn limit 10 5 | |
# run as the correct user | |
setuid root | |
setgid root | |
# run with the correct config file for this instance | |
script | |
. /etc/environment | |
/usr/bin/gmon -conf=/etc/gmon.json -path=/etc/gmon.d -handlers=ducksboard,stdout -interval=5m >> /var/log/gmon.log 2>&1 | |
end script | |
EOF | |
initctl reload-configuration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment