The collectd config for the clients is basicly the same as with the server only one line difference; instead of listening ; you punch in a server.
The hostname of this client is SwitchPi, it also has 1wire filesystem (OWFS) running to capture temperatures with the curl plugin.
There's also one curl test that gets the core temperature of the BCM SoC on a Pi (file:///sys/class/thermal/thermal_zone0/temp)
sudo apt-get install collectd collectd-utils
|
Next step is to config the deamon as a client using network as it's output.
sudo nano /etc/collectd/collectd.conf
|
## /etc/collectd/collectd.conf
## Config Type: CollectD Client Hostname SwitchPi FQDNLookup false Interval 30 ReadThreads 1 LoadPlugin syslog <Plugin syslog> LogLevel info </Plugin> LoadPlugin cpu LoadPlugin df LoadPlugin disk LoadPlugin entropy LoadPlugin interface LoadPlugin irq LoadPlugin load LoadPlugin memory LoadPlugin processes #LoadPlugin rrdtool LoadPlugin swap LoadPlugin users LoadPlugin network ## Extra Plugins #LoadPlugin nginx #LoadPlugin iptables LoadPlugin uptime #LoadPlugin dns #LoadPlugin ping LoadPlugin curl ## CollectD Servers <Plugin "network"> Server "192.168.1.147" "25826" # Server "$COLLECTD SERVER IP" "25826" SecurityLevel None </Plugin> #<Plugin rrdtool> # DataDir "/var/lib/collectd/rrd" #</Plugin> Include "/etc/collectd/filters.conf" Include "/etc/collectd/plugins.conf" Include "/etc/collectd/thresholds.conf" |
sudo nano /etc/collectd/plugins.conf
|
## /etc/collectd/plugins.conf
## Config Type: CollectD Plugins <Plugin swap> ReportByDevice false </Plugin> <Plugin curl> #Last one does CPUTemp for raspberry; rest is 1wire-filesystem <Page "KamerTemp"> URL "file:///mnt/1wire/28.XXXXXXXXXX0000/temperature" <Match> Regex "(^-?[0-9]*\\.[0-9]+)" DSType "GaugeLast" Type "temperature" Instance "Room" </Match> </Page> <Page "Verwarming"> URL "file:///mnt/1wire/28.XXXXXXXX0000/temperature" <Match> Regex "(^-?[0-9]*\\.[0-9]+)" DSType "GaugeLast" Type "temperature" Instance "Heater" </Match> </Page> <Page "SwitchPiTemp"> URL "file:///mnt/1wire/28.XXXXXXXX0000/temperature" <Match> Regex "(^-?[0-9]*\\.[0-9]+)" DSType "GaugeLast" Type "temperature" Instance "SwitchPi" </Match> </Page> <Page "DcLinksTemp"> URL "file:///mnt/1wire/28.XXXXXXXX0000/temperature" <Match> Regex "(^-?[0-9]*\\.[0-9]+)" DSType "GaugeLast" Type "temperature" Instance "Data Center Left" </Match> </Page> <Page "BuitenVooraan1e"> URL "file:///mnt/1wire/28.XXXXXXXX0000/temperature" <Match> Regex "(^-?[0-9]*\\.[0-9]+)" DSType "GaugeLast" Type "temperature" Instance "Outside" </Match> </Page> <Page "CpuTemp"> URL "file:///sys/class/thermal/thermal_zone0/temp" <Match> Regex "([0-9]*)" DSType "GaugeLast" Type "temperature" Instance "CPUTemp_switchpi" </Match> </Page> </Plugin> <Plugin df> #excluding some useless filesystems MountPoint "/run" MountPoint "/run/lock" MountPoint "/boot" FSType rootfs # ignore the usual virtual / temporary file-systems except tmpfs so we do monitor /run/shm FSType sysfs FSType proc FSType devtmpfs FSType devpts FSType fusectl FSType cgroup IgnoreSelected true # ReportInodes false </Plugin> <Plugin disk> #only monitor p2, mmcblk0 is a compound of the two Disk "mmcblk0" Disk "mmcblk0p1" Disk "sda1" #since sda will count traffic on all partitions IgnoreSelected true </Plugin> <Plugin "openvpn"> StatusFile "/var/log/openvpn-status.log" StatusFile "/var/log/openvpntcp-status.log" # Collect one RRD for each logged in user CollectIndividualUsers true # Aggregate number of connected users CollectUserCount true # Store compression statistics CollectCompression true # Use new NamingSchema ImprovedNamingSchema true </Plugin> |
Thank you for this post! I stumbled across it and realized that collectd was even more powerful than I had realized. I've grabbed the CPU temp and 1-wire logging, then used that to gather metrics from an Ambient Weather WS-1400-IP weather station while I was at it. I wrote up my experience: http://cmhramblings.blogspot.com/2015/08/logging-weather-data-with-raspberry-pi.html
BeantwoordenVerwijderen