Skip to content

xaviervalette/grafana-update-field-overrides

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grafana update field overrides

What is it ?

Python script to update field overrides on Grafana Dashboards via API

Before After
image image
Raw data from Meraki Dashboard, client MAC address displayed Custom fields added, client name displayed

Prerequisites

  • Grafana Dashboard
  • Grafana API key
  • List of field to overrides with the new value

Get started

  1. Clone or download this repo
git clone https://github.com/xaviervalette/grafana-update-field-overrides
  1. Install required packages
python3 -m pip install -r requirements.txt
  1. Add a config.yml file as follow:
└── meraki-network-event-log-collector/
+   ├── config.yml
    ├── ressources
    │   └── fieldOverrideTemplate.json
    └── src/
        ├── functions.py
        └── main.py  
  1. In the config.yml file, add the following variables:
#config.yml
---
api_key: "<grafanaApiKey>"
host: "<grafanaHost>"
dashboards:
- uid: "<firstDashboardUid>"
  folderUid: "<firstDashboardFolderUid>"
  fieldOverrides:
  - field: "<firstField>"
    name: "<firstFieldTargetName>"
#[...]
  - field: "<lastField>"
    name: "<lastFieldTargetName>"
#[...]
- uid: "<lastDashboardUid>"
  folderUid: "<lastDashboardFolderUid>"
  fieldOverrides:
  - field: "<firstField>"
    name: "<firstFieldTargetName>"
#[...]
  - field: "<lastField>"
    name: "<lastFieldTargetName>"
colorPalette:
- "#DFFF00"
#[...]
...

ⓘ You can add as many colors you want in the colorPalette list. Those colors will be use to override sequentially the field color

  1. Now you can run the code by using the following command:
python3 src/main.py

Output

The output should be as followed:

Dashboard <firstDashboardUid> overrides updated successfully
[...]
Dashboard <lastDashboardUid> overrides updated successfully

Example:

Dashboard UdGt5bb4z overrides updated successfully

About

Python script to update field overrides on Grafana Dashboards via API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages