# 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 (https://jyy23483.live.dynatrace.com/#dashboard;gtf=defaultTimeFrame;gf=defaultManagementZone;id=2f1be2c6-9109-4e6b-8ec1-895be69935e3) - 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 - Touchpoint Mobile #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: = 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