
As practice shows, most of the clients do not monitor the resources used by them, the services they rent (this is especially noticeable on cheap VPS services from $ 3). That is, after installing the system and setting up the software required for the project, the server’s further fate is given occasion. And, when there are problems with server performance, there is not too much information to analyze.
In addition to the installed and configured logging in atop (which is also not often found), the logs of the system, I would like to have more information with which to work.')
This article will describe how to install and configure
collectd and
collectd-web using the example of a Debian family OS.
Some general information.
Collectd is a lightweight daemon that collects statistics on resource usage (and not only), and adds information in
rrd format. In fact, collectd itself only collects statistics, to view and analyze the collected information you need to install a web interface. A complete list of front-ends for collectd can be found
here .
The big plus is that for collectd there are a large number of plug-ins for
various tasks.
It is worth considering that collectd is able to set up “master server and nodes” - data from monitored servers is sent to the master, which stores them and draws graphics.
It is worth considering that different web-interfaces are implemented on different frameworks. Depending on your preferences and software installed for the project, you can choose the most optimal option for yourself.
The installation process itself
Update the list of packages available in the repositories.
We install collectd.
Run collectd after installation.
Collectd is installed and running, now proceed to install the web interface.
First, install
git .
Install the necessary modules.
We put a web server.
After installing apache, go to the default directory of its virtualhost.
Begin to install the web interface itself.
To run cgi scripts collect-web, located on the default path (in this case -
/ var / www / html / collectd-web /), you must explicitly specify in the config. We edit the default virtualhost config.
Add this block after the line with the directive DocumentRoot. <Directory /var/www/html/collectd-web/cgi-bin> Options Indexes ExecCGI AllowOverride All AddHandler cgi-script .cgi Require all granted </Directory>

We include apache CGI module.
We are overloading the web server for the changes to take effect.
Now collectd is accessible from the outside by web.
http: //
xxx.xxx.xxx.xxx / collectd-web /

Exposing it in this form to the world is a bad idea, you need to restrict access to it.
You can use the standard apache utilities -
htpasswd .
To get started, install them if they do not pull up when installing a web server.
We generate a file with passwords.
Now we need to teach the Apache to let the password collect. To do this, edit the desired virtualhost.
Add another block.
<Directory /var/www/html/collectd-web > AuthType Basic AuthName "Collectd Restricted Page" AuthBasicProvider file AuthUserFile /var/www/html/collectd-web/.htpasswd Require valid-user </Directory>

We leave ctrl + x, to the question whether to save the changes, we answer yes + enter.
We pull apache in order for the changes to take effect.
We check that we were not mistaken anywhere, and now our collectd does not allow anyone to get caught.

Done, now in case of problems with the server or an excess of free time and lack of plans, you can open collectd-web, analyze server resources used, possible bottlenecks and assess the growth trend.
Well, or you can simply admire the beautiful graphs.