Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.9%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Dynatrace API Python client

Basic Info
  • Host: GitHub
  • Owner: dynatrace-oss
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 568 KB
Statistics
  • Stars: 65
  • Watchers: 8
  • Forks: 25
  • Open Issues: 2
  • Releases: 35
Created almost 6 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

dt - Dynatrace Python API Client

dt is a Python client for the Dynatrace Rest API.
It focuses on ease of use and nice type hints, perfect to explore the API and create quick scripts

Install

bash $ pip install dt

Simple Demo

```python from dynatrace import Dynatrace from dynatrace import TOOMANYREQUESTSWAIT from dynatrace.environmentv2.tokensapi import SCOPEMETRICSREAD, SCOPEMETRICSINGEST from dynatrace.configurationv1.credentialvault import PublicCertificateCredentials from dynatrace.environmentv2.settings import SettingsObject, SettingsObjectCreate

from datetime import datetime, timedelta

Create a Dynatrace client

dt = Dynatrace("environmenturl", "apitoken")

Create a client that handles too many requests (429)

dt = Dynatrace("environmenturl", "apitoken", toomanyrequestsstrategy=TOOMANYREQUESTSWAIT )

Create a client that automatically retries on errors, up to 5 times, with a 1 second delay between retries

dt = Dynatrace("environmenturl", "apitoken", retries=5, retrydelayms=1000 )

Create a client with a custom HTTP timeout of 10 seconds

dt = Dynatrace("environmenturl", "apitoken", timeout=10 )

Get all hosts and some properties

for entity in dt.entities.list('type("HOST")', fields="properties.memoryTotal,properties.monitoringMode"): print(entity.entityid, entity.displayname, entity.properties)

Get idle CPU for all hosts

for metric in dt.metrics.query("builtin:host.cpu.idle", resolution="Inf"): print(metric)

Print dimensions, timestamp and values for the AWS Billing Metric

for metric in dt.metrics.query("ext:cloud.aws.billing.estimatedChargesByRegionCurrency"): for data in metric.data: for timestamp, value in zip(data.timestamps, data.values): print(data.dimensions, timestamp, value)

Get all ActiveGates

for ag in dt.activegates.list(): print(ag)

Get metric descriptions for all host metrics

for m in dt.metrics.list("builtin:host.*"): print(m)

Delete endpoints that contain the word test

for plugin in dt.plugins.list():

# This could also be dt.get_endpoints(plugin.id)
for endpoint in plugin.endpoints:
    if "test" in endpoint.name:
        endpoint.delete(plugin.id)

Prints dashboard ID, owner and number of tiles

for dashboard in dt.dashboards.list(): fulldashboard = dashboard.getfulldashboard() print(fulldashboard.id, dashboard.owner, len(full_dashboard.tiles))

Delete API Tokens that haven't been used for more than 3 months

for token in dt.tokens.list(fields="+lastUsedDate,+scopes"): if token.lastuseddate and token.lastuseddate < datetime.now() - timedelta(days=90): print(f"Deleting token! {token}, last used date: {token.lastuseddate}")

Create an API Token that can read and ingest metrics

newtoken = dt.tokens.create("metricstoken", scopes=[SCOPEMETRICSREAD, SCOPEMETRICSINGEST]) print(new_token.token)

Upload a public PEM certificate to the Credential Vault

with open("ca.pem", "r") as f: ca_cert = f.read()

mycred = PublicCertificateCredentials( name="mycred", description="mycred description", scope="EXTENSION", owneraccessonly=False, certificate=cacert, password="", credentialtype="PUBLICCERTIFICATE", certificate_format="PEM" )

r = dt.credentials.post(my_cred) print(r.id)

Create a new settings 2.0 object

settingsvalue = { "enabled": True, "summary": "DT API TEST 1", "queryDefinition": { "type": "METRICKEY", "metricKey": "netapp.ontap.node.fru.state", "aggregation": "AVG", "entityFilter": { "dimensionKey": "dt.entity.netappontap:fru", "conditions": [], }, "dimensionFilter": [], }, "modelProperties": { "type": "STATICTHRESHOLD", "threshold": 100.0, "alertOnNoData": False, "alertCondition": "BELOW", "violatingSamples": 3, "samples": 5, "dealertingSamples": 5, }, "eventTemplate": { "title": "OnTap {dims:type} {dims:fruid} is in Error State", "description": "OnTap field replaceable unit (FRU) {dims:type} with id {dims:fruid} on node {dims:node} in cluster {dims:cluster} is in an error state.\n", "eventType": "RESOURCE", "davisMerge": True, "metadata": [], }, "eventEntityDimensionKey": "dt.entity.netapp_ontap:fru", }

settingsobject = SettingsObjectCreate(schemaid="builtin:anomaly-detection.metric-events", value=settingsvalue, scope="environment") dt.settings.createobject(validateonly=False, body=settingsobject) ```

Implementation Progress

Environment API V2

