Metric Collect

This repository contains the code for metric_collect. This is intended to be used to help collect metrics either from a central server or in a distributed fashion by giving an easy to use DSL for graphite, statsd, & e-mail. Other backends can easily be added.

Installation

To use simply clone from github (https://github.com/moserke/metric_collect.git)

Usage

Run metric_collect from ./bin passing it the fully qualified path to your config.rb file

Config

The config file is used to set some general parameters.

Parameters

  • graphite_server: Name of graphite server (default: localhost)
  • graphite_port: Port of graphite server (default: 2003)
  • statsd_server: Name of statsd server (default: localhost)
  • statsd_port: Port of statsd server (default: 8125)
  • email_server: SMTP server to send to (default: nil)
  • email_from: Who to send the e-mail from (default: nil)
  • metrics_directory: Directory to look for metric definition ruby files (default: nil)

Back Ends

statsd

This is the metric type that will send to a statsd backend. Make sure to include statsd_server & statsd_port in config.rb. Default is localhost and 8125

Attributes

  • name: Name of the metric (default: name of the metric)
  • value: Value of the metric (default: nil)
  • key: The key path to use in dot notation (default: metric_collect)
  • type: Is a symbol defining what type of statsd metric to send (:counter, :timer, :gauge, :set) (default: :gauge)

graphite

This is the metric type that will send to a graphite backend. Make sure to include graphite_server & graphite_port in config.rb. Default is localhost and 2003

Attributes

  • name: Name of the metric (default: name of the metric)
  • value: Value of the metric (default: nil)
  • key: The key path to use in dot notation (default: metric_collect)

email

This is the metric type that will send to an smtp server. Make sure to include email_server and email_from in your config.rb. There are no defaults for these.

Attributes

  • name: Name of the metric (default: name of the metric)
  • value: Value of the metric (default: nil)
  • subject: Subject of the e-mail (default: Message From Metric Collect)
  • to: Who to send the e-mail to (default: nil)
  • body: Body of the message to send (default: nil)