-
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 ubiquiti-unifi-security-gateway (#15433)
Co-authored-by: Elizaveta Eremina <70374721+lizaerem@users.noreply.github.com>
- Loading branch information
1 parent
ca31f3c
commit ee31b06
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
snmp/datadog_checks/snmp/data/default_profiles/ubiquiti-unifi-security-gateway.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,7 @@ | ||
extends: | ||
- _base.yaml | ||
- _generic-if.yaml | ||
- _generic-ucd.yaml | ||
- _ubiquiti.yaml | ||
sysobjectid: | ||
- 1.3.6.1.4.1.41112.1.5 # Ubiquiti EdgeMax |
5 changes: 5 additions & 0 deletions
5
snmp/tests/compose/data/ubiquiti-unifi-security-gateway.snmprec
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,5 @@ | ||
1.3.6.1.2.1.1.1.0|4|ubiquiti-unifi-security-gateway Device Description | ||
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.41112.1.5 | ||
1.3.6.1.2.1.1.5.0|4|ubiquiti-unifi-security-gateway.device.name | ||
1.3.6.1.2.1.2.1.0|2|28 | ||
1.3.6.1.4.1.2021.4.3.0|2|1048572 |
58 changes: 58 additions & 0 deletions
58
snmp/tests/test_e2e_core_profiles/test_profile_ubiquiti_unifi_security_gateway.py
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,58 @@ | ||
# (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, | ||
assert_extend_generic_ucd, | ||
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_ubiquiti_unifi_security_gateway(dd_agent_check): | ||
config = create_e2e_core_test_config('ubiquiti-unifi-security-gateway') | ||
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True) | ||
|
||
ip_address = get_device_ip_from_config(config) | ||
common_tags = [ | ||
'snmp_profile:ubiquiti-unifi-security-gateway', | ||
'snmp_host:ubiquiti-unifi-security-gateway.device.name', | ||
'device_namespace:default', | ||
'snmp_device:' + ip_address, | ||
] + [] | ||
|
||
# --- TEST EXTENDED METRICS --- | ||
assert_extend_generic_if(aggregator, common_tags) | ||
assert_extend_generic_ucd(aggregator, common_tags) | ||
|
||
# --- TEST METRICS --- | ||
assert_common_metrics(aggregator, common_tags) | ||
|
||
# --- TEST METADATA --- | ||
device = { | ||
'description': 'ubiquiti-unifi-security-gateway Device Description', | ||
'id': 'default:' + ip_address, | ||
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address], | ||
'ip_address': '' + ip_address, | ||
'name': 'ubiquiti-unifi-security-gateway.device.name', | ||
'profile': 'ubiquiti-unifi-security-gateway', | ||
'status': 1, | ||
'sys_object_id': '1.3.6.1.4.1.41112.1.5', | ||
'vendor': 'ubiquiti', | ||
} | ||
device['tags'] = common_tags | ||
assert_device_metadata(aggregator, device) | ||
|
||
# --- CHECK COVERAGE --- | ||
aggregator.assert_all_metrics_covered() | ||
aggregator.assert_metrics_using_metadata(get_metadata_metrics()) |