JamesOsgood / mongodb-grafana

MongoDB plugin for Grafana
MIT License
463 stars 213 forks source link

Does this plugin support a containerized setup? #121

Open mohsen1565 opened 3 years ago

mohsen1565 commented 3 years ago

Hi James. I was wondering if we have setup the stack as 2 containers, namely: 1-Grafana instance 2- MongoDB instance Can we then still benefit from this solution? In the installation instructions, I see that one needs to be on the Grafana instance, inside the plugin directory to be able to proceed with the rest of the installation and npm needs to be installed there too. I was actually thinking of spinning up a third container (node) and run the proxy node server inside that instead. Does this solution support the latter setup? If yes, can you explain how? Many thanks in advance.

rumatar commented 3 years ago

+1

barisvelioglu commented 3 years ago

@mohsen1565

Exactly you can do what you mean. I already did that. I created a docker image to run mongodb grafana proxy as another container (https://hub.docker.com/repository/docker/barisv/grafana-mongo-proxy-server)

Then only thing you need to this to configure your mongo plugin to send request to those container.

mohsen1565 commented 3 years ago

@mohsen1565

Exactly you can do what you mean. I already did that. I created a docker image to run mongodb grafana proxy as another container (https://hub.docker.com/repository/docker/barisv/grafana-mongo-proxy-server)

Then only thing you need to this to configure your mongo plugin to send request to those container.

Hi there and thank you for your input. I have set it up like that exactly but it still wouldn't work. Any chance I can screenshare or send you code snippets to see how you did it. Or if you could possibly share yours....

barisvelioglu commented 3 years ago

@mohsen1565

This is output:

image

This is plugin configuration

image

This is kubernetes: image

I used port-forwarding for testing purposes


kubectl port-forward service/grafana 31002:80

If you cant solve your issue, we can look at it together. Please describe, what steps you did and whats the current problem ?

rumatar commented 2 years ago

@mohsen1565

Exactly you can do what you mean. I already did that. I created a docker image to run mongodb grafana proxy as another container (https://hub.docker.com/repository/docker/barisv/grafana-mongo-proxy-server)

Then only thing you need to this to configure your mongo plugin to send request to those container.

Can you please tell me how did you configure the pod with proxies? Need to pass mongo addresses through env?

glatiuden commented 2 years ago

@mohsen1565

This is output:

image

This is plugin configuration

image

This is kubernetes: image

I used port-forwarding for testing purposes


kubectl port-forward service/grafana 31002:80

If you cant solve your issue, we can look at it together. Please describe, what steps you did and whats the current problem ?

Hey there! Thank you so much for your solution. I currently have the Grafana and the MongoDB Proxy API pod running, would you be able to advise on how do I add the Proxy Pod (the mongodbproxy-api) as a data source? I'm a bit confused. I understand the non-containerized version requires me to copy it into the Grafana plugin folders, but I'm unsure about the containerized version. Thank you once again :)

rumatar commented 2 years ago

Hi all. I solved the issue by building my image of the grafana of the version I needed with the plugin integrated into it. Works great!

https://github.com/ajeje93/grafana-mongodb-docker

denef commented 1 year ago

So, here is how I do that:

  1. use image: grafana/grafana-oss with volumes: -./grafana-storage:/var/lib/grafana ENV GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=grafana-mongodb-datasource
  2. copy the plugin into grafana-storage/plugins restart Grafana
  3. launch the proxy container mentioned above mongoproxy image: barisv/grafana-mongo-proxy-server ports: - 3333:3333
  4. connect the datasource (go to plugins > mongoldb > add datasource)
  5. use http://monogoproxy:3333 as URL