Metainformationen zur Seite
Collectd-Graphen mit Graphite und Grafana
Ausgehend von einem CentOS 7:
cat <<EOF >/etc/yum.repos.d/grafana.repo [grafana] name=grafana baseurl=https://packagecloud.io/grafana/stable/el/7/\$basearch repo_gpgcheck=1 enabled=1 gpgcheck=1 gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt EOF yum -y install epel-release yum -y install collectd grafana graphite-web python-carbon python-psycopg2
Ich benutze eine externe PostgreSQL DB. Wer eine lokale möchte:
yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm yum install postgresql96-server /usr/pgsql-9.6/bin/postgresql96-setup initdb systemctl enable postgresql-9.6.service --now
PostgreSQL User anlegen (auf dem PostgreSQL Server oder lokal):
su - postgres createuser -P collectd createdb -O collectd grafana createdb -O collectd graphite
/var/lib/pgsql/9.6/data/pg_hba.conf:
host all all 0.0.0.0/0 md5
/etc/graphite-web/local_settings.py:
SECRET_KEY=... TIME_ZONE=... DATABASES = { 'default': { 'NAME': 'graphite', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'collectd', 'PASSWORD': 'PASSWORT', 'HOST': 'IP-ADRESSE', 'PORT': '5432' } }
graphite-manage syncdb
/etc/httpd/conf.d/graphite-web.conf:
Require local
ändern in
Require all granted
rm /etc/httpd/conf.d/welcome.conf
/etc/grafana/grafana.ini:
type = postgres host = IP-ADRESSE user = collectd password = PASSWORT
/etc/collectd.conf:
LoadPlugin network LoadPlugin write_graphite <Plugin network> Listen "0.0.0.0" "25826" </Plugin> <Plugin write_graphite> <Node "graphite"> Host "localhost" Port "2003" Protocol "tcp" ReconnectInterval 0 LogSendErrors true Prefix "collectd_" StoreRates true AlwaysAppendDS false EscapeCharacter "_" SeparateInstances false PreserveSeparator false DropDuplicateFields false </Node> </Plugin>
/etc/carbon/storage-schemas.conf:
[collectd] pattern = ^collectd retentions = 10s:3d,1m:14d,10m:90d,30m:260d,1h:3y
setsebool -P collectd_tcp_network_connect=on setsebool -P httpd_can_network_connect=on systemctl enable carbon-cache --now systemctl enable httpd --now systemctl enable collectd --now systemctl enable grafana-server --now
Auf <IP>:3000 einloggen (User admin, Passwort admin):
- Add a datasource
- Name: graphite
- Type: Graphite
- URL: http://localhost
- Access: proxy