@itentialopensource/adapter-datadog 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTH.md +15 -18
- package/BROKER.md +31 -19
- package/CHANGELOG.md +8 -0
- package/TAB2.md +19 -22
- package/metadata.json +11 -6
- package/package.json +4 -4
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +4 -4
- package/sampleProperties.json +4 -4
- package/test/integration/adapterTestConnectivity.js +0 -24
- package/test/unit/adapterTestUnit.js +2 -2
package/AUTH.md
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
## Authenticating Datadog Adapter
|
|
2
2
|
|
|
3
|
-
This document will go through the steps for authenticating the Datadog adapter with
|
|
3
|
+
This document will go through the steps for authenticating the Datadog adapter with Static Token Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Companies periodically change authentication methods to provide better security. As this happens this section should be updated and contributed/merge back into the adapter repository.
|
|
6
|
+
|
|
7
|
+
### Static Token Authentication
|
|
8
|
+
The Datadog adapter requires Static Token Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
|
|
7
9
|
|
|
8
10
|
STEPS
|
|
9
11
|
1. Ensure you have access to a Datadog server and that it is running
|
|
10
12
|
2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
|
|
11
|
-
3. Use the properties below for the ```properties.authentication``` field
|
|
13
|
+
3. Datadog API use two different types of bearer tokens, an organization-wide token or a user-specific API Key. Use the properties below for the ```properties.authentication``` field
|
|
12
14
|
```json
|
|
13
15
|
"authentication": {
|
|
14
|
-
"auth_method": "
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"token_cache": "local",
|
|
20
|
-
"invalid_token_error": 401,
|
|
21
|
-
"auth_field": "header.headers.Authorization",
|
|
22
|
-
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
23
|
-
"auth_logging": false,
|
|
24
|
-
"client_id": "",
|
|
25
|
-
"client_secret": "",
|
|
26
|
-
"grant_type": ""
|
|
16
|
+
"auth_method": "static_token",
|
|
17
|
+
"token": "<user_api_key>",
|
|
18
|
+
"auth_field": "header.headers.DD-API-KEY",
|
|
19
|
+
"auth_field_format": "{token}",
|
|
20
|
+
"auth_logging": false
|
|
27
21
|
}
|
|
28
22
|
```
|
|
23
|
+
you can leave all of the other properties in the authentication section, they will not be used for static token authentication.
|
|
24
|
+
|
|
29
25
|
4. Restart the adapter. If your properties were set correctly, the adapter should go online.
|
|
30
26
|
|
|
31
27
|
### Troubleshooting
|
|
32
|
-
- Make sure you copied over the correct
|
|
28
|
+
- Make sure you copied over the correct Org Token and User API Key.
|
|
33
29
|
- Turn on debug level logs for the adapter in IAP Admin Essentials.
|
|
34
30
|
- Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
|
|
35
31
|
- Investigate the logs - in particular:
|
|
36
32
|
- The FULL REQUEST log to make sure the proper headers are being sent with the request.
|
|
37
33
|
- The FULL BODY log to make sure the payload is accurate.
|
|
38
34
|
- The CALL RETURN log to see what the other system is telling us.
|
|
35
|
+
- Credentials should be ** masked ** by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
|
|
39
36
|
- Remember when you are done to turn auth_logging off as you do not want to log credentials.
|
package/BROKER.md
CHANGED
|
@@ -22,18 +22,25 @@ Below is an example of how you may set up the properties for this call.
|
|
|
22
22
|
{
|
|
23
23
|
"path": "/{org}/get/devices",
|
|
24
24
|
"method": "GET",
|
|
25
|
+
"pagination": {
|
|
26
|
+
"offsetVar": "",
|
|
27
|
+
"limitVar": "",
|
|
28
|
+
"incrementBy": "limit",
|
|
29
|
+
"requestLocation": "query"
|
|
30
|
+
},
|
|
25
31
|
"query": {},
|
|
26
32
|
"body": {},
|
|
27
33
|
"headers": {},
|
|
28
34
|
"handleFailure": "ignore",
|
|
35
|
+
"responseDataKey": "",
|
|
29
36
|
"requestFields": {
|
|
30
37
|
"org": "555"
|
|
31
38
|
},
|
|
32
39
|
"responseFields": {
|
|
33
|
-
"name": "
|
|
34
|
-
"ostype": "
|
|
40
|
+
"name": "{hostField}",
|
|
41
|
+
"ostype": "{osField}",
|
|
35
42
|
"ostypePrefix": "system-",
|
|
36
|
-
"ipaddress": "attributes.ipaddr",
|
|
43
|
+
"ipaddress": "{attributes.ipaddr}",
|
|
37
44
|
"port": "443"
|
|
38
45
|
}
|
|
39
46
|
},
|
|
@@ -44,16 +51,17 @@ Below is an example of how you may set up the properties for this call.
|
|
|
44
51
|
"body": {},
|
|
45
52
|
"headers": {},
|
|
46
53
|
"handleFailure": "ignore",
|
|
54
|
+
"responseDataKey": "",
|
|
47
55
|
"requestFields": {
|
|
48
56
|
"org": "777"
|
|
49
57
|
},
|
|
50
58
|
"responseFields": {
|
|
51
|
-
"name": "
|
|
52
|
-
"ostype": "
|
|
59
|
+
"name": "{hostField}",
|
|
60
|
+
"ostype": "{osField}",
|
|
53
61
|
"ostypePrefix": "system-",
|
|
54
|
-
"ipaddress": "attributes.ipaddr",
|
|
62
|
+
"ipaddress": "{attributes.ipaddr}",
|
|
55
63
|
"port": "443",
|
|
56
|
-
"myorg": "
|
|
64
|
+
"myorg": "{orgField}"
|
|
57
65
|
}
|
|
58
66
|
}
|
|
59
67
|
]
|
|
@@ -88,12 +96,13 @@ Below is an example of how you may set up the properties for this call.
|
|
|
88
96
|
"headers": {},
|
|
89
97
|
"handleFailure": "ignore",
|
|
90
98
|
"statusValue": "online",
|
|
99
|
+
"responseDataKey": "",
|
|
91
100
|
"requestFields": {
|
|
92
|
-
"org": "myorg",
|
|
93
|
-
"id": "name"
|
|
101
|
+
"org": "{myorg}",
|
|
102
|
+
"id": "{name}"
|
|
94
103
|
},
|
|
95
104
|
"responseFields": {
|
|
96
|
-
"status": "status"
|
|
105
|
+
"status": "{status}"
|
|
97
106
|
}
|
|
98
107
|
}
|
|
99
108
|
]
|
|
@@ -129,9 +138,10 @@ Below is an example of how you may set up the properties for this call.
|
|
|
129
138
|
"body": {},
|
|
130
139
|
"headers": {},
|
|
131
140
|
"handleFailure": "ignore",
|
|
141
|
+
"responseDataKey": "",
|
|
132
142
|
"requestFields": {
|
|
133
|
-
"org": "myorg",
|
|
134
|
-
"id": "name"
|
|
143
|
+
"org": "{myorg}",
|
|
144
|
+
"id": "{name}"
|
|
135
145
|
}
|
|
136
146
|
"responseFields": {}
|
|
137
147
|
},
|
|
@@ -142,8 +152,9 @@ Below is an example of how you may set up the properties for this call.
|
|
|
142
152
|
"body": {},
|
|
143
153
|
"headers": {},
|
|
144
154
|
"handleFailure": "ignore",
|
|
155
|
+
"responseDataKey": "",
|
|
145
156
|
"requestFields": {
|
|
146
|
-
"org": "myorg"
|
|
157
|
+
"org": "{myorg}"
|
|
147
158
|
}
|
|
148
159
|
"responseFields": {}
|
|
149
160
|
}
|
|
@@ -178,17 +189,18 @@ Below is an example of how you may set up the properties for this call.
|
|
|
178
189
|
"body": {},
|
|
179
190
|
"headers": {},
|
|
180
191
|
"handleFailure": "ignore",
|
|
192
|
+
"responseDataKey": "",
|
|
181
193
|
"requestFields": {
|
|
182
|
-
"org": "myorg",
|
|
183
|
-
"id": "name"
|
|
194
|
+
"org": "{myorg}",
|
|
195
|
+
"id": "{name}"
|
|
184
196
|
},
|
|
185
197
|
"responseFields": {
|
|
186
|
-
"name": "
|
|
187
|
-
"ostype": "
|
|
198
|
+
"name": "{hostField}",
|
|
199
|
+
"ostype": "{osField}",
|
|
188
200
|
"ostypePrefix": "system-",
|
|
189
|
-
"ipaddress": "attributes.ipaddr",
|
|
201
|
+
"ipaddress": "{attributes.ipaddr}",
|
|
190
202
|
"port": "443",
|
|
191
|
-
"myorg": "
|
|
203
|
+
"myorg": "{orgField}"
|
|
192
204
|
}
|
|
193
205
|
}
|
|
194
206
|
]
|
package/CHANGELOG.md
CHANGED
package/TAB2.md
CHANGED
|
@@ -11,42 +11,39 @@
|
|
|
11
11
|
## Specific Adapter Information
|
|
12
12
|
### Authentication
|
|
13
13
|
|
|
14
|
-
This document will go through the steps for authenticating the Datadog adapter with
|
|
14
|
+
This document will go through the steps for authenticating the Datadog adapter with Static Token Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
Companies periodically change authentication methods to provide better security. As this happens this section should be updated and contributed/merge back into the adapter repository.
|
|
17
|
+
|
|
18
|
+
#### Static Token Authentication
|
|
19
|
+
The Datadog adapter requires Static Token Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
|
|
18
20
|
|
|
19
21
|
STEPS
|
|
20
22
|
1. Ensure you have access to a Datadog server and that it is running
|
|
21
23
|
2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
|
|
22
|
-
3. Use the properties below for the ```properties.authentication``` field
|
|
24
|
+
3. Datadog API use two different types of bearer tokens, an organization-wide token or a user-specific API Key. Use the properties below for the ```properties.authentication``` field
|
|
23
25
|
```json
|
|
24
26
|
"authentication": {
|
|
25
|
-
"auth_method": "
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"token_cache": "local",
|
|
31
|
-
"invalid_token_error": 401,
|
|
32
|
-
"auth_field": "header.headers.Authorization",
|
|
33
|
-
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
34
|
-
"auth_logging": false,
|
|
35
|
-
"client_id": "",
|
|
36
|
-
"client_secret": "",
|
|
37
|
-
"grant_type": ""
|
|
27
|
+
"auth_method": "static_token",
|
|
28
|
+
"token": "<user_api_key>",
|
|
29
|
+
"auth_field": "header.headers.DD-API-KEY",
|
|
30
|
+
"auth_field_format": "{token}",
|
|
31
|
+
"auth_logging": false
|
|
38
32
|
}
|
|
39
33
|
```
|
|
34
|
+
you can leave all of the other properties in the authentication section, they will not be used for static token authentication.
|
|
35
|
+
|
|
40
36
|
4. Restart the adapter. If your properties were set correctly, the adapter should go online.
|
|
41
37
|
|
|
42
38
|
#### Troubleshooting
|
|
43
|
-
- Make sure you copied over the correct
|
|
39
|
+
- Make sure you copied over the correct Org Token and User API Key.
|
|
44
40
|
- Turn on debug level logs for the adapter in IAP Admin Essentials.
|
|
45
41
|
- Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
|
|
46
42
|
- Investigate the logs - in particular:
|
|
47
43
|
- The FULL REQUEST log to make sure the proper headers are being sent with the request.
|
|
48
44
|
- The FULL BODY log to make sure the payload is accurate.
|
|
49
45
|
- The CALL RETURN log to see what the other system is telling us.
|
|
46
|
+
- Credentials should be ** masked ** by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
|
|
50
47
|
- Remember when you are done to turn auth_logging off as you do not want to log credentials.
|
|
51
48
|
|
|
52
49
|
### Sample Properties
|
|
@@ -67,15 +64,15 @@ Sample Properties can be used to help you configure the adapter in the Itential
|
|
|
67
64
|
"stub": true,
|
|
68
65
|
"protocol": "https",
|
|
69
66
|
"authentication": {
|
|
70
|
-
"auth_method": "
|
|
67
|
+
"auth_method": "static_token",
|
|
71
68
|
"username": "username",
|
|
72
69
|
"password": "password",
|
|
73
|
-
"token": "",
|
|
70
|
+
"token": "token",
|
|
74
71
|
"token_timeout": 180000,
|
|
75
72
|
"token_cache": "local",
|
|
76
73
|
"invalid_token_error": 401,
|
|
77
|
-
"auth_field": "header.headers.
|
|
78
|
-
"auth_field_format": "
|
|
74
|
+
"auth_field": "header.headers.DD-API-KEY",
|
|
75
|
+
"auth_field_format": "{token}",
|
|
79
76
|
"auth_logging": false,
|
|
80
77
|
"client_id": "",
|
|
81
78
|
"client_secret": "",
|
package/metadata.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapter-datadog",
|
|
3
3
|
"webName": "Adapter for Integration to Datadog",
|
|
4
|
+
"supportLevel": "community",
|
|
4
5
|
"vendor": "Datadog",
|
|
5
6
|
"product": "Datadog",
|
|
7
|
+
"techAlliance": false,
|
|
6
8
|
"osVersion": [],
|
|
7
9
|
"apiVersions": [
|
|
8
10
|
"1.0.0"
|
|
@@ -30,12 +32,17 @@
|
|
|
30
32
|
"isDeprecated": false
|
|
31
33
|
},
|
|
32
34
|
"brokerSince": "",
|
|
33
|
-
"authMethods": [
|
|
35
|
+
"authMethods": [
|
|
36
|
+
{
|
|
37
|
+
"type": "API Key",
|
|
38
|
+
"primary": true
|
|
39
|
+
}
|
|
40
|
+
],
|
|
34
41
|
"documentation": {
|
|
35
42
|
"storeLink": "",
|
|
36
43
|
"npmLink": "https://www.npmjs.com/package/@itentialopensource/adapter-datadog",
|
|
37
|
-
"repoLink": "https://gitlab.com/itentialopensource/adapters/
|
|
38
|
-
"docLink": "https://
|
|
44
|
+
"repoLink": "https://gitlab.com/itentialopensource/adapters/adapter-datadog",
|
|
45
|
+
"docLink": "https://gitlab.com/itentialopensource/adapters/adapter-datadog/-/blob/master/README.md?ref_type=heads",
|
|
39
46
|
"demoLinks": [],
|
|
40
47
|
"trainingLinks": [
|
|
41
48
|
{
|
|
@@ -67,7 +74,5 @@
|
|
|
67
74
|
"workflowProjects": [],
|
|
68
75
|
"transformationProjects": [],
|
|
69
76
|
"exampleProjects": []
|
|
70
|
-
}
|
|
71
|
-
"supportLevel": "community",
|
|
72
|
-
"techAlliance": false
|
|
77
|
+
}
|
|
73
78
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-datadog",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "This adapter integrates with system: Datadog.",
|
|
5
5
|
"main": "adapter.js",
|
|
6
6
|
"systemName": "Datadog",
|
|
7
7
|
"wizardVersion": "2.44.7",
|
|
8
|
-
"engineVersion": "1.
|
|
8
|
+
"engineVersion": "1.68.2",
|
|
9
9
|
"adapterType": "http",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"artifactize": "npm i && node utils/packModificationScript.js",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"author": "Itential",
|
|
55
55
|
"homepage": "https://gitlab.com/itentialopensource/adapters/adapter-datadog#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@itentialopensource/adapter-utils": "^5.
|
|
57
|
+
"@itentialopensource/adapter-utils": "^5.7.0",
|
|
58
58
|
"acorn": "^8.12.1",
|
|
59
59
|
"ajv": "^8.17.1",
|
|
60
60
|
"axios": "^1.7.4",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"prompts": "^2.4.2",
|
|
70
70
|
"readline-sync": "^1.4.10",
|
|
71
71
|
"semver": "^7.6.3",
|
|
72
|
-
"winston": "^3.
|
|
72
|
+
"winston": "^3.14.2"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"chai": "^4.3.7",
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.9.3",
|
|
3
3
|
"configLines": 9391,
|
|
4
4
|
"scriptLines": 1783,
|
|
5
5
|
"codeLines": 15890,
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
6
|
+
"testLines": 13978,
|
|
7
|
+
"testCases": 748,
|
|
8
|
+
"totalCodeLines": 31651,
|
|
9
9
|
"wfTasks": 153
|
|
10
10
|
}
|
package/sampleProperties.json
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"stub": true,
|
|
15
15
|
"protocol": "https",
|
|
16
16
|
"authentication": {
|
|
17
|
-
"auth_method": "
|
|
17
|
+
"auth_method": "static_token",
|
|
18
18
|
"username": "username",
|
|
19
19
|
"password": "password",
|
|
20
|
-
"token": "",
|
|
20
|
+
"token": "token",
|
|
21
21
|
"token_timeout": 180000,
|
|
22
22
|
"token_cache": "local",
|
|
23
23
|
"invalid_token_error": 401,
|
|
24
|
-
"auth_field": "header.headers.
|
|
25
|
-
"auth_field_format": "
|
|
24
|
+
"auth_field": "header.headers.DD-API-KEY",
|
|
25
|
+
"auth_field_format": "{token}",
|
|
26
26
|
"auth_logging": false,
|
|
27
27
|
"client_id": "",
|
|
28
28
|
"client_secret": "",
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
/* eslint no-unused-vars: warn */
|
|
5
5
|
|
|
6
6
|
const assert = require('assert');
|
|
7
|
-
const http = require('http');
|
|
8
7
|
const https = require('https');
|
|
9
8
|
const mocha = require('mocha');
|
|
10
9
|
const ping = require('ping');
|
|
@@ -53,29 +52,6 @@ describe('[integration] Adapter Test', () => {
|
|
|
53
52
|
});
|
|
54
53
|
});
|
|
55
54
|
|
|
56
|
-
it('Support HTTP on port 80', (done) => {
|
|
57
|
-
const requestOptions = {
|
|
58
|
-
host,
|
|
59
|
-
port: 80,
|
|
60
|
-
method: 'HEAD'
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const req = http.request(requestOptions, (res) => {
|
|
64
|
-
try {
|
|
65
|
-
assert.ok(res.statusCode >= 200 && res.statusCode < 400);
|
|
66
|
-
done();
|
|
67
|
-
} catch (error) {
|
|
68
|
-
done(error);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
req.on('error', (err) => {
|
|
73
|
-
done(err);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
req.end();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
55
|
it('Support HTTPS on port 443', (done) => {
|
|
80
56
|
const requestOptions = {
|
|
81
57
|
host,
|
|
@@ -323,7 +323,7 @@ describe('[unit] Datadog Adapter Test', () => {
|
|
|
323
323
|
assert.equal('^0.4.4', packageDotJson.dependencies.ping);
|
|
324
324
|
assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
|
|
325
325
|
assert.equal('^7.6.3', packageDotJson.dependencies.semver);
|
|
326
|
-
assert.equal('^3.
|
|
326
|
+
assert.equal('^3.14.2', packageDotJson.dependencies.winston);
|
|
327
327
|
done();
|
|
328
328
|
} catch (error) {
|
|
329
329
|
log.error(`Test Failure: ${error}`);
|
|
@@ -561,7 +561,7 @@ describe('[unit] Datadog Adapter Test', () => {
|
|
|
561
561
|
log.error(`Adapter Exception: ${error}`);
|
|
562
562
|
done(error);
|
|
563
563
|
}
|
|
564
|
-
});
|
|
564
|
+
}).timeout(attemptTimeout);
|
|
565
565
|
});
|
|
566
566
|
|
|
567
567
|
describe('propertiesSchema.json', () => {
|