Problems with Graphite on Ubuntu and NGINX

Hello together at the moment i am setting up a new Icinga instance and are facing massive issues getting graphite to work

acutal Setup:
Icinga 2.8.1
Ubuntu Server 17.10

when i install graphite with help from tutorials it works until the migration point:

File "/usr/lib/python2.7/dist-packages/graphite/urls.py", line 29, in <module>
    urlpatterns = patterns('',
NameError: name 'patterns' is not defined

when i activate the module in icingaweb2 i am getting following error:

Fatal error: Uncaught ErrorException: Undefined variable: messages in zend.view:///usr/share/icingaweb2/application/views/scripts/error/error.phtml:15 Stack trace: #0 zend.view:///usr/share/icingaweb2/application/views/scripts/error/error.phtml(15): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(8, 'Undefined varia...', 'zend.view:///us...', 15, Array) #1 /usr/share/php/Icinga/Web/View.php(270): include('zend.view:///us...') #2 /usr/share/icingaweb2/library/vendor/Zend/View/Abstract.php(877): Icinga\Web\View->_run('/usr/share/icin...') #3 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(904): Zend_View_Abstract->render(NULL) #4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(925): Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.pht...', NULL) #5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): Zend_Controller_Action_Helper_ViewRenderer->render() #6 /usr/share/icingawe in /usr/share/icingaweb2/library/vendor/Zend/Controller/Plugin/Broker.php on line 332

from NGINX log files i could get this information:

#5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): Zend_Controller_Action_Helper_ViewRender" while reading response header from upstream, client: 192.168.168.93, server: icinga-master, request: "GET /render?&target=icinga2.icinga-master.services.ping6.ping6.perfdata.pl.value&source=0&width=300&height=120&hideAxes=true&lineWidth=2&hideLegend=true&colorList=049BAF,EE1D00,04B06E,0446B0,871E10,CB315D,B06904,B0049C&areaMode=all&areaAlpha=0.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "icinga-master", referrer: "http://icinga-master/monitoring/service/show?host=icinga-master&service=ping6"
2018/03/01 14:32:22 [error] 56017#56017: *266 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ErrorException: Undefined variable: messages in zend.view:///usr/share/icingaweb2/application/views/scripts/error/error.phtml:15

Appreciating any help

Maybe something is missing in Python.
I don’t know if it works with packages or something similar

Please if you do not have any helpful advice try not to reply.

I have searched hours for a solution and couldn’t find any. I am not asking and try making a quiz out of it.

https://www.google.de/search?client=firefox-b-ab&dcr=0&ei=yQ-YWuGnMoncwQK72YCoDA&q=graphite+NameError%3A+name+%27patterns%27+is+not+defined&oq=graphite+NameError%3A+name+%27patterns%27+is+not+defined&gs_l=psy-ab.3…0i30i19k1.8950.9708.0.9941.9.8.0.0.0.0.147.799.5j3.8.0…0…1c.1.64.psy-ab…5.4.365…0i7i30k1.0.EXQFOoQJXUk

Well, you know, half of the time people never search on internet before. So that’s why I said that.
As I can’t help you, I wish you’ll find a solution very soon. Regards

1 Like

Watch your tone please. There really is no need to attack someone if you are not happy with an answer.

@Pio is correct about the error, this seems to be a problem with a Python library of dependency. It would help to know how you’ve installed Graphite and which version you are using.

Did you try to call /render?&target=icinga2.icinga-master.services.ping6.ping6.perfdata.pl.value&source=0&width=300&height=120&hideAxes=true&lineWidth=2&hideLegend=true&colorList=049BAF,EE1D00,04B06E,0446B0,871E10,CB315D,B06904,B0049C&areaMode=all&areaAlpha=0.1 directly on Graphite web? Does this cause the same mentioned Python error?

The Icinga Web 2 exception comes from a regression in v2.5.1, that’s a different problem and is fixed in git master.

1 Like

The error in python comes when i try to migrate the database.

I installed graphite with apt package manager and i followed this tutorial at first https://www.linuxfrickeln.de/visualisierung-von-performancedaten-in-der-icingaweb2-gui/

and at this point:

python /usr/lib/python2.7/dist-packages/graphite/manage.py syncdb

comes the error. While syncdb is deprecated i ran the command with “migrate” instead of syncdb where i got the first error with the undefined name for the URL list. I haven’t been able to get the graphite-web to work since yet and i think that there is correlation between those two errors. I will try tomorrow if you have any advice on which library could be missing at the installation process i would appreciate.

I don’t have an Ubuntu 17.10 at hand, so it would really help if you provide the package version of Graphite itself.

Googling your initial error leads to syncdb already, I suspect that either the command is wrong, or you’ve pulled in the wrong Django package as being version specific. Or any other Python dependency.

So I managed to migrate the database by downgrading Django.

I have following Packages for graphite installed:

graphite-carbon/artful,artful,now 0.9.15-1 all  [installiert]
graphite-web/artful,artful,now 0.9.15+debian-2 all  [installiert]

When I tried to call the rendering URL direct it still gives me the same error as mentioned.

So I am at the point where I have absolutely no idea anymore.
I installed it on Ubuntu 17.10 and Apache2 and still get the same Error Message on Icingaweb2.

So I have absolutely no idea anymore what I can do to make it work. When someone could help me I would appreciate to get config files for nginx and the graphite.ini or maybe just posts a tutorial by himself or PM me i dont care as long as i could just get a respond that leads to a solution.

I remember that I had to pin the Twisted library to a specific version for Graphite 0.9.14 which could also be the case here.

I did not touch 0.9.15 but upgraded to 1.1.x lately. These versions also have specific Python library dependencies, especially Django. Older versions need to stick with Django < 1.8 AFAIK.

Depending on how you’ve installed these dependencies, you’ll need to figure out which versions need to be installed/pinned.

I have never installed Graphite manually though, I just put them inside Puppet and let pip handle the rest.