You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ad-Hoc Python script that syncs Synthetic nodes to locations based on metadata
1
+
<h4align="center">
2
+
<imgalt="header pic"src="src/dynatrace_logo.png">
3
+
</h4>
4
+
5
+
# Dynatrace Private Synthetic Locations Sync
6
+
7
+
8
+
At the moment, Dynatrace does not support any sembience of linking a private synthetics agent to a 'location' at runtime - this is a huge problem in a majority of cases (including where you run these sort of agents in a scaled manner, each Private instance you scale out to must be manually registered to a location, which is both annoying and problematic at scale)
9
+
10
+
this script was made to attempt to combat that, and allows for Private Synthetics Locations to be automatically updated and definedbased on specific metadata that the node reports in the [**Synthetic Node API**](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/synthetic/synthetic-nodes/get-node/) - Today this includes
11
+
12
+
- IP Block type (E.g. IP Prefix)
13
+
- Synthetic Node Name
14
+
15
+
## Quickstart
16
+
17
+
By default, the script expects the following
18
+
- Environment Variables `dynatracetoken` and `dynatracetenant` are set
19
+
- Proper metadata provided in the `locations` folder exists
20
+
21
+
a easy quickstart would be to define these locally, and run the example script
22
+
23
+
```bash
24
+
export dynatracetoken='mycooltoken'
25
+
export dynatracetenant='isa2131'
26
+
python3 locationsManager.py
27
+
```
28
+
29
+
## Adding/Removing Definitions
30
+
31
+
Definitions of a Private Synthetic Location group are managed within the 'locations' folder of this repository - when parsing through this folder the script will
32
+
- Fetch all files within the folder
33
+
- Dynamically pull 'SyntheticData' configuration from each folder
34
+
35
+
Definitions can be grouped in whatever way you wish, ideally i'd recommend grouping them based on 'environment' (so eng, nonp, and prod respectively)
36
+
37
+
```yaml
38
+
metadata:
39
+
# Dictates whether we parse over the file
40
+
Active: True
41
+
Name: "Production Location Metadata"
42
+
Type: ipBlock
43
+
44
+
syntheticData:
45
+
# Address we look for
46
+
- '172.16':
47
+
# Custom prefix name (only used in logging)
48
+
prefixName: 'Private 172 Address space'
49
+
# This is the Synthetic Location ID as it appears in the API
0 commit comments