-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnr-custom-event-eu-region.patch
31 lines (30 loc) · 1.19 KB
/
nr-custom-event-eu-region.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff --git a/PythonScripts/CustomEvents/py_post_event.py b/PythonScripts/CustomEvents/py_post_event.py
old mode 100644
new mode 100755
index 6779cdc..d2b0ce2
--- a/PythonScripts/CustomEvents/py_post_event.py
+++ b/PythonScripts/CustomEvents/py_post_event.py
@@ -11,8 +11,19 @@ print(event_data)
# Closing file
f.close()
-# US Event API endpoint. Note: You will need to your replace the XXXX with your New Relic Account Id
-us_endpoint = "https://insights-collector.newrelic.com/v1/accounts/XXXXX/events"
+# Note: Change this if you're using an EU account.
+use_eu_endpoint = False
+# Note: You will need to your replace the XXXX with your New Relic Account Id
+account_id = 'XXXX'
+
+# Event API endpoints.
+us_endpoint = f'https://insights-collector.newrelic.com/v1/accounts/{account_id}/events'
+eu_endpoint = f'https://insights-collector.eu01.nr-data.net/v1/accounts/{account_id}/events'
+
+endpoint = us_endpoint
+if use_eu_endpoint:
+ endpoint = eu_endpoint
+
headers = {'API-Key': f'{license_key}'}
-response = requests.post(us_endpoint, headers=headers, json=event_data)
-print(response)
\ No newline at end of file
+response = requests.post(endpoint, headers=headers, json=event_data)
+print(response)