Grafana Integration Setup¶
This guide will walk you through steps to set up Grafana integration with the nautobot_chatops
App.
Prerequisites¶
Before configuring the integration, please ensure the following:
nautobot-chatops
App was installed with integration extra dependencies.nautobot-chatops
App is set up with at least one enabled chat platform and tested.- Grafana application installed and configured with dashboards and panels.
- Grafana Image Rendering Service installed.
- Grafana Image Rending App for Grafana installed in your Grafana application.
Command Setup¶
Create a top-level command named grafana
in your enabled chat platform. For detailed instructions related to your specific chat platform, refer to the platform specific set up.
Configuration¶
You must define the following values in your nautobot_config.py
file:
Configuration Setting | Mandatory? | Default | Notes | Available on Admin Config |
---|---|---|---|---|
enable_grafana |
Yes | False | Enable Grafana integration. | Yes |
grafana_url |
Yes | Base url that the Grafana application is hosted at. | No | |
grafana_api_key |
Yes | Found in <grafana_url>/org/apikeys . |
No | |
grafana_default_width |
0 | Grafana image width when rendered into the chat client. Default will render width dynamically. | No | |
grafana_default_height |
0 | Grafana image height when rendered into the chat client. Default will render height dynamically. | No | |
grafana_default_theme |
dark | Theme color to use when generating rendered Grafana images. Options are [dark , light ]. |
No | |
grafana_default_timespan |
0 | Timespan that data is collected on a panel in Grafana. Default action is to use the defined timespan in Grafana. | No | |
grafana_org_id |
1 | Found in <grafana_url>/admin/orgs . |
No | |
grafana_default_tz |
Timezone in which the renderer will render charts and graphs in. | No |
Note
Grafana API key only needs to have Viewer
permissions assigned!
Below is an example snippet from development/nautobot_config.py
that demonstrates how to enable and configure Grafana integration:
PLUGINS = ["nautobot_chatops"]
PLUGINS_CONFIG = {
"nautobot_chatops": {
...
"enable_grafana": True,
"grafana_url": os.environ.get("GRAFANA_URL", ""),
"grafana_api_key": os.environ.get("GRAFANA_API_KEY", ""),
"grafana_default_width": 0,
"grafana_default_height": 0,
"grafana_default_theme": "dark",
"grafana_default_timespan": "0",
"grafana_org_id": 1,
"grafana_default_tz": "America/Denver",
}
}
Upgrading from nautobot-plugin-chatops-grafana
App¶
Warning
When upgrading from nautobot-plugin-chatops-grafana
App, it's necessary to avoid conflicts.
- Uninstall the old App:
- Upgrade the App with required extras:
- Fix
nautobot_config.py
by removingnautobot_plugin_chatops_grafana
fromPLUGINS
and merging App configuration intonautobot_chatops
:PLUGINS = [ "nautobot_chatops", # "nautobot_plugin_chatops_grafana" # REMOVE THIS LINE ] PLUGINS_CONFIG = { # "nautobot_plugin_chatops_grafana": { REMOVE THIS APP CONFIGURATION # MOVE FOLLOWING LINES TO `nautobot_chatops` SECTION, PREFIX ENV VARIABLES WITH `GRAFANA_` # "grafana_url": os.environ.get("GRAFANA_URL", ""), # "grafana_api_key": os.environ.get("GRAFANA_API_KEY", ""), # "default_width": 0, # "default_height": 0, # "default_theme": "dark", # "default_timespan": "0", # "grafana_org_id": 1, # "default_tz": "America/Denver", # } "nautobot_chatops": { # Enable Grafana integration "enable_grafana": True, # Following line is moved from `nautobot_plugin_chatops_grafana` "grafana_url": os.environ.get("GRAFANA_URL", ""), "grafana_api_key": os.environ.get("GRAFANA_API_KEY", ""), "grafana_default_width": 0, "grafana_default_height": 0, "grafana_default_theme": "dark", "grafana_default_timespan": "0", "grafana_org_id": 1, "grafana_default_tz": "America/Denver", } }
Note
All environment variables for this integration are now prefixed with GRAFANA_
. Remember to update your environment variables depending on your deployment.