FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Ivan_Sosa
Staff
Staff
Article Id 360003
Description This article describes how to obtain specifically the device's serial number from CLI.
Scope FortiGate v 6.X.X, 7.X.X, FortiMail.
Solution

For any purposes, it could be needed to know the serial number from a device via CLI. 

 

If the command 'get system status' is typed, it brings information related to the device, for example: 

FGT # get system status
Version: FortiGate-100E v7.2.9,build1688,240813 (GA.M)
Security Level: 2
Firmware Signature: certified
Virus-DB: 1.00000(2018-04-09 18:07)
Extended DB: 1.00000(2018-04-09 18:07)
AV AI/ML Model: 0.00000(2001-01-01 00:00)
IPS-DB: 6.00741(2015-12-01 02:30)
IPS-ETDB: 6.00741(2015-12-01 02:30)
APP-DB: 29.00908(2024-11-21 03:53)
FMWP-DB: 24.00111(2024-11-06 13:21)
INDUSTRIAL-DB: 6.00741(2015-12-01 02:30)
IPS Malicious URL Database: 1.00001(2015-01-01 01:01)
IoT-Detect: 0.00000(2022-08-17 17:31)
Serial-Number: FG100EXXXXXXXXXXXX
BIOS version: 05000006
System Part-Number: P19082-03
Log hard disk: Not available
Hostname: FGT
Private Encryption: Disable
Operation Mode: NAT
Current virtual domain: root
Max number of virtual domains: 10
Virtual domains status: 1 in NAT mode, 0 in TP mode
Virtual domain configuration: disable
FIPS-CC mode: disable
Current HA mode: standalone
Branch point: 1688
Release Version Information: GA
FortiOS x86-64: Yes
System time: Mon Nov 25 20:08:29 2024
Last reboot reason: power cycle

 

However, if the intention is to get only the serial number avoiding seeing the other information, it is necessary to use the 'grep' command on the 'get sys stat' outputs.

 

The following command 'get system status | grep -fi Serial' can be used to search case insensitive and to mark the found line. 

The grep parameter '-i' makes the search string case insensitive.

The grep parameter '-f' will mark the found line with an ASCII arrow '<---'.

 

For example:

 

get system status | grep -fi Serial
Serial-Number: FG200ETKxxxxxxxx 
<---

 

Alternatively, the following command can be used if the marker arrow is not wanted.

 

get system status | grep Serial

Serial-Number: FG200ETKxxxxxxxx

 

In a cluster environment the serial numbers of all cluster nodes can be seen with the command 'diagnose sys ha status'.

Here again, the 'grep' command can be applied to search for the serial numbers by filtering the output for the string 'hostname='.

 

For example:

 

diagnose sys ha status | grep 'hostname='

FG6H0FTBxxxxxxxx: Secondary, serialno_prio=0, usr_priority=128, hostname=firewall03
FG6H0FTBxxxxxxxx: Primary, serialno_prio=1, usr_priority=200, hostname=firewall02

 

 

Related article:
Technical Tip: The usage of 'grep' filter command on the FortiGate CLI

 

Comments
bkarl
Staff
Staff

I will share this content with my friends.

Thanks for your great content! :)

 

Ehanssen
Staff
Staff

Highly enjoyable read. Shared it with my colleagues.