Icingaweb2 does not show graphs from Graphite

(Mknornschild) #1

Hello together,

first of all, great community mutch helpful stuff here. I had a look if something matches my problem and also tryed some solutions but all answers I found did not fix my problem.

Problem: My Icingaweb2 did not show any Graphs from Graphite. I asume I have a config problem in /etc/icingaweb2/modules/graphite/config.ini


  • Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64)
  • Icinga r2.9.2-1
  • PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02)
  • Python 2.7.15rc1
  • Icingaweb2 Graphite module 1.1.0
  • graphite-web: 1.0.2+debian-2
  • graphite-carbon: 1.0.2-1

Graphite also shows graphs and data in its webinterface. Alle devices from Icinga are shown with their pl and rta. When I have a look into the Graphite access log I can see that Icinga tryes to open the graphs but it looks for me the link is wrong tail -f /var/log/apache2/graphite-web_access.log - - [12/Oct/2018:09:08:30 +0200] “GET /render/metrics/expand?query=icinga2.Accesspoint-1.host.hostalive4.perfdata.%2A.value HTTP/1.1” 200 1697 “-” “icingaweb2-module-graphite”


Here my config files:

1) /etc/icingaweb2/modules/graphite/config.ini
metric_prefix = icinga2
url = http://icinga2:81/render?
insecure = “1”
; fetch remote image and inline the data
remote_fetch = false

verify remote certificate

remote_verify_peer = false
; verify remote peer name
remote_verify_peer_name = false

legacy_mode = false

; if legacy mode is false (2.4 and newer):
#service_name_template = “icinga2.$host.name$.services.$service.name$.$service.check_command$.perfdata.$metric$.value”
service_name_template = “icinga2.$host.name$.services.$service.name$.$service.check_command$.perfdata.$metric$.value”
host_name_template = “icinga2.$host.name$.host.$host.check_command$.perfdata.$metric$.value”

; if legacy mode is true (pre 2.4):
;service_name_template = “icinga.$host.name$.services.$service.name$.$service.check_command$”
;host_name_template = “icinga.$host.name$.host.$host.check_command$”
;this template is used for the small image, macros $target$ , $areaMode$ and $areaAlpha$ can used.
graphite_args_template = “&target=$target$&source=0&width=300&height=120&hideAxes=true&lineWidth=2&hideLegend=true&colorList=$colorList$&areaMode=$areaMode$&areaAlpha=$areaAlpha$”
graphite_large_args_template = “&target=$target$&source=0&width=800&height=700&colorList=049BAF&lineMode=connected”
;this template is used for the large image, macros $target$ , $areaMode$ and $areaAlpha$ can used.
;graphite_large_args_template = “&target=alias(color($target$_warn,‘yellow’),‘warning’)&target=alias(color($target$_crit,‘red’),‘critical’)&target=$target$&source=0&width=800&height=700&colorList=$colorList$&lineMode=connected&areaMode=$areaMode$&areaAlpha=$areaAlpha$”
graphite_iframe_w = 800px
graphite_iframe_h = 600px
graphite_area_mode = all
graphite_area_alpha = 0.1
graphite_summarize_interval = 10min
graphite_color_list = 049BAF,EE1D00,04B06E,0446B0,871E10,CB315D,B06904,B0049C

VHost conf for Graphite: /etc/apache2/sites-enabled/graphite.conf
<VirtualHost *:81>
WSGIDaemonProcess _graphite processes=5 threads=5 display-name=’%{GROUP}’ inactivity-timeout=120 user=_graphite group=_graphite
WSGIProcessGroup _graphite
WSGIImportScript /usr/share/graphite-web/graphite.wsgi process-group=_graphite application-group=%{GLOBAL}
WSGIScriptAlias / /usr/share/graphite-web/graphite.wsgi
Alias /media /usr/lib/python2.7/dist-packages/django/contrib/admin/media/
<Location “/media”>
SetHandler None

Alias /admin/auth/admin /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin
<Location “/admin/auth/admin”>
SetHandler None

Alias /admin/auth/user/admin /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin
<Location “/admin/auth/user/admin”>
SetHandler None

Alias /static/admin/ /usr/share/python-django-common/django/contrib/admin/static/admin/
<Location “/static/admin”>
SetHandler None

Alias /static/ /usr/share/graphite-web/static/
<Location “/static/”>
SetHandler None

ErrorLog ${APACHE_LOG_DIR}/graphite-web_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/graphite-web_access.log combined

Would be great if someone have an idea. Mybe I forgott somethink.
Many Thanks

(Michael Friedrich) #2

This is the community module from findmypast, not our official one, right?

(Mknornschild) #3

Thank you very mutch for your quick answer. I hopefuly installed everything from the official sources… I think you mean the Icingaweb2 Graphite module.

All in all I used apt-get install for all modules. Only for Icinga I added the official repo because with the Ubuntu sources Icinga is installed in version 2.6.x but Ubuntu comes with PHP 7.2. This causes an PHP Session error.
‘deb https://packages.icinga.com/ubuntu icinga-bionic main’ >/etc/apt/sources.list.d/icinga.list

apt install icinga2 -y
apt install mariadb-server -y
apt install icinga2-ido-mysql -y
apt install icingaweb2 libapache2-mod-php php-gd -y

