Skip to content

Commit

Permalink
bugfix - handle fortinet unhealthy HA status in fortinet_get_system_h…
Browse files Browse the repository at this point in the history
…a_status (#1791)
  • Loading branch information
mjbear authored Jul 29, 2024
1 parent 507d57c commit 6fdf4c6
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 57 deletions.
10 changes: 8 additions & 2 deletions ntc_templates/templates/fortinet_get_system_ha_status.textfsm
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# FG Version: 5.6, 6.0, 6.2, 6.4
# FG Version: 5.6, 6.0, 6.2, 6.4, 7.0
# HW : varied
#
Value HA_HEALTH (\S+)
Value HA_HEALTH (\S+|.*)
Value MODEL (\S+)
Value HA_MODE ([\S\s]+)
Value HA_GROUP (\S+)
Expand All @@ -20,6 +20,7 @@ Value HA_SLAVE_UNIT_INDEX (\S+)

Start
^HA\s+Health\s+Status:\s+${HA_HEALTH}
^HA\s+Health\s+Status:$$ -> UnhealthyStatus
^Model:\s+${MODEL}
^Mode:\s+${HA_MODE}
^Group:\s+${HA_GROUP}
Expand All @@ -35,6 +36,11 @@ Start
^System\s+Usage\s+stats: -> System_Usage_stats
^. -> Error "in-Start"

UnhealthyStatus
# semicolon necessary to anchor
^${HA_HEALTH};$$
^Model:\s+${MODEL} -> Start

Configuration_Status
^System\s+Usage\s+stats: -> System_Usage_stats
^\s*\S+\([\S\s]+\):\s\S+$$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
parsed_sample:
- ha_health: "OK"
model: "FortiGate-200D"
ha_mode: "HA A-P"
ha_group: "0"
- cluster_state_changed_time: "2020-11-18 20:06:07"
cluster_uptime: "913 days 6:17:44"
cluster_state_changed_time: "2020-11-18 20:06:07"
ha_session_pickup_status: "enable"
ha_session_pickup_delay: "disable"
ha_override_status: "disable"
ha_group: "0"
ha_health: "OK"
ha_master_unit_index: "0"
ha_master_unit_name: "fgt_200d_b"
ha_slave_unit_name: "fgt_200d_a"
ha_master_unit_serial: "FG200Dyyyyyyyyyy"
ha_slave_unit_serial: "FG200Dxxxxxxxxxx"
ha_master_unit_index: "0"
ha_mode: "HA A-P"
ha_override_status: "disable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: "1"
ha_slave_unit_name: "fgt_200d_a"
ha_slave_unit_serial: "FG200Dxxxxxxxxxx"
model: "FortiGate-200D"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
parsed_sample:
- ha_health: "OK"
model: "FortiGate-200D"
ha_mode: "HA A-P"
ha_group: "0"
- cluster_state_changed_time: "2019-08-16 11:08:27"
cluster_uptime: "764 days 22:45:44"
cluster_state_changed_time: "2019-08-16 11:08:27"
ha_session_pickup_status: "enable"
ha_session_pickup_delay: "disable"
ha_override_status: "enable"
ha_group: "0"
ha_health: "OK"
ha_master_unit_index: "1"
ha_master_unit_name: "fgt-200d_a"
ha_slave_unit_name: "fgt-200d_b"
ha_master_unit_serial: "FG200Dxxxxxxxxxx"
ha_slave_unit_serial: "FG200Dyyyyyyyyyy"
ha_master_unit_index: "1"
ha_mode: "HA A-P"
ha_override_status: "enable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: "0"
ha_slave_unit_name: "fgt-200d_b"
ha_slave_unit_serial: "FG200Dyyyyyyyyyy"
model: "FortiGate-200D"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
parsed_sample:
- ha_health: "OK"
model: "FortiGate-60D"
ha_mode: "Standalone"
ha_group: "0"
- cluster_state_changed_time: "N/A"
cluster_uptime: "0 days 0:0:0"
cluster_state_changed_time: "N/A"
ha_session_pickup_status: "enable"
ha_session_pickup_delay: "disable"
ha_override_status: "enable"
ha_group: "0"
ha_health: "OK"
ha_master_unit_index: ""
ha_master_unit_name: ""
ha_slave_unit_name: ""
ha_master_unit_serial: ""
ha_slave_unit_serial: ""
ha_master_unit_index: ""
ha_mode: "Standalone"
ha_override_status: "enable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: ""
ha_slave_unit_name: ""
ha_slave_unit_serial: ""
model: "FortiGate-60D"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
parsed_sample:
- ha_health: "OK"
model: "FortiGate-600E"
ha_mode: "HA A-P"
ha_group: "5"
- cluster_state_changed_time: "2020-12-02 22:40:46"
cluster_uptime: "36 days 22:20:40"
cluster_state_changed_time: "2020-12-02 22:40:46"
ha_session_pickup_status: "enable"
ha_session_pickup_delay: "disable"
ha_override_status: "enable"
ha_group: "5"
ha_health: "OK"
ha_master_unit_index: "1"
ha_master_unit_name: "fgt-600e_a"
ha_slave_unit_name: "fgt-600e_b"
ha_master_unit_serial: "FG6H0Exxxxxxxxxx"
ha_slave_unit_serial: "FG6H0Eyyyyyyyyyy"
ha_master_unit_index: "1"
ha_mode: "HA A-P"
ha_override_status: "enable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: "0"
ha_slave_unit_name: "fgt-600e_b"
ha_slave_unit_serial: "FG6H0Eyyyyyyyyyy"
model: "FortiGate-600E"
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
parsed_sample:
- ha_health: "OK"
model: "FortiGate"
ha_mode: "HA A-P"
ha_group: "0"
- cluster_state_changed_time: "2021-10-12 11:24:28"
cluster_uptime: "40 days 19:16:5"
cluster_state_changed_time: "2021-10-12 11:24:28"
ha_session_pickup_status: "enable"
ha_session_pickup_delay: "disable"
ha_override_status: "disable"
ha_group: "0"
ha_health: "OK"
ha_master_unit_index: "0"
ha_master_unit_name: "FW"
ha_slave_unit_name: "FW"
ha_master_unit_serial: "FGXXXXXXXXXXXXXX"
ha_slave_unit_serial: "FGXXXXXXXXXXXXXX"
ha_master_unit_index: "0"
ha_mode: "HA A-P"
ha_override_status: "disable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: "1"
ha_slave_unit_name: "FW"
ha_slave_unit_serial: "FGXXXXXXXXXXXXXX"
model: "FortiGate"
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
HA Health Status:
WARNING: FGT40FYYYYYYYYYY has mondev down;
Model: FortiGate-40F
Mode: HA A-P
Group: 172
Debug: 0
Cluster Uptime: 63 days 22:15:42
Cluster state change time: 2024-02-11 15:25:27
Primary selected using:
<2024/02/11 15:25:27> FGT40FXXXXXXXXXX is selected as the primary because the value 0 of link-failure + pingsvr-failure is less than peer member FGT40FYYYYYYYYYY.
ses_pickup: enable, ses_pickup_delay=disable
override: enable
Configuration Status:
FGT40FXXXXXXXXXX(updated 0 seconds ago): in-sync
FGT40FYYYYYYYYYY(updated 0 seconds ago): in-sync
System Usage stats:
FGT40FXXXXXXXXXX(updated 0 seconds ago):
sessions=768, average-cpu-user/nice/system/idle=0%/0%/0%/99%, memory=35%
FGT40FYYYYYYYYYY(updated 0 seconds ago):
sessions=634, average-cpu-user/nice/system/idle=0%/0%/0%/100%, memory=31%
HBDEV stats:
FGT40FXXXXXXXXXX(updated 0 seconds ago):
lan2: physical/1000auto, up, rx-bytes/packets/dropped/errors=9997131732/27616386/0/0, tx=10080077920/27616652/0/0
lan3: physical/1000auto, up, rx-bytes/packets/dropped/errors=11772621099/36693306/0/0, tx=26151306122/60128423/0/0
FGT40FYYYYYYYYYY(updated 0 seconds ago):
lan2: physical/1000auto, up, rx-bytes/packets/dropped/errors=10080077920/27616652/0/0, tx=9997131732/27616386/0/0
lan3: physical/1000auto, up, rx-bytes/packets/dropped/errors=26151777728/60128423/0/0, tx=11771044717/36693306/0/0
MONDEV stats:
FGT40FXXXXXXXXXX(updated 0 seconds ago):
lan1: physical/100auto, up, rx-bytes/packets/dropped/errors=535463275509/3388288017/0/0, tx=3023591767050/4114831127/0/0
wan: physical/100auto, up, rx-bytes/packets/dropped/errors=3314385262333/4439875482/0/0, tx=768352772861/3445252569/0/0
FGT40FYYYYYYYYYY(updated 0 seconds ago):
lan1: physical/00, down, rx-bytes/packets/dropped/errors=0/0/0/0, tx=0/0/0/0
wan: physical/100auto, up, rx-bytes/packets/dropped/errors=15792718293/245544650/0/0, tx=0/0/0/0
Primary : FGT-fw-a, FGT40FXXXXXXXXXX, HA cluster index = 1
Secondary : FGT-fw-b, FGT40FYYYYYYYYYY, HA cluster index = 0
number of vcluster: 1
vcluster 1: work 169.254.0.2
Primary: FGT40FXXXXXXXXXX, HA operating index = 0
Secondary: FGT40FYYYYYYYYYY, HA operating index = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
parsed_sample:
- cluster_state_changed_time: "2024-02-11 15:25:27"
cluster_uptime: "63 days 22:15:42"
ha_group: "172"
ha_health: "WARNING: FGT40FYYYYYYYYYY has mondev down"
ha_master_unit_index: "1"
ha_master_unit_name: "FGT-fw-a"
ha_master_unit_serial: "FGT40FXXXXXXXXXX"
ha_mode: "HA A-P"
ha_override_status: "enable"
ha_session_pickup_delay: "disable"
ha_session_pickup_status: "enable"
ha_slave_unit_index: "0"
ha_slave_unit_name: "FGT-fw-b"
ha_slave_unit_serial: "FGT40FYYYYYYYYYY"
model: "FortiGate-40F"

0 comments on commit 6fdf4c6

Please sign in to comment.