This is a text-only version of the following page on https://raymii.org: --- Title : Set up a Collectd client Author : Remy van Elst Date : 09-04-2013 URL : https://raymii.org/s/tutorials/Collectd_client_setup_tutorial.html Format : Markdown/HTML --- This tutorial shows you how to set up a collectd client for use with a collectd server. What is collectd? collectd gathers statistics about the system it is running on and stores this information. Those statistics can then be used to find current performance bottlenecks (i.e. performance analysis) and predict future system load (i.e. capacity planning). Or if you just want pretty graphs of your private server and are fed up with some homegrown solution you're at the right place, too ;). You need a collectd server set up to fully use this tutorial, but I also have written a tutorial to do that. <p class="ad"> <b>Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p> [The collectd server tutorial can be found here][2]. The collectd client is much easier to set up than the server with web frontend. It only requires installation and configuring the client. #### Installing Collectd First install all the required packages: sudo apt-get install collectd #### Configuring Collectd to talk to our server Open your favorite editor and edit the `/etc/collectd/collectd.conf` file. Read it, then remove it all and make sure it looks like the below config file: ## /etc/collectd/collectd.conf generated for vps3.sparklingclouds.nl by Ansible ## Config Type: CollectD Client Hostname $HOSTNAME 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 ## CollectD Servers <Plugin "network"> Server "$COLLECTD SERVER IP" "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" The configuration file is relatively simple. Make sure to replace $VARIABLE$ by the correct on for your server. You load plugins via `"LoadPlugin $name"`. The network part is important, this configures our client to send its data to our server. Replace $COLLECT SERVER IP with your collectd server IP. *Make sure the file has a blank newline at the end. If it has not, collectd will _fail to start/run correctly_. #### Configure collectd plugins Now create the following file: `/etc/collectd/plugins.conf`, it doesn't exist by default. This will house the plugin config. Add the following content to it, but make sure it matches your LoadPlugin settings above. If you don't have the ping plugin, you also don't need the config for it. ## /etc/collectd/plugins.conf ## Static Plugins (every host has them) <Plugin swap> ReportByDevice false </Plugin> ## Dynamic Plugins <Plugin nginx> URL "http://127.0.0.1/nginx_status" </Plugin> <Plugin ntpd> Host "localhost" Port 123 ReverseLookups false </Plugin> <Plugin ping> Host "google.com" </Plugin> <Plugin sensors> SensorConfigFile "/etc/sensors3.conf" Sensor "it8712-isa-0290/temperature-temp1" Sensor "it8712-isa-0290/fanspeed-fan3" Sensor "it8712-isa-0290/voltage-in8" IgnoreSelected false </Plugin> <Plugin write_graphite> <Carbon> Host "$GRAPHITE_HOST$" Port "2003" Prefix "collectd" Postfix "collectd" StoreRates false AlwaysAppendDS false EscapeCharacter "_" </Carbon> </Plugin> Collectd server is now set up in "client" mode. To test it we restart the service: /etc/init.d/collectd restart And then check the `/var/lib/collectd/rrd/` folder and you should see some files and folders (rrd libraries). If not then your collectd is setup wrong, see syslog for more info. We also should see these files on the collectd server, in the `/var/lib/collectd/rrd` folder. If you see them there, you have done it correctly. Remember to add the IP to the collectd server firewall. Now you have a fully working collectd client set up. [1]: https://www.digitalocean.com/?refcode=7435ae6b8212 [2]: https://raymii.org/s/tutorials/Collectd_server_setup_tutorial_with_web_frontend.html --- License: All the text on this website is free as in freedom unless stated otherwise. This means you can use it in any way you want, you can copy it, change it the way you like and republish it, as long as you release the (modified) content under the same license to give others the same freedoms you've got and place my name and a link to this site with the article as source. This site uses Google Analytics for statistics and Google Adwords for advertisements. You are tracked and Google knows everything about you. Use an adblocker like ublock-origin if you don't want it. All the code on this website is licensed under the GNU GPL v3 license unless already licensed under a license which does not allows this form of licensing or if another license is stated on that page / in that software: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Just to be clear, the information on this website is for meant for educational purposes and you use it at your own risk. I do not take responsibility if you screw something up. Use common sense, do not 'rm -rf /' as root for example. If you have any questions then do not hesitate to contact me. See https://raymii.org/s/static/About.html for details.