The RESTful API for Synthetic-as-a-Service or SaaS that Dynatrace provides many features that allow to extract rich sets of data for the creation of custom reports and for report automation. Unfortunately the REST API does not offer a possibility to retrieve XF measurements for the account. Also I wanted a way to acquire screenshots from the charts that were created for the tests that were being created, so I decided to create a program that allows the user to retrieve XF Consumption measurement from an account as well as any account that is associated to the account (For example: An account may have several subaccounts in the GPN Portal) The program provides the ability to obtain the end-of-month projection measurements, the sum of xf measurements from specific dates, as well as monthly offsets. As of now these were the attributes that seemed most pressing for XF measurements. There is always a change for improvement
The following software needs to be installed
- python3
- selenium
- PIL
- For cropping charts
- phantomjs
- dateutil
- tqdm (Progress Bar for the commandline program)
####Ubuntu
sudo apt-get install phantomjs
####OS X
brew install phantomjs
####Windows
- On Windows, remember to have phantomjs.exe in PATH variables
Follow installation instructions for PhantomJS for your operating system. For Linux users, you will need to build PhantomJS. The instructions can be found here
pip3 install selenium # pip install selenium
pip3 install pillow # pip install pillow
pip3 install python-dateutil # pip install python-dateutil
pip3 install tqdm # pip install tqdm
# If git is installed
git clone https://github.com/josecolella/Dynatrace-Resources.git
cd Dynatrace-Resources
Add command line argument for execution of program
####GPN Portal
Have the ability to fetch XFMeasurements from various subaccounts
####Dynatrace Portal
Get cropping dimensions for performance map, since it is different than chartsHave the ability to crop out charts and performance map onlyAdd the ability to save to a directory specified by the user
This module provides various functionality the extract different type of information from the GPN Portal as well as the Dynatrace Portal
- Obtaining XF Consumption
import Portal
#username and password contain the appropriate GPN username and password
gpnPortal = Portal.GPNPortal(username, password)
gpnPortal.login()
xfConsumption = gpnPortal.getXFConsumption(startDay, endDay)
gpnPortal.close()
- Obtaining chart screenshot
import Portal
dtPortal = Portal.DynatraPortal(username, password)
dtPortal.login()
# Entire screen
dtPortal.saveChartToScreenshot(chartName="Home Page Response Time")
# Chart is cropped
dtPortal.saveChartToScreenshot(chartName="Transaction",cropChart=True)
dtPortal.close()