Code Monkey home page Code Monkey logo

Comments (55)

klmj avatar klmj commented on July 24, 2024 1

Hi there,

For Apache

Add the following line inside either the <Directory>, <Location>, <Files> or <VirtualHost> sections of your server config (usually located in a *.conf file, such as httpd.conf or apache.conf), or within a .htaccess file :

<IfModule headers_module>
	Header set Access-Control-Allow-Origin "*"
	Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE"
	Header set Access-Control-Allow-Credentials "true"
	Header set Access-Control-Allow-Headers "Origin,Content-Type,Accept,Authorization,App-Token,Session-Token"
</IfModule>

Regards

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024 1

The config seems good, but are you sure the module headers_module is installed and loaded?
You have the IfModule so perhaps it's that

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024 1

Not unactive it :p
if put the active to no automatically (so without manual modification), you have a big problem :(

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Ah? how do you installed it? (it will be more easier when be published, so in very few days)

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

I copied the folder glpi_app_grafana in /var/lib/grafana/plugins .

In grafana
image

Settings data source
2017-06-26 13 05 40

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

You need define the user token related to the account in GLPI.

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

Yes, of course. this data is provided
2017-06-26 13 45 05

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

In GLPI, you have right allow the IP of your grafana in the API ?

Perhaps try use access direct instead proxy

What version of grafana you use? I have developped on grafana 4

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024
  1. Yes.
    image
  2. no, when using the directories have the error
    image
  3. version grafana Grafana v4.3.2 (commit: ed4d170)

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

in ipv4 address range you must set it, try use something like 0.0.0.1 - 254.254.254.254 to allow all IP ;)

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

no =( , I pointed out the IP grafana
image

the same error

HTTP Error
Bad Request

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Address range, you must specify the first IP and the last IP, not the netmask :D

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

no,
image

HTTP Error
Bad Request

http://192.168.80.19/**apirest.php** right ?

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

the URL is right with GLPI 9.1.x...
Perhaps see your webserver logs

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

In the web server when connecting from grafana reports the following

[26/Jun/2017:15:53:30 +0300] "GET /apirest.php/initSession HTTP/1.1" 400 184 "http://grafana.domain:3000/datasources/edit/5" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
192.168.80.30 - - [26/Jun/2017:15:53:36 +0300] "GET /apirest.php/initSession HTTP/1.1" 400 184 "http://grafana.domain:3000/datasources/edit/5" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
192.168.80.30 - - [26/Jun/2017:15:53:40 +0300] "GET /apirest.php/initSession HTTP/1.1" 400 184 "http://grafana.domain:3000/datasources/edit/5" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

I mean logs for GLPI, not Grafana ;)

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

I see the error, I'm working on a fix ;)

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

So no it works :p fine

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

I have a problem with my glpi (dev version not up-to-date), so now it works on last grfana and on GLPI 9.1 and dev (9.2), so I think you have a configuration problem somewhere.... perhaps allow headers in you webserver deliver GLPI

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

9.1.x works, so 9.1.4 works too :p

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

