diff --git a/snmp/changelog.d/19934.added b/snmp/changelog.d/19934.added new file mode 100644 index 0000000000000..54c80f537d6eb --- /dev/null +++ b/snmp/changelog.d/19934.added @@ -0,0 +1 @@ +Add Fortigate port and switch table diff --git a/snmp/datadog_checks/snmp/data/default_profiles/fortinet-fortigate.yaml b/snmp/datadog_checks/snmp/data/default_profiles/fortinet-fortigate.yaml index b73fee3f602be..0f68c62d1d911 100644 --- a/snmp/datadog_checks/snmp/data/default_profiles/fortinet-fortigate.yaml +++ b/snmp/datadog_checks/snmp/data/default_profiles/fortinet-fortigate.yaml @@ -317,3 +317,71 @@ metrics: # Firewall policy6 ID. Only enabled policies are present in this table. Policy IDs are only unique within a virtual domain. - index: 2 tag: policy6_index + + ### Switch Controller + # Switch controller port statistics table. + - MIB: FORTINET-FORTIGATE-MIB + table: + name: fgSwPortTable + OID: 1.3.6.1.4.1.12356.101.24.2.1.1 + symbols: + # Current operational status of the switch port. + - name: fgSwPortStatus + OID: 1.3.6.1.4.1.12356.101.24.2.1.1.6 + metric_type: gauge + # Current power consumption of the PoE (Power over Ethernet) port. + - name: fgSwPortPOEPower + OID: 1.3.6.1.4.1.12356.101.24.2.1.1.14 + metric_type: gauge + metric_tags: + # Name of the switch port (e.g., "port1", "port2"). + - column: + name: fgSwPortName + OID: 1.3.6.1.4.1.12356.101.24.2.1.1.5 + tag: port_name + # Serial number of the switch. + - column: + name: fgSwPortSwitchSerialNum + OID: 1.3.6.1.4.1.12356.101.24.2.1.1.4 + tag: switch_serial + # Speed and duplex mode of the switch port (e.g., "auto", "100full"). + - column: + name: fgSwPortSpeedDuplex + OID: 1.3.6.1.4.1.12356.101.24.2.1.1.7 + tag: port_speed_duplex + # Name of the switch, extracted from the switch device table. + - symbol: + name: fgSwDeviceName + OID: 1.3.6.1.4.1.12356.101.24.1.1.1.4 + table: fgSwDeviceTable + index_transform: + - start: 0 + end: 2 + tag: switch_name + + # Switch controller device statistics table. + - MIB: FORTINET-FORTIGATE-MIB + table: + name: fgSwDeviceTable + OID: 1.3.6.1.4.1.12356.101.24.1.1.1 + symbols: + # Current CPU utilization of the switch. + - name: fgSwCpu + OID: 1.3.6.1.4.1.12356.101.24.1.1.1.11 + metric_type: gauge + # Current memory utilization of the switch. + - name: fgSwMemory + OID: 1.3.6.1.4.1.12356.101.24.1.1.1.12 + metric_type: gauge + metric_tags: + # Name of the switch. + - column: + name: fgSwDeviceName + OID: 1.3.6.1.4.1.12356.101.24.1.1.1.4 + tag: switch_name + # Serial number of the switch. + - column: + name: fgSwDeviceSerialNum + OID: 1.3.6.1.4.1.12356.101.24.1.1.1.3 + tag: switch_serial + diff --git a/snmp/tests/compose/data/fortinet-fortigate.snmprec b/snmp/tests/compose/data/fortinet-fortigate.snmprec index 1fd3e07a4cca8..9029ae600e19d 100644 --- a/snmp/tests/compose/data/fortinet-fortigate.snmprec +++ b/snmp/tests/compose/data/fortinet-fortigate.snmprec @@ -78,3 +78,24 @@ 1.3.6.1.4.1.12356.101.12.2.2.1.19.2|70|9058397767704808189 1.3.6.1.4.1.12356.101.12.2.2.1.20.1|2|2 1.3.6.1.4.1.12356.101.12.2.2.1.20.2|2|1 +1.3.6.1.4.1.12356.101.24.1.1.1.3.1.18.16000116|4|FSW1234567890 +1.3.6.1.4.1.12356.101.24.1.1.1.4.1.18.16000116|4|FortiSwitch-448E +1.3.6.1.4.1.12356.101.24.1.1.1.5.1.18.16000116|4|v6.4.1 +1.3.6.1.4.1.12356.101.24.1.1.1.6.1.18.16000116|2|2 +1.3.6.1.4.1.12356.101.24.1.1.1.7.1.18.16000116|2|1 +1.3.6.1.4.1.12356.101.24.1.1.1.8.1.18.16000116|66|1592346680 +1.3.6.1.4.1.12356.101.24.1.1.1.9.1.18.16000116|64|169.254.1.2 +1.3.6.1.4.1.12356.101.24.1.1.1.10.1.18.16000116|4|- +1.3.6.1.4.1.12356.101.24.1.1.1.11.1.18.16000116|66|25 +1.3.6.1.4.1.12356.101.24.1.1.1.12.1.18.16000116|66|60 +1.3.6.1.4.1.12356.101.24.2.1.1.4.1.18.16000116.1|4|FSW1234567890 +1.3.6.1.4.1.12356.101.24.2.1.1.5.1.18.16000116.1|4|port1 +1.3.6.1.4.1.12356.101.24.2.1.1.6.1.18.16000116.1|2|1 +1.3.6.1.4.1.12356.101.24.2.1.1.7.1.18.16000116.1|4|1000 +1.3.6.1.4.1.12356.101.24.2.1.1.8.1.18.16000116.1|2|1 +1.3.6.1.4.1.12356.101.24.2.1.1.9.1.18.16000116.1|4|4093 +1.3.6.1.4.1.12356.101.24.2.1.1.10.1.18.16000116.1|4|4093 +1.3.6.1.4.1.12356.101.24.2.1.1.11.1.18.16000116.1|2|0 +1.3.6.1.4.1.12356.101.24.2.1.1.12.1.18.16000116.1|2|1 +1.3.6.1.4.1.12356.101.24.2.1.1.13.1.18.16000116.1|4|Disabled +1.3.6.1.4.1.12356.101.24.2.1.1.14.1.18.16000116.1|4|0.000000 \ No newline at end of file diff --git a/snmp/tests/test_e2e_core_profiles/test_profile_fortinet_fortigate.py b/snmp/tests/test_e2e_core_profiles/test_profile_fortinet_fortigate.py index 646c8ee37ff8d..b818a89af119e 100644 --- a/snmp/tests/test_e2e_core_profiles/test_profile_fortinet_fortigate.py +++ b/snmp/tests/test_e2e_core_profiles/test_profile_fortinet_fortigate.py @@ -143,6 +143,22 @@ def test_e2e_profile_fortinet_fortigate(dd_agent_check): aggregator.assert_metric('snmp.fgFwPol6PktCount', metric_type=aggregator.COUNT, tags=common_tags + tag_row) aggregator.assert_metric('snmp.fgFwPol6PktCount.rate', metric_type=aggregator.GAUGE, tags=common_tags + tag_row) + # Test FortiGate switch port metrics + switch_port_tags = [ + ['switch_serial:FSW1234567890', 'port_name:port1', 'port_speed_duplex:1000', 'switch_name:FortiSwitch-448E'], + ] + for tag_row in switch_port_tags: + aggregator.assert_metric('snmp.fgSwPortStatus', metric_type=aggregator.GAUGE, tags=common_tags + tag_row) + aggregator.assert_metric('snmp.fgSwPortPOEPower', metric_type=aggregator.GAUGE, tags=common_tags + tag_row) + + # Test FortiGate switch device metrics + switch_device_tags = [ + ['switch_serial:FSW1234567890', 'switch_name:FortiSwitch-448E'], + ] + for tag_row in switch_device_tags: + aggregator.assert_metric('snmp.fgSwCpu', metric_type=aggregator.GAUGE, tags=common_tags + tag_row) + aggregator.assert_metric('snmp.fgSwMemory', metric_type=aggregator.GAUGE, tags=common_tags + tag_row) + # --- TEST METADATA --- device = { 'id': 'default:' + ip_address, diff --git a/snmp/tests/test_profiles.py b/snmp/tests/test_profiles.py index f68ea17337c47..54016681d85cd 100644 --- a/snmp/tests/test_profiles.py +++ b/snmp/tests/test_profiles.py @@ -2792,6 +2792,23 @@ def test_fortinet_fortigate(aggregator): 'snmp.{}.rate'.format(metric), metric_type=aggregator.RATE, tags=firewall6_tags, count=1 ) + # Switch port metrics + switch_port_tags = common_tags + [ + 'port_name:port1', + 'switch_serial:FSW1234567890', + 'port_speed_duplex:1000', + 'switch_name:FortiSwitch-448E', + ] + for metric in ['fgSwPortStatus', 'fgSwPortPOEPower']: + aggregator.assert_metric('snmp.{}'.format(metric), metric_type=aggregator.GAUGE, tags=switch_port_tags, count=1) + + # Switch device metrics + switch_device_tags = common_tags + ['switch_name:FortiSwitch-448E', 'switch_serial:FSW1234567890'] + for metric in ['fgSwCpu', 'fgSwMemory']: + aggregator.assert_metric( + 'snmp.{}'.format(metric), metric_type=aggregator.GAUGE, tags=switch_device_tags, count=1 + ) + aggregator.assert_all_metrics_covered() aggregator.assert_metrics_using_metadata(get_metadata_metrics(), check_submission_type=True)