Go to file
Patryk Gudalewicz d5f7976967 Readme formatting 2022-07-26 14:45:05 +02:00
.gitignore Added auto-deletion of unused dashboards 2022-07-26 14:41:12 +02:00
createDash.py Added auto-deletion of unused dashboards 2022-07-26 14:41:12 +02:00
environment.yaml Added auto-deletion of unused dashboards 2022-07-26 14:41:12 +02:00
readme.md Readme formatting 2022-07-26 14:45:05 +02:00
requirements.txt Added auto-deletion of unused dashboards 2022-07-26 14:41:12 +02:00
slo_parameter.yaml initial commit 2022-07-25 13:42:53 +02:00

readme.md

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.

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

Usage

python createDash.py [-h] [-R ROWS] [--auto-upload]

options:
-h, --help            show 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)

Files

slo_parameter.yaml

This file specifies which SLO should be presented on the dashboard with the required metadata. Example definition:

TP_Mobile_Login:
	index: 1
	selector_type: "text"
	selector_var: 'CoCo-QM-Report_Mobile'
	yearstart: "2022-01-01"
	displayname: "Login"
	department: "DE-442"
	metric: "func:slo.tp_mobile_login"
	doc_url: "https://atc.bmwgroup.net/confluence/x/R1OqdQ"
	ops_dashboard:
		emea: "https"
		na: ""
		cn: ""
	hubs:
		euprod:
			tiles: ["actual","graph","ytd"]
		naprod:
			tiles: ["actual","graph","ytd"]
		cnprod:
			tiles: ["actual","graph","ytd"]
thresholds:
	single_value: "99_#577025|98_#f5d30f|0_#ff0000"
	graph_value: "99_#353535|98_#f5d30f|0_#ff0000"

Defintion Description:

SLO_Name:
		index: int 					#Ordering of the given SLO within the dashboard
		selector_type: str	 		#Query Parameter for Dynatrace
		selector_var: str 			#Query String for Dynatrace
		yearstart: date				#Date in "2022-01-01" format, to specify year-to-date start date
		displayname: str			#Display name of the SLO to be displayed on the dashboard
		department: str				#Department, responsible for this SLO
		metric: str					#Dynatrace metric selector 
		doc_url: str				#URL of the SLO documentation within Confluence
		ops_dashboard: 				#URLs of sub-dashboards per hub
			emea: "https"
			na: ""
			cn: ""
		hubs:						#defines on which hub this SLO is active
			euprod:
				tiles: array		#tiles which should be displayed for a specific hub
			naprod:
				tiles: 
			cnprod:
				tiles: 
	thresholds:
		single_value: str 		#thresholds and coloring for single value tiles
		graph_value: str			#thresholds and coloring for graph tiles

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

requirements.txt

File containing required python packages