but I have not worked =(

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

192.168.80.30 - - [27/Jun/2017:17:51:39 +0300] "GET /apirest.php/initSession HTTP/1.1" 400 184 "http://grafana.hub.domain:3000/datasources/edit/5" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"

log on the web server glpi

`192.168.80.30 - this is the address where the message (from the server grafana)

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Perhaps your webserver not allow CORS, it's required to work

from glpi_app_grafana.

Smiley-k avatar Smiley-k commented on July 24, 2024

I don't know what to do to make it work
setting CORS done, but not working.

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

See the API page, http://yourglpi_url/apirest.php and you have all information at the end

from glpi_app_grafana.

fulljackz avatar fulljackz commented on July 24, 2024

Hi there,

I am running GLPI 9.1.4 with Apache 2.4.10 on Debian 8 from a side, and Grafana 4.4.3 with Apache on Debian 9 on another side.

I can't get your dashboard working with my current configuration. I looked at apirest.php, especially at the end, and no information about cors or apache headers.

My problem is probably linked with #3 but I can't find an issue to it.

Could you post a webserver conf example pls ?

Thanks !

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

For nginx:

    server {
        listen       80;

        location / {
            root   /usr/local/www/nginx;
            index  index.php index.html index.htm;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

        more_set_headers 'Access-Control-Allow-Origin: *';
        more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE';
        more_set_headers 'Access-Control-Allow-Credentials: true';
        more_set_headers 'Access-Control-Allow-Headers: Origin,Content-Type,Accept,Authorization,App-Token,Session-Token';

        location /api {
             rewrite ^/api/(.*)$ /apirest.php/$1 last;
        }
 

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ [^/]\.php(/|$) {
            client_max_body_size 20M;
            root           html;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  HTTP_REFERER $http_referer;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/nginx$fastcgi_script_name;
            include        fastcgi_params;
            fastcgi_param  SERVER_NAME      $host;
             
            set $path_info $fastcgi_path_info;
            fastcgi_param  PATH_INFO $path_info;
        }
    }

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Thanks ;)

from glpi_app_grafana.

ppierref avatar ppierref commented on July 24, 2024

I always get this error message
image

image

GLPI 9.2
Debian 9 - 64x
PHP 7.0.19-1
Apache/2.4.25

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Open the web developper part of your browser and in network part, wee the url of your GLPI called by grafana

from glpi_app_grafana.

ppierref avatar ppierref commented on July 24, 2024

errografana
erro grafana

Do I need to edit any files? How should I proceed - Apache/2.4.25

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

See #1 (comment)

with this modification, you need too have in httpd.conf the AllowOverride All to allow the use of the .htaccess

from glpi_app_grafana.

ppierref avatar ppierref commented on July 24, 2024

Problem continues :'(
Even with version 9.1.4 of GLPI and Apache Server
image
image

from glpi_app_grafana.

ppierref avatar ppierref commented on July 24, 2024

Thanks ddurieux
img1
img2
img3
img4

from glpi_app_grafana.

ppierref avatar ppierref commented on July 24, 2024

Insert lines in the file
#vim /etc/apache2/sites-enabled/000-default.conf

<IfModule headers_module>
  Header set Access-Control-Allow-Origin "*"
  Header set Access-Control-Allow-Methods "GET, HEAD, POST, OPTIONS, PUT, DELETE"
  Header set Access-Control-Allow-Credentials "true"
  Header set Access-Control-Allow-Headers "Origin,Content-Type,Accept,Authorization,App-Token,Session-Token,Access-Control-Request-Headers"
</IfModule>

Loaded module on apache
#sudo a2enmod headers

Restart service Apache
#sudo service apache2 restart

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Very good news ^^

from glpi_app_grafana.

siccbr avatar siccbr commented on July 24, 2024

Hello,

In spite of your explanations, I modified the set of configuration files but I still have the same error message.
In live mode it gives this:
,
capture

The conf file is the follower (centos distribution for the GLPI and a debian for the grafana)

capture

I also have an error message when I put in proxy mode:
while I have GLPI I have indicated my ip

capture

I thank you for the valuable help you can give me. Have a good day

PS:
Excuse me if there are spelling mistakes, I'm french

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

In GLPI, in menu Setup > General, in tab API, you need modify the range IP allowed to access to GLPI. The message say, your IP not allowed (by default only 127.0.0.1 allowed).

from glpi_app_grafana.

siccbr avatar siccbr commented on July 24, 2024

Thank you for the speed of the answer but I indicated the range of address without result

capture

Ci dessous un exemple de configuration

capture

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Seems ok, to be sure, the app_token is not the same for full access from localhost and mon glpi2 ? if yes, you will have problem, so perhaps try disable them

from glpi_app_grafana.

allancarlosvr avatar allancarlosvr commented on July 24, 2024

My problem is the same with @siccbr , But in my inspection of code i see this it. Anyone can help me?
capturar

angular.js:12759 Mixed Content: The page at 'https://monitor.sumicity.net.br/datasources/edit/18' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://10.99.1.121/apirest.php/initSession'. This request has been blocked; the content must be served over HTTPS.

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Seems your grafana in https and your GLPI api in http or invert (not sure). you can't mix both, so put all in http or all in https

from glpi_app_grafana.

allancarlosvr avatar allancarlosvr commented on July 24, 2024

Thanks @ddurieux ! i changed my GLPI for 'https' and that's all right! Sucess!

I connected in my GLPI with Grafana

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

nice ^^ enjoy now ;)

from glpi_app_grafana.

allancarlosvr avatar allancarlosvr commented on July 24, 2024

I included a valid certificate for Https (443) but, the GLPI API dont receive information, with error sync.

Please, look the error in image attached
errografana

from glpi_app_grafana.

klmj avatar klmj commented on July 24, 2024

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

Any news?

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

I close, if required, open a new issue ;)

from glpi_app_grafana.

ilsonbaltazar avatar ilsonbaltazar commented on July 24, 2024

Hi, my integration between grafana and GLPI is working, but when I starts the integration, the glpi user changes his status to: Active = no at GLPI and consequently the conection stops . Have you alredy see this problem? Tks
sh_55 23-oct 10 31

from glpi_app_grafana.

ilsonbaltazar avatar ilsonbaltazar commented on July 24, 2024

Thanks @ddurieux. Could you pass me how I change this configuration to manual?

from glpi_app_grafana.

will1402 avatar will1402 commented on July 24, 2024

good night
I'm having trouble setting up glpi and grafana
is returning the following error

Cross-Origin Request Blocked: add right headers in your apache/nginx like 'App-Token' and 'Session-Token'

I'm using Grafana v5.4.3 (6539180) and GLPI 9.3.3 - on Centos7 server and httpd

I've already altered httpd.conf as directed, but I still get the message, any tips on what to do?

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

See messages of this topic, there is information. If not works, check webserver logs to see if you have errors

from glpi_app_grafana.

ddurieux avatar ddurieux commented on July 24, 2024

You have a 401, so check the web server logs / GLPI logs

from glpi_app_grafana.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.