2015-06-24 12:48:29 +02:00
|
|
|
collectd
|
|
|
|
========
|
|
|
|
|
|
|
|
`collectd` is a daemon which collects system performance statistics periodically
|
|
|
|
and provides mechanisms to store the values in a variety of ways, for example
|
|
|
|
in RRD files.
|
|
|
|
|
2015-06-24 13:51:35 +02:00
|
|
|
## directory tree
|
|
|
|
|
|
|
|
```
|
|
|
|
~/fig/collectd/
|
2017-03-23 10:49:18 +02:00
|
|
|
├── data/
|
2015-06-24 13:51:35 +02:00
|
|
|
│ ├── collectd.conf
|
|
|
|
│ └── conf.d/
|
|
|
|
│ └── network.conf
|
|
|
|
└── docker-compose.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
## config files
|
|
|
|
|
|
|
|
collectd.conf
|
|
|
|
|
2017-03-23 10:49:18 +02:00
|
|
|
```apache
|
2015-06-24 13:51:35 +02:00
|
|
|
Hostname "localhost"
|
|
|
|
|
|
|
|
FQDNLookup false
|
|
|
|
Interval 10
|
|
|
|
Timeout 2
|
|
|
|
ReadThreads 5
|
|
|
|
WriteThreads 5
|
|
|
|
|
|
|
|
LoadPlugin cpu
|
|
|
|
LoadPlugin interface
|
|
|
|
LoadPlugin load
|
|
|
|
LoadPlugin memory
|
|
|
|
|
|
|
|
Include "/etc/collectd/conf.d/*.conf"
|
|
|
|
```
|
|
|
|
|
|
|
|
network.conf
|
|
|
|
|
2017-03-23 10:49:18 +02:00
|
|
|
```apache
|
2015-06-24 13:51:35 +02:00
|
|
|
LoadPlugin network
|
|
|
|
|
|
|
|
<Plugin "network">
|
2015-06-24 14:43:07 +02:00
|
|
|
Server "influxdb" "25826"
|
2015-06-24 13:51:35 +02:00
|
|
|
</Plugin>
|
|
|
|
```
|
|
|
|
|
2017-03-23 10:49:18 +02:00
|
|
|
weather.conf
|
|
|
|
|
|
|
|
```apache
|
|
|
|
LoadPlugin curl_json
|
|
|
|
|
|
|
|
<Plugin curl_json>
|
|
|
|
<URL "https://query.yahooapis.com/v1/public/yql?q=select%20item.condition%20from%20weather.forecast%20where%20woeid%3D2151330%20and%20u%3D'c'&format=json">
|
|
|
|
Instance "Beijing"
|
|
|
|
<Key "query/results/channel/item/condition/temp">
|
|
|
|
Type "gauge"
|
|
|
|
</Key>
|
|
|
|
</URL>
|
|
|
|
<URL "https://query.yahooapis.com/v1/public/yql?q=select%20item.condition%20from%20weather.forecast%20where%20woeid%3D2151849%20and%20u%3D'c'&format=json">
|
|
|
|
Instance "Shanghai"
|
|
|
|
<Key "query/results/channel/item/condition/temp">
|
|
|
|
Type "gauge"
|
|
|
|
</Key>
|
|
|
|
</URL>
|
|
|
|
<URL "https://query.yahooapis.com/v1/public/yql?q=select%20item.condition%20from%20weather.forecast%20where%20woeid%3D23511745%20and%20u%3D'c'&format=json">
|
|
|
|
Instance "Silicon_Valley"
|
|
|
|
<Key "query/results/channel/item/condition/temp">
|
|
|
|
Type "gauge"
|
|
|
|
</Key>
|
|
|
|
</URL>
|
|
|
|
</Plugin>
|
|
|
|
```
|
|
|
|
|
2015-06-24 12:48:29 +02:00
|
|
|
## docker-compose.yml
|
|
|
|
|
|
|
|
```
|
|
|
|
collectd:
|
|
|
|
image: vimagick/collectd
|
|
|
|
volumes:
|
2017-03-23 10:49:18 +02:00
|
|
|
- ./data:/etc/collectd
|
2015-06-24 13:51:35 +02:00
|
|
|
pid: host
|
2015-06-24 16:43:17 +02:00
|
|
|
net: host
|
2015-06-24 12:48:29 +02:00
|
|
|
restart: always
|
|
|
|
```
|