Skip to content

Instantly share code, notes, and snippets.

@phone
Last active August 29, 2015 14:21
Show Gist options
  • Save phone/e63c630c03434c626a75 to your computer and use it in GitHub Desktop.
Save phone/e63c630c03434c626a75 to your computer and use it in GitHub Desktop.
install munin node
#!/bin/bash
usage() {
cat <<-'END' >&2
usage: install-munin-node.sh HOST
sets FQDN on HOST to that hosts $HOSTNAME,
installs munin-node, sets the configuration to allow
connections from all 4tcp hosts, registers itself
with the master at munin-master
END
exit
}
case $# in
1)
ssh -t -t $1 <<-'END'
sudo ed -s /etc/hosts <<< "$(echo -e "2i\n127.0.0.1 $HOSTNAME localhost\n.\nw\nq\n")"
sudo apt-get -y install munin-node
sudo ed -s /etc/munin/munin-node.conf <<< "$(echo -e "g/^allow/d\na\nallow ^\d+\.\d+\.\d+\.\d+$\n.\nw\nq\n")"
sudo killall munin-node
echo -e "$(hostname --fqdn)" | nc munin-master 4747
exit
END
;;
*)
usage
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment