94 lines
4.0 KiB
Markdown
94 lines
4.0 KiB
Markdown
# Global Dashboard as Code
|
|
This repository holds the code to generate the Dynatrace Global Dashboard as Code.
|
|
|
|
The Global Dashboard splits in 2 different dashboards:
|
|
|
|
- STAGING
|
|
- PROD
|
|
While the PROD dashboard is adapted manually, the Staging dashboard is auto updated when this script runs.
|
|
|
|
# Dashboard Splitting
|
|
|
|
To enable flexibility for different screensizes, the script takes an -R or --ROWS parameter to define how many SLOs should be on one dedicated dashboard.
|
|
If left empty, only one dashboard will be created, if entered a row the dashboard will be splitted to multiple dashboards and uploaded with the following name: [STAGING]Global Offboard Reliability 2.0 - [Business line] #1 ..#2..#3
|
|
|
|
|
|
# shared configuration
|
|
This script is using the following shared configuration:
|
|
- slo_parameter.yaml --> https://atc.bmwgroup.net/bitbucket/projects/OPAPM/repos/shared_configuration/browse
|
|
|
|
# Archiving
|
|
Old artefacts (dashboard.json files) are archived within the following repository:
|
|
https://atc.bmwgroup.net/bitbucket/projects/OPAPM/repos/archive/browse
|
|
|
|
# Prerequisites
|
|
|
|
## Python packages
|
|
Before executing scripts, python requirements have to be satisfied. To do so, execute following command:
|
|
pip install -r requirements.txt
|
|
|
|
## .env file
|
|
|
|
To provide authentication for API calls, create ".env" file in the script directory with following definition:
|
|
|
|
<ENV NAME>=<ENV TOKEN>
|
|
<ENV NAME> is name of environment variable. This name should be passed to "environment.yaml" file as "env-token-name" parameter
|
|
Example:
|
|
environment.yaml file: "- env-token-name: "GLOBAL_CONFIG_TOKEN"
|
|
.env file: "GLOBAL_CONFIG_TOKEN=XXXXXXXXXXX"
|
|
BITBUCKET_USERNAME=<USERNAME>
|
|
<USERNAME> for bitbucket account with read access to shared_configuration repo and R/W access to archive repo
|
|
BITBUCKET_TOKEN=<TOKEN>
|
|
<TOKEN> personal access token for BITBUCKET_USERNAME with repo write permissions. For more information see https://confluence.atlassian.com/bitbucketserver0717/personal-access-tokens-1087535496.html?utm_campaign=in-app-help&utm_medium=in-app-help&utm_source=stash#Personalaccesstokens-usingpersonalaccesstokens
|
|
|
|
# Usage
|
|
|
|
usage: createDash.py [-h] [-R ROWS] [--auto-upload] [-D DEPARTMENT] [--wall]
|
|
|
|
Generate and deploy the Dynatrace Global Dashboard as Code. Auto deployment works only for STAGING dashboard
|
|
|
|
options:
|
|
-h, --help show this help message and exit
|
|
-R ROWS, --rows ROWS Number of rows per dashboard. If not specified, all rows will be added to single dashboard (default: None)
|
|
--auto-upload Auto upload to STAGING dashboard (default: False)
|
|
-D DEPARTMENT, --department DEPARTMENT
|
|
Define department for which the dashboard should be updated: 'DE-3', 'DE-7', 'DE-4' or 'EC-DE'. Leave empty or use 'ALL' if you want to generate 1
|
|
cumulated dashboard (default: ALL)
|
|
--wall By default script is generating desktop version. Use parameter to set dashboard generation to type 'Wall'. (default: False)
|
|
# Files
|
|
|
|
## createDash.py
|
|
|
|
This scripts generates the "tile" Section of a Dynatrace Dashboard and takes the slo_parameter.yaml as input parameter (no need to add it manually)
|
|
|
|
## environment.yaml
|
|
File containing environments to execute --auto-upload
|
|
|
|
Environment name:
|
|
name: string #name ov environment
|
|
env-url: str #url of environment
|
|
env-token-name: str #name of environment variable containing API token
|
|
## config.yaml
|
|
File containing script configuration, like visual config, metadata etc.
|
|
|
|
## dataExplorerTile.py
|
|
Library containing tile object definition for JSON parse purposes
|
|
|
|
## remoteDashboard.py
|
|
Library containing functions used to interact with Dynatrace Dashboard API
|
|
|
|
## repoConfig.py
|
|
Library containing functions used to interact with git repo
|
|
|
|
## sloConfigLoader.py
|
|
Library containing functions used to parse SLO yaml definition into object
|
|
|
|
## sloHelper.py
|
|
Library containing functions used to parse interact with SLO definitions
|
|
|
|
## tileFactory.py
|
|
Library containing functions used to generate tiles JSON definitions
|
|
|
|
## requirements.txt
|
|
|
|
File containing required python packages |