Skip to content

Add Fortigate port and switch table #19934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
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/19934.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Fortigate port and switch table
Original file line number Diff line number Diff line change
Expand Up @@ -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

21 changes: 21 additions & 0 deletions snmp/tests/compose/data/fortinet-fortigate.snmprec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions snmp/tests/test_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading