This page covers configuration for Diamond deployments.
| File | Purpose |
|---|---|
/etc/diamond/diamond.conf |
Main configuration file |
/etc/diamond/collectors/ |
Collector configurations |
/etc/diamond/handlers/ |
Handler configurations |
[server]
# How often to collect metrics (seconds)
interval = 60
# How often to flush metrics (seconds)
flush_interval = 10
# Handlers for output
handlers = GraphiteHandler
# Log level
log_level = INFO
[handlers]
# Graphite handler configuration
[[GraphiteHandler]]
host = graphite.example.com
port = 2003
protocol = tcp
[collectors]
# Enable default collectors
[[default]]
enabled = True
[[cpu]]
enabled = True
[[memory]]
enabled = True
[[network]]
enabled = True
[[disk]]
enabled = True
[[cpu]]
enabled = True
cpu_count = 0
bytes = False
[[memory]]
enabled = True
[[network]]
enabled = True
interfaces = eth0,eth1
[[disk]]
enabled = True
filesystems = ext4,xfs
exclude = tmpfs
[[ApacheCollector]]
enabled = True
url = http://localhost/server-status?auto
[[MySQLCollector]]
enabled = True
host = localhost
user = diamond
password = secret
[[NginxCollector]]
enabled = True
url = http://localhost/nginx_status
[[GraphiteHandler]]
host = graphite.example.com
port = 2003
protocol = tcp
batch = 1
[[InfluxDBHandler]]
host = influxdb.example.com
port = 8086
database = diamond
username = diamond
password = secret
Control how metric paths are constructed:
[server]
# Path separator
path_separator = .
# Hostname in path
hostname = myserver
# Prefix for all metrics
prefix = diamond
[server]
# Increase threads for many collectors
collectors_threads = 16
handlers_threads = 4
# Adjust intervals
interval = 30
flush_interval = 5
# Test configuration
diamond --config /etc/diamond/diamond.conf --check
# Run in foreground for debugging
diamond --foreground
# Restart Diamond
sudo systemctl restart diamond
# Check status
sudo systemctl status diamond
# Check logs
sudo journalctl -u diamond -f
# Verify metrics are being sent
tcpdump -i any port 2003 -A | head -50
Create custom Python collectors in /etc/diamond/collectors/:
import diamond.collector
class MyCustomCollector(diamond.collector.Collector):
def get_default_config(self):
config = super().get_default_config()
config['interval'] = 60
return config
def collect(self):
self.publish('my.metric', 42)