stephenyeargin / hubot-grafana

📈🤖 Query Grafana dashboards
http://docs.grafana.org/tutorials/hubot_howto/
MIT License
154 stars 48 forks source link

Added ability to display garfs from local server #60

Closed Nothingtoloose closed 6 years ago

Nothingtoloose commented 7 years ago

I have added the ability to store graphs on the local web server. So you don't need Amazon S3 or Slack to see pictures in the chat.

The graphs are loaded using "Curl".

Nothingtoloose commented 7 years ago

Example

stephenyeargin commented 7 years ago

Thanks for putting this together. I see a few problems with the current approach, though:

Nothingtoloose commented 7 years ago

Most Hubot users are running their instance of the bot either on Heroku or a separate server from their Grafana instance. As such, the http://localhost default won't work -- this address only works if you are running the Hubot on your own machine.

That's right. A variable such as GRAFANA_HOST can help here. This can be used to create a URL like http://GRAFANA_HOST/pic.png

In any case, I would rather see the address to load the image as an optional environment variable. If detected, it would bypass the S3 and Slack upload function and return the image URL using the configured hostname/path combination. (You would want to configure both the directory the bot wrote the images to and the URL to use, as HTTP servers vary on their document roots)

I only gave out the image URL, because Mattermost only displays images if there is only one URL in the message. Therefore only this link.

The default behavior should remain to return a direct link to Grafana.

I like pictures :D

stephenyeargin commented 6 years ago

Going to close this one off, but it looks like you've been able to get it working for your needs. 👍