Collectd installation: Difference between revisions

From VoIPmonitor.org
Jump to navigation Jump to search
No edit summary
No edit summary
 
(19 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Centos =
= Centos =
''' Httpd '''
You need to have installed web server with enabled perl and CGI scripts processing (for be possible to look at results using web-browser). This how to doesn't cover web server configuation.


Install collectd packages from epel repositories:
Install collectd packages from epel repositories:
Line 5: Line 9:
  yum install collectd
  yum install collectd
  yum install collectd-web
  yum install collectd-web
Atention: by default is web-collection accessible only from localhost, see config of httpd (search for 'Deny from' and 'Allow from' and change it:
vim /etc/httpd/conf.d/collectd.conf
  service httpd restart
  service httpd restart


You can now access collectd collections entering this url to a browser:
You can now access collectd collections entering this url to a browser:
  http://server_ip/collectd/bin/index.cgi
  http://server_ip/collectd/bin/index.cgi


= Debian =
= Debian =
== Apache2 ==
For ability checking results using browser you need web server with enabled CGI and perl scripts processing.
'''Enable apache2 modules'''
perl
cgi
using command '''a2enmod''' .
''' Add CGI handler into apache processing (in mime.conf uncomment)'''
  AddHandler cgi-script .cgi
''' Define +ExecCGI option '''
under directory where will be collctd's GUI link placed
<Directory "/var/www/html/abcdefg/collectd">
  Options +ExecCGI
</Directory>


== Debian7 ==
== Debian7 ==
Install collectd packages from debian main repositories:
Install collectd packages from debian main repositories:
  apt-get install collectd librrds-perl
  apt-get install collectd libregexp-common-perl libconfig-general-perl librrds-perl
Create link from default www directory to collectd's collections.
 
Create link from default www directory to collectd's doc.
  ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/collectd
  ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/collectd
Restart apache web-server (you should have cgid mod enabled "a2enmod cgid")
/etc/init.d/apache2 restart
You can now access using browser:
You can now access using browser:
  http://server_ip/collectd/bin/index.cgi
  http://server_ip/collectd/bin/index.cgi


== Debian8 ==
== Debian8 ==
Install collectd packages from debian main repositories:
Install collectd packages from debian main repositories:
  apt-get install collectd librrds-perl
  apt-get install collectd libregexp-common-perl libconfig-general-perl librrds-perl
 
Create link from default www directory to collectd's collections.
Create link from default www directory to collectd's collections.
  ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/html/collectd
  ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/html/collectd
Restart apache
service apache2 restart
You can now access using browser:
You can now access using browser:
  http://server_ip/collectd/bin/index.cgi
  http://server_ip/collectd/bin/index.cgi
= Tail config example =
LoadPlugin tail
<Plugin tail>
  <File "/var/log/messages">
    Instance "voipmonitor"
    Interval 30
    <Match>
        Regex "calls.([0-9]+),"
        DSType "GaugeAverage"
        Type "count"
        Instance "Calls"
    </Match>
    <Match>
        Regex "PS\\[C:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-C"
    </Match>
    <Match>
        Regex "PS\\[.* R:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-R"
    </Match>
    <Match>
        Regex "PS\\[.* A:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-a"
    </Match>
    <Match>
        Regex "heap\\[([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "heap"
    </Match>
    <Match>
        Regex "VSZ\\[([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "rss"
    </Match>
  </File>
</Plugin>
= Sensor plugin configuration =
* plugin contains pcie temperature, cpu temperature, etc.
* install lm sensor package
* run sensors-detect binary to detect sensors
* add an example to the config
LoadPlugin sensors
<Plugin sensors>
        SensorConfigFile "/etc/sensors3.conf"
</Plugin>
= Disk space plugin =
* simple setting for percentage usage
LoadPlugin df
<Plugin df>
#      Device "/dev/hda1"
#      Device "192.168.0.2:/mnt/nfs"
#      MountPoint "/home"
#      FSType "ext3"
#      IgnoreSelected false
#      ReportByDevice false
#      ReportInodes false
        ValuesAbsolute false
        ValuesPercentage true
</Plugin>
= Scale stored value =
* enable these two plugins
LoadPlugin match_regex
LoadPlugin target_scale
* add a filter (example is for rss count)
<Chain "PreCache">
    <Rule>
        <Match "regex">
            Plugin "^tail$"
            TypeInstance "^rss$"
            Invert false
        </Match>
        <Target "scale">
            Factor 1048576
        </Target>
    </Rule>
</Chain>
= Threshold and notify setting =
* on RH you need to install collectd-notify_email.x86_64 package. On debian it's in collectd-core package.
* example for df setting from the example above
LoadPlugin "notify_email"
<Plugin "notify_email">
  From "collectd@localhost"
  Recipient "a@voipmonitor.org"
  Recipient "b@voipmonitor.org"
</Plugin>
LoadPlugin "threshold"
<Plugin threshold>
  <Plugin "df">
    Instance "root"
    <Type "percent_bytes-used">
        WarningMax 75
    </Type>
  </Plugin>
</Plugin>
* for notify's logging in syslog (can be set together with notify_email)
<Plugin syslog>
#      LogLevel info
        NotifyLevel "OKAY"
</Plugin>

Latest revision as of 17:38, 14 September 2018

Centos

Httpd You need to have installed web server with enabled perl and CGI scripts processing (for be possible to look at results using web-browser). This how to doesn't cover web server configuation.


Install collectd packages from epel repositories:

yum install epel-release
yum install collectd
yum install collectd-web


Atention: by default is web-collection accessible only from localhost, see config of httpd (search for 'Deny from' and 'Allow from' and change it:

vim /etc/httpd/conf.d/collectd.conf
service httpd restart

You can now access collectd collections entering this url to a browser:

http://server_ip/collectd/bin/index.cgi


Debian

Apache2

For ability checking results using browser you need web server with enabled CGI and perl scripts processing.

Enable apache2 modules

perl
cgi

using command a2enmod .


Add CGI handler into apache processing (in mime.conf uncomment)

 AddHandler cgi-script .cgi


Define +ExecCGI option under directory where will be collctd's GUI link placed

<Directory "/var/www/html/abcdefg/collectd">
  Options +ExecCGI
</Directory>

Debian7

Install collectd packages from debian main repositories:

apt-get install collectd libregexp-common-perl libconfig-general-perl librrds-perl

Create link from default www directory to collectd's doc.

ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/collectd

Restart apache web-server (you should have cgid mod enabled "a2enmod cgid")

/etc/init.d/apache2 restart

You can now access using browser:

http://server_ip/collectd/bin/index.cgi

Debian8

Install collectd packages from debian main repositories:

apt-get install collectd  libregexp-common-perl libconfig-general-perl librrds-perl

Create link from default www directory to collectd's collections.

ln -s /usr/share/doc/collectd-core/examples/collection3/ /var/www/html/collectd

Restart apache

service apache2 restart

You can now access using browser:

http://server_ip/collectd/bin/index.cgi

Tail config example

LoadPlugin tail
<Plugin tail>
  <File "/var/log/messages">
    Instance "voipmonitor"
    Interval 30
    <Match>
        Regex "calls.([0-9]+),"
        DSType "GaugeAverage"
        Type "count"
        Instance "Calls"
    </Match>
    <Match>
        Regex "PS\\[C:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-C"
    </Match>
    <Match>
        Regex "PS\\[.* R:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-R"
    </Match>
    <Match>
        Regex "PS\\[.* A:([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "PS-a"
    </Match>
    <Match>
        Regex "heap\\[([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "heap"
    </Match>
    <Match>
        Regex "VSZ\\[([0-9]+)"
        DSType "GaugeAverage"
        Type "count"
        Instance "rss"
    </Match>
  </File>
</Plugin>

Sensor plugin configuration

  • plugin contains pcie temperature, cpu temperature, etc.
  • install lm sensor package
  • run sensors-detect binary to detect sensors
  • add an example to the config
LoadPlugin sensors
<Plugin sensors>
       SensorConfigFile "/etc/sensors3.conf"
</Plugin>

Disk space plugin

  • simple setting for percentage usage
LoadPlugin df
<Plugin df>
#       Device "/dev/hda1"
#       Device "192.168.0.2:/mnt/nfs"
#       MountPoint "/home"
#       FSType "ext3"
#       IgnoreSelected false
#       ReportByDevice false
#       ReportInodes false
        ValuesAbsolute false
        ValuesPercentage true
</Plugin>

Scale stored value

  • enable these two plugins
LoadPlugin match_regex
LoadPlugin target_scale
  • add a filter (example is for rss count)
<Chain "PreCache">
    <Rule>
        <Match "regex">
            Plugin "^tail$"
            TypeInstance "^rss$"
            Invert false
        </Match>
        <Target "scale">
            Factor 1048576
        </Target>
    </Rule>
</Chain>

Threshold and notify setting

  • on RH you need to install collectd-notify_email.x86_64 package. On debian it's in collectd-core package.
  • example for df setting from the example above
LoadPlugin "notify_email"
<Plugin "notify_email">
  From "collectd@localhost"
  Recipient "a@voipmonitor.org"
  Recipient "b@voipmonitor.org"
</Plugin>
LoadPlugin "threshold"
<Plugin threshold>
  <Plugin "df">
    Instance "root"
    <Type "percent_bytes-used">
       WarningMax 75
    </Type>
  </Plugin>
</Plugin>
  • for notify's logging in syslog (can be set together with notify_email)
<Plugin syslog>
#       LogLevel info
        NotifyLevel "OKAY"
</Plugin>