API | Level | Access | :----------------------------------------|:------------------:|:------------------------------------------| Access Tokens - API tokens | :heavycheckmark: | dt.tokens | Access tokens - Tenant tokens | :heavycheckmark: | dt.tenant_tokens | ActiveGates | :heavycheckmark: | dt.activegates | ActiveGates - Auto-update configuration | :heavycheckmark: | dt.activegates_autoupdate_configuration | ActiveGates - Auto-update jobs | :heavycheckmark: | dt.activegates_autoupdate_jobs | ActiveGates - Remote configuration | :heavycheckmark: | dt.activegates_remote_configuration | Audit Logs | :heavycheckmark: | dt.audit_logs | Events | :warning: | dt.events_v2 | Extensions 2.0 | :heavycheckmark: | dt.extensions_v2 | Logs | :warning: | dt.logs | Metrics | :heavycheckmark: | dt.metrics | Monitored entities | :warning: | dt.entities | Monitored entities - Custom tags | :heavycheckmark: | dt.custom_tags | Network zones | :warning: | dt.network_zones | OneAgents - Remote configuration | :heavycheckmark: | dt.oneagents_remote_configuration | Problems | :heavycheckmark: | dt.problems | Security problems | :x: | | Service-level objectives | :heavycheckmark: | dt.slos | Settings | :warning: | dt.settings |

Environment API V1

API | Level | Access | :--------------------------------------|:------------------:|:--------------------------------| Anonymization | :x: | | Cluster time | :heavycheckmark: | dt.cluster_time | Cluster version | :x: | | Custom devices | :heavycheckmark: | dt.custom_devices | Deployment | :heavycheckmark: | dt.deployment | Events | :warning: | dt.events | JavaScript tag management | :x: | | Log monitoring - Custom devices | :x: | | Log monitoring - Hosts | :x: | | Log monitoring - Process groups | :x: | | Maintenance window | :x: | | OneAgent on a host | :warning: | dt.oneagents | Problem | :x: | | Synthetic - Locations and nodes | :x: | | Synthetic - Monitors | :warning: | dt.synthetic_monitors | Synthetic - Third party | :heavycheckmark: | dt.third_part_synthetic_tests | Threshold | :x: | | Timeseries | :warning: | dt.timeseries | Tokens | :x: | | Topology & Smartscape - Application | :x: | | Topology & Smartscape - Custom device | :warning: | dt.custom_devices | Topology & Smartscape - Host | :warning: | dt.smartscape_hosts | Topology & Smartscape - Process | :x: | | Topology & Smartscape - Process group | :x: | | Topology & Smartscape - Service | :x: | | User sessions | :x: | |

Configuration API V1

API | Level | Access | :----------------------------------------------------|:------------------:|:--------------------------------------| Alerting Profiles | :warning: | dt.alerting_profiles | Anomaly detection - Applications | :x: | | Anomaly detection - AWS | :x: | | Anomaly detection - Database services | :x: | | Anomaly detection - Disk events | :x: | | Anomaly detection - Hosts | :x: | | Anomaly detection - Metric events | :warning: | dt.anomaly_detection_metric_events | Anomaly detection - Process groups | :warning: | dt.anomaly_detection_process_groups | Anomaly detection - Services | :x: | | Anomaly detection - VMware | :x: | | Automatically applied tags | :warning: | dt.auto_tags | AWS credentials configuration | :x: | | AWS PrivateLink | :x: | | Azure credentials configuration | :x: | | Calculated metrics - Log monitoring | :x: | | Calculated metrics - Mobile & custom applications | :x: | | Calculated metrics - Services | :x: | | Calculated metrics - Synthetic | :x: | | Calculated metrics - Web applications | :x: | | Cloud Foundry credentials configuration | :x: | | Conditional naming | :x: | | Credential vault | :x: | | Custom tags | :heavycheckmark: | dt.custom_tags | Dashboards | :warning: | dt.dashboards | Data privacy and security | :x: | | Extensions | :heavycheckmark: | dt.extensions | Frequent issue detection | :x: | | Kubernetes credentials configuration | :x: | | Maintenance windows | :warning: | dt.maintenance_windows | Management zones | :warning: | dt.management_zones | Notifications | :warning: | dt.notifications | OneAgent - Environment-wide configuration | :heavycheckmark: | dt.oneagents_config_environment | OneAgent in a host group | :heavycheckmark: | dt.oneagents_config_hostgroup | OneAgent on a host | :heavycheckmark: | dt.oneagents_config_host | Plugins | :warning: | dt.plugins | Remote environments | :x: | | Reports | :x: | | RUM - Allowed beacon origins for CORS | :x: | | RUM - Application detection rules | :x: | | RUM - Application detection rules - Host detection | :x: | | RUM - Content resources | :x: | | RUM - Geographic regions - custom client IP headers | :x: | | RUM - Geographic regions - IP address mapping | :x: | | RUM - Mobile and custom application configuration | :x: | | RUM - Web application configuration | :x: | | Service - Custom services | :x: | | Service - Detection full web request | :x: | | Service - Detection full web service | :x: | | Service - Detection opaque and external web request | :x: | | Service - Detection opaque and external web service | :x: | | Service - Failure detection parameter sets | :x: | | Service - Failure detection rules | :x: | | Service - IBM MQ tracing | :x: | | Service - Request attributes | :x: | | Service - Request naming | :x: | |