apt-get install graphite-web graphite-carbon
apt-get install python3-pymysql
apt-get install python-pymysql
git clone https://github.com/Icinga/icingaweb2-module-graphite.git -> /usr/share/icingaweb2/modules
mv icingaweb2-module-graphite/ graphite

(Michael Friedrich) #4

This config snippet got my attention, this config setting only exists in the findmypast module, not the one from Icinga.

Can you share which docs or howto you keep following?

(Mknornschild) #5

Ok I understand.
I documentet the steps I have done do get our envirement working. (Icinga, Icingaweb, Active Directory, SSO, MariaDB, Apache2, Graphite, Icinga Director) Its a summary of the official documentation, redhead docs and differend blog pages because one page didnt match our needs…

Graphite installation
apt-get update
apt-get upgrade
apt-get install graphite-web graphite-carbon
apt policy graphite-web (check version)
apt policy graphite-carbon (check version)
create database:
mysql -u root -p - enter password for database root user with was create while maria-db setup
MariaDB [(none)]> create database graphite_db;
MariaDB [(none)]> grant all privileges on graphite_db.* to graphite_user identified by “meinPasswort”;
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
vi /etc/graphite/local_settings.py
-> correct tomezone Europe/Berlin
-> correct SECRET_KEY = ‘123456789…’
-> set database settings
‘default’: {
‘NAME’: ‘graphite_db’,
‘ENGINE’: ‘django.db.backends.mysql’,
‘USER’: ‘graphite_user’,
‘PASSWORD’: ‘meinPasswort’,
‘HOST’: ‘’,
‘PORT’: ‘3306’
install Pythonmodules for MySQL - Graphite:
apt-get install python3-pymysql
apt-get install python-pymysql
initialize Graphite DB:
graphite-manage migrate auth
graphite-manage migrate
./usr/lib/python2.7/dist-packages/django/bin/django-admin.py migrate --settings=graphite.settings --run-syncdb
Graphite/Django Framework set adminpassword:
python manage.py createsuperuser (follow dialog)
-> in my case the manage.py could not be found then create a file manage.py in /usr/lib/python2.7/dist-packages/graphite
paste following in the manage.py and save:
#!/usr/bin/env python
import os
import sys
if name == “main”:
#os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “{{ project_name }}.settings”)
os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “graphite.settings”)
from django.core.management import execute_from_command_line

Carbon Cache activation:
vi /etc/default/graphite-carbon
Logrotation activation:
vi /etc/carbon/carbon.conf
Carbon Cache startup
systemctl start carbon-cache
systemctl enable carbon-cache

Grahitemodule in Icinga installation and activation:
cd /usr/share/icingaweb2/modules
git clone https://github.com/Icinga/icingaweb2-module-graphite.git
rename the downloaded folder: mv icingaweb2-module-graphite/ graphite
icinga2 feature enable graphite
icinga2 feature enable perfdata
service icinga2 restart
open the IcingaWeb2 interface:
Menue- Config- Module - graphite - Status: active
Menue- Config- Module - graphite - “Backend” enter: Graphite Web URL “http://icinga2:81/

Apache2 for Graphite config:
Modul WSGI installation: apt-get install libapache2-mod-wsgi
Modul activation: a2enmod wsgi
Hint: If you use python3 for graphite/Django framework you need: libapache2-mod-wsgi-py3

create vHosts: vi /etc/apache2/sites-available/graphite.conf

(Michael Friedrich) #6

I’d say to remove this file and edit the web form again to configure the backend. Then it should work again hopefully.

(Mknornschild) #7

I was looking for 4 days for the correct configuration but it did not came in my mind to simply use the webinterface. I remember that I edited the config.ini with the posted values from the beginning because I found an information in a blog that you need this… maybe in earlyer versions of the module. So many thanks for help!

After Graphite installation and installation of the Icingaweb2 Graphite module restart your webserver and configure the Graphite URL via the Webinterface: Configuration -> Module -> graphite -> Backend -> “Graphite Web URL” -> e.g. http: //icinga2:81 (in my case - because I created a own vHost in Apache2 for Graphite)

(Michael Friedrich) #8

Very early versions of the module did not have such a config form, that’s correct. 1.0+ got this implemented when prepared for the first official stable release.

(Nodermatt) #9

I had a similar issue but it turned out I forgot to add the -f switch to the snmp check command to enable performance data output.

Afterwards it worked like a charm.


great tutorial thx ! I would add the following information:

  1. my manage.py script working version:

#!/usr/bin/env python
import os
import sys

if name == “main”:
os.environ.setdefault(“DJANGO_SETTINGS_MODULE”, “graphite.settings”)
from django.core.management import execute_from_command_line

sudo nano -c /etc/carbon/storage-schemas.conf
add this config:

pattern = ^icinga2.
retentions = 1m:2d,5m:10d,30m:90d,360m:4y

  1. graphite web configuration, leave port 80 (then remove default site on 80) or change to 81. Then add Listen 81 in /etc/apache2/ports.conf . I recommend using icinga web vhost with letsencrypt only on port 443.

cp /usr/share/graphite-web/apache2-graphite.conf /etc/apache2/sites-available/graphite.conf
<VirtualHost *:81>

a2ensite graphite
systemctl restart apache2

  1. If You have IOError: [Errno 13] Permission denied: ‘/var/log/graphite/info.log’ in /var/log/apache2/graphite-web_error.log then:

sudo chmod 666 /var/log/graphite/info.log
sudo chmod 666 /var/log/graphite/exception.log