-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add profile linksys * add metadata * add snmprec * add e2e test * fix style
- Loading branch information
1 parent
674091a
commit 51a37d6
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
snmp/datadog_checks/snmp/data/default_profiles/linksys.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extends: | ||
- _base.yaml | ||
- _generic-if.yaml | ||
metadata: | ||
device: | ||
fields: | ||
vendor: | ||
value: "linksys" | ||
sysobjectid: | ||
- 1.3.6.1.4.1.3955.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
1.3.6.1.2.1.1.1.0|4|linksys Device Description | ||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3955.999 | ||
1.3.6.1.2.1.1.5.0|4|linksys.device.name | ||
1.3.6.1.2.1.2.1.0|2|28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# (C) Datadog, Inc. 2023-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_common_metrics, | ||
assert_extend_generic_if, | ||
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_linksys(dd_agent_check): | ||
config = create_e2e_core_test_config('linksys') | ||
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True) | ||
|
||
ip_address = get_device_ip_from_config(config) | ||
common_tags = [ | ||
'snmp_profile:linksys', | ||
'snmp_host:linksys.device.name', | ||
'device_namespace:default', | ||
'snmp_device:' + ip_address, | ||
] + [] | ||
|
||
# --- TEST EXTENDED METRICS --- | ||
assert_extend_generic_if(aggregator, common_tags) | ||
|
||
# --- TEST METRICS --- | ||
assert_common_metrics(aggregator, common_tags) | ||
|
||
# --- TEST METADATA --- | ||
device = { | ||
'description': 'linksys Device Description', | ||
'id': 'default:' + ip_address, | ||
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address], | ||
'ip_address': '' + ip_address, | ||
'name': 'linksys.device.name', | ||
'profile': 'linksys', | ||
'status': 1, | ||
'sys_object_id': '1.3.6.1.4.1.3955.999', | ||
'vendor': 'linksys', | ||
} | ||
device['tags'] = common_tags | ||
assert_device_metadata(aggregator, device) | ||
|
||
# --- CHECK COVERAGE --- | ||
aggregator.assert_all_metrics_covered() | ||
aggregator.assert_metrics_using_metadata(get_metadata_metrics()) |