Skip to content

Instantly share code, notes, and snippets.

@surjikal
Created June 8, 2012 20:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save surjikal/2898069 to your computer and use it in GitHub Desktop.
Save surjikal/2898069 to your computer and use it in GitHub Desktop.
Diamond Install

What is Diamond?

https://github.com/BrightcoveOS/Diamond

From their wiki:

Diamond is a python daemon that collects system metrics and publishes them to Graphite. It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.

Deps

apt-get install build-essentials
apt-get install python-dev
pip install psutil
pip install configobj

Installation

Ubuntu Precise Pangolin (12.04)

  • Clone the repo (git clone https://github.com/BrightcoveOS/Diamond.git)
  • Run sudo make install
  • Create and modify /etc/diamond/diamond.conf (copy the example config)
    • Change 'collectors_path' to be '/usr/local/share/diamond/collectors/'
  • Run mkdir /var/log/diamond
  • Replace the init script with the one found below.
#!/bin/sh
#
# diamond Start the diamond statistics collector
#
# chkconfig: 2345 99 01
# description: Diamond is a daemon and toolset for gathering system statistics \
# and publishing them to Graphite.
# processname: python
# config: /etc/diamond/diamond.conf
# pidfile: /var/run/diamond.pid
### BEGIN INIT INFO
# Provides: diamond
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: System statistics collector for Graphite.
# Description: Diamond is a daemon and toolset for gathering system statistics
# and publishing them to Graphite.
### END INIT INFO
# Author: Sam Bashton <sam@bashton.com>
NAME=diamond
DAEMON=/usr/local/bin/diamond
DAEMON_ARGS="-p /var/run/diamond.pid"
PIDFILE=/var/run/diamond.pid
SCRIPTNAME=/etc/init.d/diamond
start() {
echo -n "Starting $NAME: "
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
echo -n "$NAME."
}
stop() {
echo -n $"Stopping $NAME: "
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON
echo -n "$NAME."
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 2
;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment