Skip to content

Commit 023d963

Browse files
[AI-4784] DDSaaS: Sonatype Nexus: Integration v1.0.0 (#19365)
* Initial Commit * Added changes in changelog.d folder * Added changes to resolve check failure * Removing images with invalid resolution * Adding images * updated images * Added relevant changes to the test files and agent code * Resolved linting error and modified minor integration info * Added changes to fix the pipeline * Added changes to resolve pipeline check * Added changes due to check failure * Added changes to fix pipeline failure * Added changes in instance.py file * Added changes as per few refactoring changes * Added formatting changes to fix checks * Added changes as per review comments * Added changes as per review comments * Changed http to https * Added changes in spec file to resolve pipeline stage failure * Added changes as per linting * Added linting changes * Added linting changes * Added changes in conf.yaml.example * Added changes to sorting the imports * Added changes as per pipeline failure * Added refactoring changes * Added vertical spaces * Added space * Added vertical space * Modified test cases * Resolved check failure error * Added a vertical space * Added changes as per e2e tests * Added changes as per review comments * Resolved linting error * added linting changes * linting changes * linting changes * Replaced saas-integrations with agent-integrations --------- Co-authored-by: DhruvaPatel-crest <dhruva.patel@crestdata.ai>
1 parent 9f203c5 commit 023d963

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3995
-0
lines changed

.codecov.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,10 @@ coverage:
582582
target: 75
583583
flags:
584584
- sonarqube
585+
sonatype_nexus:
586+
target: 75
587+
flags:
588+
- sonatype_nexus
585589
Spark:
586590
target: 75
587591
flags:
@@ -1492,6 +1496,11 @@ flags:
14921496
paths:
14931497
- sonarqube/datadog_checks/sonarqube
14941498
- sonarqube/tests
1499+
sonatype_nexus:
1500+
carryforward: true
1501+
paths:
1502+
- sonatype_nexus/datadog_checks/sonatype_nexus
1503+
- sonatype_nexus/tests
14951504
spark:
14961505
carryforward: true
14971506
paths:

.github/CODEOWNERS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ datadog_checks_base/datadog_checks/base/checks/windows/ @DataDog/wi
348348
/snowflake/pyproject.toml @DataDog/saas-integrations @DataDog/documentation @DataDog/agent-integrations
349349
/snowflake/manifest.json @DataDog/saas-integrations @DataDog/documentation
350350

351+
/sonatype_nexus/ @DataDog/agent-integrations
352+
/sonatype_nexus/*.md @DataDog/agent-integrations @DataDog/documentation
353+
/sonatype_nexus/manifest.json @DataDog/agent-integrations @DataDog/documentation
354+
/sonatype_nexus/metadata.csv @DataDog/agent-integrations @DataDog/documentation
355+
351356
/sonicwall_firewall/ @DataDog/saas-integrations
352357
/sonicwall_firewall/*.md @DataDog/saas-integrations @DataDog/documentation
353358
/sonicwall_firewall/manifest.json @DataDog/saas-integrations @DataDog/documentation

.github/workflows/config/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ integration/solr:
553553
- solr/**/*
554554
integration/sonarqube:
555555
- sonarqube/**/*
556+
integration/sonatype_nexus:
557+
- sonatype_nexus/**/*
556558
integration/sonicwall_firewall:
557559
- sonicwall_firewall/**/*
558560
integration/sophos_central_cloud:

.github/workflows/test-all.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3394,6 +3394,26 @@ jobs:
33943394
minimum-base-package: ${{ inputs.minimum-base-package }}
33953395
pytest-args: ${{ inputs.pytest-args }}
33963396
secrets: inherit
3397+
j3835902:
3398+
uses: ./.github/workflows/test-target.yml
3399+
with:
3400+
job-name: sonatype_nexus
3401+
target: sonatype_nexus
3402+
platform: linux
3403+
runner: '["ubuntu-22.04"]'
3404+
repo: "${{ inputs.repo }}"
3405+
python-version: "${{ inputs.python-version }}"
3406+
standard: ${{ inputs.standard }}
3407+
latest: ${{ inputs.latest }}
3408+
agent-image: "${{ inputs.agent-image }}"
3409+
agent-image-py2: "${{ inputs.agent-image-py2 }}"
3410+
agent-image-windows: "${{ inputs.agent-image-windows }}"
3411+
agent-image-windows-py2: "${{ inputs.agent-image-windows-py2 }}"
3412+
test-py2: ${{ inputs.test-py2 }}
3413+
test-py3: ${{ inputs.test-py3 }}
3414+
minimum-base-package: ${{ inputs.minimum-base-package }}
3415+
pytest-args: ${{ inputs.pytest-args }}
3416+
secrets: inherit
33973417
j529bc3b:
33983418
uses: ./.github/workflows/test-target.yml
33993419
with:

sonatype_nexus/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CHANGELOG - sonatype_nexus
2+
3+
<!-- towncrier release notes start -->

sonatype_nexus/README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
## Overview
2+
3+
Sonatype Nexus is a popular repository management solution designed for managing software components and dependencies across the entire software development lifecycle. It supports a wide range of development languages and formats, making it a central hub for DevOps and continuous integration/continuous delivery (CI/CD) pipelines.
4+
5+
The Sonatype Nexus integration collects analytics and instance health status metrics from Sonatype Nexus and sends them to Datadog for comprehensive analysis.
6+
7+
## Setup
8+
9+
### Installation
10+
11+
The Sonatype Nexus check is included in the [Datadog Agent package][1]. No additional installation is necessary.
12+
13+
### Get API credentials from Sonatype Nexus
14+
15+
1. The `Username` and `Password` of either the **Administrator** account or a user with the **nx-metrics-all** privilege
16+
17+
2. The `Server URL` of the Repository instance (for example, https://123.123.123.123:8081)
18+
19+
### Connect your Sonatype Nexus account to the agent
20+
21+
1. Copy the `conf.yaml.example` file.
22+
23+
```sh
24+
cp /etc/datadog-agent/conf.d/sonatype_nexus.d/conf.yaml.example /etc/datadog-agent/conf.d/sonatype_nexus.d/conf.yaml
25+
```
26+
27+
2. Edit the `/etc/datadog-agent/conf.d/sonatype_nexus.d/conf.yaml` file. Add the following configurations.
28+
29+
```yaml
30+
instances:
31+
32+
## @param username - string - required
33+
## Username of Sonatype Nexus instance
34+
#
35+
- username: <SONATYPE_NEXUS_USERNAME>
36+
37+
## @param password - string - required
38+
## Password of Sonatype Nexus instance
39+
#
40+
password: <SONATYPE_NEXUS_PASSWORD>
41+
42+
## @param server_url - string - required
43+
## Sonatype Nexus server url
44+
#
45+
server_url: <SONATYPE_NEXUS_SERVER_URL>
46+
47+
## @param min_collection_interval - number - required
48+
## This changes the collection interval of the check. For more information, see:
49+
## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval
50+
#
51+
min_collection_interval: 600
52+
```
53+
* Example for the `conf.yaml` when multiple instances of Sonatype Nexus are configured:
54+
55+
```yaml
56+
instances:
57+
- min_collection_interval: 1800
58+
username: <SONATYPE_NEXUS_USERNAME>
59+
password: <SONATYPE_NEXUS_PASSWORD>
60+
server_url: <SONATYPE_NEXUS_SERVER_URL>
61+
- min_collection_interval: 1800
62+
username: <SONATYPE_NEXUS_USERNAME>
63+
password: <SONATYPE_NEXUS_PASSWORD>
64+
server_url: <SONATYPE_NEXUS_SERVER_URL>
65+
```
66+
67+
3. [Restart the Agent][2].
68+
69+
### Validation
70+
71+
- [Run the Agent's status subcommand][3] and look for `sonatype_nexus` under the Checks section.
72+
73+
## Data Collected
74+
75+
### Logs
76+
The Sonatype Nexus integration does not include any logs.
77+
78+
### Metrics
79+
80+
The Sonatype Nexus integration collects and forwards analytics, and instance health status metrics to Datadog.
81+
82+
{{< get-metrics-from-git "sonatype_nexus" >}}
83+
84+
### Events
85+
86+
The Sonatype Nexus integration forwards the `sonatype_nexus.authentication_validation` event to Datadog.
87+
88+
### Service Checks
89+
90+
See [service_checks.json][6] for a list of service checks provided by this integration.
91+
92+
## Support
93+
94+
For further assistance, contact [Datadog support][4].
95+
96+
97+
[1]: https://app.datadoghq.com/account/settings/agent/latest
98+
[2]: https://docs.datadoghq.com/agent/guide/agent-commands/?tab=agentv6v7#start-stop-and-restart-the-agent
99+
[3]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information
100+
[4]: https://docs.datadoghq.com/help/
101+
[6]: https://github.com/DataDog/integrations-core/blob/master/sonatype_nexus/assets/service_checks.json
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: sonatype_nexus
2+
files:
3+
- name: sonatype_nexus.yaml
4+
options:
5+
- template: init_config
6+
options:
7+
- template: init_config/http
8+
- template: init_config/default
9+
- template: instances
10+
options:
11+
- name: username
12+
required: true
13+
description: "The username of your Sonatype Nexus account."
14+
value:
15+
type: string
16+
example: test_username
17+
- name: password
18+
required: true
19+
description: "The password of your Sonatype Nexus account."
20+
value:
21+
type: string
22+
example: test_password
23+
- name: server_url
24+
required: true
25+
description: "The Server URL of your Sonatype Nexus account."
26+
value:
27+
type: string
28+
example: https://0.0.0.0:8081
29+
- template: instances/default
30+
overrides:
31+
min_collection_interval.required: true
32+
min_collection_interval.value.example: 600
33+
min_collection_interval.value.minimum: 300
34+
min_collection_interval.value.maximum: 64800
35+
service.hidden: true
36+
empty_default_hostname.hidden: true
37+
metric_patterns.hidden: true

sonatype_nexus/assets/dashboards/sonatype_nexus_instance_health.json

Lines changed: 1019 additions & 0 deletions
Large diffs are not rendered by default.

sonatype_nexus/assets/dashboards/sonatype_nexus_metrics.json

Lines changed: 1227 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": 2,
3+
"created_at": "2025-01-08",
4+
"last_updated_at": "2025-01-08",
5+
"title": "High number of failed unique user authentications detected",
6+
"description": "Failed authentication attempts may indicate security risks, including unauthorized access or misconfigured credentials. This monitor tracks failed unique user authentications to identify issues and mitigate risks, ensuring secure access and system reliability.",
7+
"definition": {
8+
"id": 161336669,
9+
"name": "High number of failed unique user authentications detected",
10+
"type": "query alert",
11+
"query": "max(last_1d):avg:sonatype_nexus.analytics.failed_unique_user_authentication_count{*} by {sonatype_host} > 10",
12+
"message": "{{#is_alert}}\nRepeated failed authentication attempts can indicate potential security issues, such as unauthorized access attempts or misconfigured user credentials.\n\nA high number of failed unique user authentications have been detected. Take necessary action to mitigate potential risks.\n{{/is_alert}}",
13+
"tags": [
14+
"integration:sonatype_nexus",
15+
"type:metrics"
16+
],
17+
"options": {
18+
"thresholds": {
19+
"critical": 10
20+
},
21+
"notify_audit": false,
22+
"on_missing_data": "default",
23+
"include_tags": true,
24+
"silenced": {}
25+
},
26+
"priority": null,
27+
"restriction_policy": {
28+
"bindings": []
29+
}
30+
},
31+
"tags": [
32+
"integration:sonatype-nexus"
33+
]
34+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"version": 2,
3+
"created_at": "2025-01-08",
4+
"last_updated_at": "2025-01-08",
5+
"title": "High percentage of JVM heap memory usage detected",
6+
"description": "JVM heap memory stores objects created by Java applications, managed by the JVM, with garbage collection cleaning unused objects. This monitor tracks high JVM heap usage to identify and address issues, ensuring optimal memory management and application performance.",
7+
"definition": {
8+
"id": 161337519,
9+
"name": "High percentage of JVM heap memory usage detected",
10+
"type": "query alert",
11+
"query": "avg(last_1h):(avg:sonatype_nexus.analytics.jvm.heap_memory_used{*} by {sonatype_host} / avg:sonatype_nexus.analytics.jvm.heap_memory_max{*} by {sonatype_host}) * 100 > 80",
12+
"message": "{{#is_alert}}\nJMV heap memory stores all the objects created by the Java application. The JVM manages this space, and a special process called garbage collection automatically cleans up unused objects to free up memory.\n\nHigh percentage of JVM heap memory usage detected. Take necessary action to mitigate the issue.\n{{/is_alert}}",
13+
"tags": [
14+
"integration:sonatype_nexus",
15+
"type:metrics"
16+
],
17+
"options": {
18+
"thresholds": {
19+
"critical": 80
20+
},
21+
"notify_audit": false,
22+
"on_missing_data": "default",
23+
"include_tags": true,
24+
"new_group_delay": 0,
25+
"silenced": {}
26+
},
27+
"priority": null,
28+
"restriction_policy": {
29+
"bindings": []
30+
}
31+
},
32+
"tags": [
33+
"integration:sonatype-nexus"
34+
]
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": 2,
3+
"created_at": "2025-01-08",
4+
"last_updated_at": "2025-01-08",
5+
"title": "Unhealthy available CPUs detected",
6+
"description": "Available CPUs influence long-running operations and thread allocation in the web container. This monitor tracks CPU availability to identify issues and ensure optimal performance, preventing delays and maintaining system efficiency.",
7+
"definition": {
8+
"id": 161340184,
9+
"name": "Unhealthy available CPUs detected",
10+
"type": "query alert",
11+
"query": "min(last_30m):avg:sonatype_nexus.status.available_cpus_health{*} by {sonatype_host} == 0",
12+
"message": "{{#is_alert}}\nAvailable CPUs impacts longer running operations and also the thread allocation algorithms of the web container.\n\nAn unhealthy status for available CPUs has been detected. Take necessary action to mitigate potential risks.\n{{/is_alert}}",
13+
"tags": [
14+
"integration:sonatype_nexus",
15+
"type:health_status"
16+
],
17+
"options": {
18+
"thresholds": {
19+
"critical": 0
20+
},
21+
"notify_audit": false,
22+
"on_missing_data": "default",
23+
"include_tags": true,
24+
"silenced": {}
25+
},
26+
"priority": null,
27+
"restriction_policy": {
28+
"bindings": []
29+
}
30+
},
31+
"tags": [
32+
"integration:sonatype-nexus"
33+
]
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": 2,
3+
"created_at": "2025-01-08",
4+
"last_updated_at": "2025-01-08",
5+
"title": "Unhealthy blob stores detected",
6+
"description": "Nexus Repository uses blob storage to store repository files, including metadata, hashes, and indexes. This monitor tracks blob store health to prevent issues, ensuring efficient storage and system reliability. Immediate action is needed to address detected problems.",
7+
"definition": {
8+
"id": 161340768,
9+
"name": "Unhealthy blob stores detected",
10+
"type": "query alert",
11+
"query": "min(last_30m):avg:sonatype_nexus.status.blob_store.ready_health{*} by {sonatype_host} == 0",
12+
"message": "{{#is_alert}}\nNexus Repository uses a binary large object (blob) storage, or blob store, to store files found in a repository. This includes metadata, hashes, and repository-generated indexes.\n\nAn unhealthy status for blob stores has been detected. Take necessary action to mitigate the issue.\n{{/is_alert}}",
13+
"tags": [
14+
"integration:sonatype_nexus",
15+
"type:health_status"
16+
],
17+
"options": {
18+
"thresholds": {
19+
"critical": 0
20+
},
21+
"notify_audit": false,
22+
"on_missing_data": "default",
23+
"include_tags": true,
24+
"silenced": {}
25+
},
26+
"priority": null,
27+
"restriction_policy": {
28+
"bindings": []
29+
}
30+
},
31+
"tags": [
32+
"integration:sonatype-nexus"
33+
]
34+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": 2,
3+
"created_at": "2025-01-08",
4+
"last_updated_at": "2025-01-08",
5+
"title": "Unhealthy thread deadlock detected",
6+
"description": "Thread deadlock occurs when threads are blocked, waiting on each other, preventing progress. This monitor tracks thread deadlocks to identify and address issues, ensuring system stability and preventing operational bottlenecks.",
7+
"definition": {
8+
"id": 161340392,
9+
"name": "Unhealthy thread deadlock detected",
10+
"type": "query alert",
11+
"query": "min(last_30m):avg:sonatype_nexus.status.thread_deadlock_detector{*} by {sonatype_host} == 0",
12+
"message": "{{#is_alert}}\nThread deadlock is a condition where two or more threads are blocked and unable to progress because they are waiting for each other.\n\nAn unhealthy status for thread deadlock has been detected. Take necessary action to mitigate the issue.\n{{/is_alert}}",
13+
"tags": [
14+
"integration:sonatype_nexus",
15+
"type:health_status"
16+
],
17+
"options": {
18+
"thresholds": {
19+
"critical": 0
20+
},
21+
"notify_audit": false,
22+
"on_missing_data": "default",
23+
"include_tags": true,
24+
"silenced": {}
25+
},
26+
"priority": null,
27+
"restriction_policy": {
28+
"bindings": []
29+
}
30+
},
31+
"tags": [
32+
"integration:sonatype-nexus"
33+
]
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[]

0 commit comments

Comments
 (0)