Owner

  • Name: Dynatrace Open Source
  • Login: dynatrace-oss
  • Kind: organization
  • Email: opensource@dynatrace.com

This organization contains Open Source projects maintained by Dynatrace. If not stated differently, these projects are not officially supported.

GitHub Events

Total
  • Create event: 10
  • Release event: 6
  • Issues event: 29
  • Watch event: 5
  • Delete event: 3
  • Member event: 3
  • Issue comment event: 35
  • Push event: 14
  • Pull request event: 17
  • Fork event: 4
Last Year
  • Create event: 10
  • Release event: 6
  • Issues event: 29
  • Watch event: 5
  • Delete event: 3
  • Member event: 3
  • Issue comment event: 35
  • Push event: 14
  • Pull request event: 17
  • Fork event: 4

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 385
  • Total Committers: 17
  • Avg Commits per committer: 22.647
  • Development Distribution Score (DDS): 0.623
Past Year
  • Commits: 33
  • Committers: 4
  • Avg Commits per committer: 8.25
  • Development Distribution Score (DDS): 0.424
Top Committers
Name Email Commits
dlopes7 d****s@g****m 145
Radu r****n@d****m 81
James Kitson j****n@d****m 53
James Kitson j****n@g****m 35
Vagiz Duseev v****v@d****m 19
Hashmi b****i@d****m 15
David Lopes d****s@d****m 14
Your Name y****u@e****m 11
Wouter Evolane w****r@e****u 4
Dynatrace-Jeroen-Hautekeete j****e@d****m 1
Nikolay Kitanov n****v@s****m 1
Tod Davies d****o@g****m 1
Victor Balbuena 3****p 1
sbricoutmac 1****c 1
Wouter De Troyer H****u@e****m 1
Timothy Haasdyk t****k@d****m 1
Karl Fischer k****r@r****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 32
  • Total pull requests: 86
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 15 days
  • Total issue authors: 18
  • Total pull request authors: 16
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.08
  • Merged pull requests: 79
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 17
  • Pull requests: 14
  • Average time to close issues: 15 days
  • Average time to close pull requests: 8 days
  • Issue authors: 7
  • Pull request authors: 4
  • Average comments per issue: 0.59
  • Average comments per pull request: 1.43
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • vduseev (9)
  • Dynatrace-Jeroen-Hautekeete (4)
  • JosephHobbs (3)
  • angrykirc (2)
  • ToTru (2)
  • danisorto (2)
  • gabrielprioli (1)
  • radu-stefan-dt (1)
  • leuduan (1)
  • myieye (1)
  • fishi0x01 (1)
  • rajeshmoyra22 (1)
  • rme2000 (1)
  • Dynatrace-James-Kitson (1)
  • kahoffman (1)
Pull Request Authors
  • Dynatrace-James-Kitson (29)
  • dlopes7 (16)
  • radu-stefan-dt (12)
  • vduseev (11)
  • jimm-with-a-j (10)
  • bilalhashmi-dt (5)
  • mark-dt (4)
  • fishi0x01 (2)
  • wouter-evolane (2)
  • mpmackenna (2)
  • vbalbp (1)
  • myieye (1)
  • Dynatrace-Jeroen-Hautekeete (1)
  • sbricoutmac (1)
  • nkitanov (1)
Top Labels
Issue Labels
bug (15) enhancement (13)
Pull Request Labels
enhancement (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 18,871 last-month
  • Total docker downloads: 247
  • Total dependent packages: 3
  • Total dependent repositories: 11
  • Total versions: 41
  • Total maintainers: 1
pypi.org: dt

Dynatrace API Python client

  • Versions: 41
  • Dependent Packages: 3
  • Dependent Repositories: 11
  • Downloads: 18,871 Last month
  • Docker Downloads: 247
Rankings
Docker downloads count: 2.3%
Dependent packages count: 2.3%
Dependent repos count: 4.4%
Average: 5.9%
Downloads: 6.8%
Forks count: 8.9%
Stargazers count: 10.5%
Maintainers (1)
Last synced: 10 months ago

Dependencies

requirements.txt pypi
  • requests >=2.22
requirements_dev.txt pypi
  • mock * development
  • pytest >=6.2.3 development
  • requests >=2.22 development
  • tox * development
  • wrapt ==1.12.1 development
setup.py pypi
  • requests >=2.22
.github/workflows/publish.yml actions
  • actions/checkout master composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish release/v1 composite
.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite