Commit f887181
authored
[NDM] Add core check for NCM (#39735)
<!--
* Contributors are encouraged to read our
[CONTRIBUTING](/CONTRIBUTING.md) documentation.
* Both Contributor and Reviewer Checklists are available at
https://datadoghq.dev/datadog-agent/guidelines/contributing/#pull-requests.
* The pull request:
* Should only fix one issue or add one feature at a time.
* Must update the test suite for the relevant functionality.
* Should pass all status checks before being reviewed or merged.
* Commit titles should be prefixed with general area of pull request's
change.
* Please fill the below sections if possible with relevant information
or links.
-->
### What does this PR do?
Adds the agent corecheck/integration for NCM / Network Config Management
feature owned by NDM
This PR adds:
* A new core check `network_config_management` + defaults around that
* Refine shared logic between the core check and traps/syslogs-based
retrieval
* Adds tests
You can refer to this
[documentation](https://datadoghq.atlassian.net/wiki/spaces/II/pages/5367792210/NCM+Architecture+Overview)
for details regarding the vision for the agent-based architecture.
**Core check flow**
1. Check is scheduled, configured according to the `conf.yaml` (example
below in QA section)
2. For the device, retrieval (default 15m) during the check only grabs
the running config (hardcoded for Cisco devices currently)
3. Finishes by submitting to EvP
Many tasks left open, including:
* Additional support for Telnet
* Refining SSH support / configurations
* Validation, parsing, refinement of config output post-retrieval (incl.
sensitive data scrubbing, etc.)
* etc.
these will be upcoming PRs to address, as this initial contribution has
grown large :^D
### Motivation
### Describe how you validated your changes
<!--
Validate your changes before merge, ensuring that:
* Your PR is tested by static / unit / integrations / e2e tests
* Your PR description details which e2e tests cover your changes, if any
* The PR description contains details of how you validated your changes.
If you validated changes manually and not through automated tests, add
context on why automated tests did not fit your changes validation.
If you want additional validation by a second person, you can ask
reviewers to do it. Describe how to set up an environment for manual
tests in the PR description. Manual validation is expected to happen on
every commit before merge.
Any manual validation step should then map to an automated test. Manual
validation should not substitute automation, minus exceptions not
supported by test tooling yet.
-->
**VALIDATION OUTPUT**
```
cisco@qa-agent:~$ sudo -u dd-agent -- datadog-agent check network_config_management
{"namespace":"zoe_ncm_test","integration":"","configs":[{"device_id":"zoe_ncm_test:10.10.1.1","device_ip":"10.10.1.1","config_type":"running","timestamp":1755274594,"tags":["device_ip:10.10.1.1"],"content":"\r\n\r\n\r\nBuilding configuration...\r\n\r\n \r\nCurrent configuration : 3144 bytes\r\n!\r\n! Last configuration change at 20:53:27 UTC Thu Aug 14 2025\r\n!\r\nversion 15.9\r\nservice timestamps debug datetime msec\r\nservice timestamps log datetime msec\r\nno service password-encryption\r\n!\r\nhostname qa-device\r\n!\r\nboot-start-marker\r\nboot-end-marker\r\n!\r\n!\r\n!\r\nno aaa new-model\r\n!\r\n!\r\n!\r\nmmi polling-interval 60\r\nno mmi auto-configure\r\nno mmi pvc\r\nmmi snmp-timeout 180\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\n!\r\nip ...EDITED FOR THE SAKE OF CONCISENESS"}],"collect_timestamp":1755274594}
Running Checks
==============
network_config_management
-------------------------
Instance ID: network_config_management:zoe_ncm_test:51fd8431b479a10a [OK]
Configuration Source: file:/etc/datadog-agent/conf.d/network_config_management.d/conf.yaml
Total Runs: 1
Metric Samples: Last Run: 0, Total: 0
Events: Last Run: 0, Total: 0
ndmconfig: Last Run: 1, Total: 1
Service Checks: Last Run: 0, Total: 0
Average Execution Time : 1.089s
Last Execution Date : 2025-08-15 16:16:34 UTC (1755274594000)
Last Successful Execution Date : 2025-08-15 16:16:34 UTC (1755274594000)
Metadata
========
config.hash: network_config_management:zoe_ncm_test:51fd8431b479a10a
config.provider: file
config.source: /etc/datadog-agent/conf.d/network_config_management.d/conf.yaml
```
QA steps/how to validate
* Pull in the `ndm-tools/cml-qa` repo and follow instructions for
setting up the CLI
([link](https://github.com/DataDog/ndm-tools/tree/main/cml-qa))
```
python cml_template_generator.py \
--deb-url <INSERT THE DEB FROM CI/CD BUILD> \
--api-key <INSERT YOUR KEY> \
--site "datad0g.com" \
--title "<YOUR NAME/TITLE> NCM Agent QA"
```
* Go the NDM hosted CML
([docs](https://datadoghq.atlassian.net/wiki/spaces/II/pages/5061640281/Getting+Started+with+Cisco+Modeling+Labs+CML))
* Press Import
* Pull in the YAML that gets created, start the lab
* <to fill in more details to prep the IOS device for SSH, etc.>
<img width="451" height="312" alt="image"
src="https://github.com/user-attachments/assets/73f72efe-3677-4faa-a50e-41337db5fba3"
/>
`/etc/datadog-agent/conf.d/network_config_management.d/conf.yaml`
```
init_config:
instances:
- ip_address: "10.10.1.1"
namespace: "zoe_ncm_test"
auth:
username: "cisco"
password: "cisco"
ssh_ciphers: [aes256-ctr, aes192-ctr, aes128-ctr]
ssh_key_exchanges: [diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1]
ssh_host_key_algorithms: [ssh-rsa]
```
`iosv-0/0` steps to enable SSH on network device
```
qa-device#enable
qa-device#conf t
Enter configuration commands, one per line. End with CNTL/Z.
qa-device(config)#username cisco privilege 15 secret cisco
qa-device(config)#line vty 0 4
qa-device(config-line)#login local
qa-device(config-line)#transport input ssh
qa-device(config-line)#exit
qa-device(config)#ip domain-name lab.local
qa-device(config)#crypto key generate rsa modulus 2048
The name for the keys will be: qa-device.lab.local
% The key modulus size is 2048 bits
% Generating 2048 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 3 seconds)
qa-device(config)#ip ssh version 2
qa-device(config)#end
qa-device#write memory
```
### Possible Drawbacks / Trade-offs
### Additional Notes
<!--
* Anything else we should know when reviewing?
* Include benchmarking information here whenever possible.
* Include info about alternatives that were considered and why the
proposed
version was chosen.
-->1 parent 43a1768 commit f887181
File tree
17 files changed
+1656
-0
lines changed- .github
- comp/forwarder/eventplatform
- pkg
- collector/corechecks/networkconfigmanagement
- commonchecks
- networkconfigmanagement
- config
- remote
- report
- sender
- tasks
17 files changed
+1656
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
451 | 452 | | |
452 | 453 | | |
453 | 454 | | |
| |||
608 | 609 | | |
609 | 610 | | |
610 | 611 | | |
| 612 | + | |
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
Lines changed: 155 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
0 commit comments