Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions snmp/changelog.d/24283.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add NetScout switch SNMP profile for CPU and memory metrics.
Comment thread
mirzanurkic-dd marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Same coverage as generic-device.yaml except _generic-ospf.yaml, which triggers
# DuplicateOIDValidator failures (constant_value_one symbols without OID).
extends:
- _base.yaml
- _generic-if.yaml
- _generic-ip.yaml
- _generic-tcp.yaml
- _generic-udp.yaml

sysobjectid:
- 1.3.6.1.4.1.21671
- 1.3.6.1.4.1.21671.*

metadata:
device:
fields:
vendor:
value: "netscout"
type:
value: "switch"
model:
symbol:
MIB: NTCT-PFS-HEALTH-MIB
OID: 1.3.6.1.4.1.21671.3.2.1.1.5.0
name: nphDeviceModelName
serial_number:
symbol:
MIB: NTCT-PFS-HEALTH-MIB
OID: 1.3.6.1.4.1.21671.3.2.1.1.4.0
name: nphDeviceSerialNumber

metrics:
- MIB: NTCT-PFS-HEALTH-MIB
table:
OID: 1.3.6.1.4.1.21671.3.2.1.1.6
name: nphMemoryTable
symbols:
- OID: 1.3.6.1.4.1.21671.3.2.1.1.6.1.2
name: memory.total
scale_factor: 1024
- OID: 1.3.6.1.4.1.21671.3.2.1.1.6.1.3
name: memory.free
scale_factor: 1024
metric_tags:
- index: 1
tag: nph_mgmt_index

- MIB: NTCT-PFS-HEALTH-MIB
table:
OID: 1.3.6.1.4.1.21671.3.2.1.1.7
name: nphCPUTable
symbols:
- OID: 1.3.6.1.4.1.21671.3.2.1.1.7.1.2
name: cpu.usage
metric_type: gauge
metric_tags:
- index: 1
tag: nph_mgmt_index
12 changes: 12 additions & 0 deletions snmp/tests/compose/data/netscout-switch.snmprec
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
1.3.6.1.2.1.1.1.0|4|netscout-switch Device Description
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.21671
1.3.6.1.2.1.1.5.0|4|netscout-switch.device.name
1.3.6.1.2.1.2.1.0|2|4
1.3.6.1.2.1.4.31.1.1.4.1|70|310637142
1.3.6.1.2.1.6.5.0|65|4698
1.3.6.1.2.1.7.8.0|70|6116206687099577350
1.3.6.1.4.1.21671.3.2.1.1.4.0|4|PF3250196025
1.3.6.1.4.1.21671.3.2.1.1.5.0|4|PFS5010
1.3.6.1.4.1.21671.3.2.1.1.6.1.2.1|66|8144288
1.3.6.1.4.1.21671.3.2.1.1.6.1.3.1|66|6682660
1.3.6.1.4.1.21671.3.2.1.1.7.1.2.1|66|36
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# (C) Datadog, Inc. 2026-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

import pytest

from datadog_checks.dev.utils import get_metadata_metrics

from .. import common
from ..test_e2e_core_metadata import assert_device_metadata
from .utils import (
assert_all_profile_metrics_and_tags_covered,
assert_common_metrics,
assert_extend_generic_if,
assert_extend_generic_ip,
assert_extend_generic_tcp,
assert_extend_generic_udp,
create_e2e_core_test_config,
get_device_ip_from_config,
)

pytestmark = [pytest.mark.e2e, common.py3_plus_only, common.snmp_integration_only]


def test_e2e_profile_netscout_switch(dd_agent_check):
profile = 'netscout-switch'
config = create_e2e_core_test_config(profile)
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True)

ip_address = get_device_ip_from_config(config)
common_tags = [
'snmp_profile:netscout-switch',
'snmp_host:netscout-switch.device.name',
'device_hostname:netscout-switch.device.name',
'device_namespace:default',
'snmp_device:' + ip_address,
'device_ip:' + ip_address,
'device_id:default:' + ip_address,
'agent_host:' + common.get_agent_hostname(),
]

# --- TEST EXTENDED METRICS ---
assert_extend_generic_if(aggregator, common_tags)
assert_extend_generic_ip(aggregator, common_tags)
assert_extend_generic_tcp(aggregator, common_tags)
assert_extend_generic_udp(aggregator, common_tags)

# --- TEST METRICS ---
assert_common_metrics(aggregator, common_tags)

tag_row = ['nph_mgmt_index:1']
aggregator.assert_metric('snmp.cpu.usage', metric_type=aggregator.GAUGE, tags=common_tags + tag_row)
aggregator.assert_metric(
'snmp.memory.total',
metric_type=aggregator.GAUGE,
tags=common_tags + tag_row,
value=8144288 * 1024,
)
aggregator.assert_metric(
'snmp.memory.free',
metric_type=aggregator.GAUGE,
tags=common_tags + tag_row,
value=6682660 * 1024,
)
aggregator.assert_metric('snmp.memory.usage', metric_type=aggregator.GAUGE, tags=common_tags + tag_row)

# --- TEST METADATA ---
device = {
'description': 'netscout-switch Device Description',
'id': 'default:' + ip_address,
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address],
'ip_address': '' + ip_address,
'name': 'netscout-switch.device.name',
'profile': 'netscout-switch',
'status': 1,
'sys_object_id': '1.3.6.1.4.1.21671',
'vendor': 'netscout',
'device_type': 'switch',
'model': 'PFS5010',
'serial_number': 'PF3250196025',
'integration': 'snmp',
}
device['tags'] = common_tags
assert_device_metadata(aggregator, device)

# --- CHECK COVERAGE ---
assert_all_profile_metrics_and_tags_covered(profile, aggregator)
aggregator.assert_all_metrics_covered()
aggregator.assert_metrics_using_metadata(get_metadata_metrics())
Loading