Created on
01-08-2024
01:22 AM
Edited on
11-05-2025
03:36 AM
By
Anthony_E
|
Description |
This article describes how to log and monitor a single CPU core usage spike. |
|
Scope |
FortiGate with multiple CPU cores v7.2.4 and above. |
|
Solution |
The System event generally records the CPU usage every 5 minutes by default, as seen in the example below:
date=2024-01-08 time=09:41:11 eventtime=1704703271275848977 tz="+0100" logid="0100040704" type="event" subtype="system" level="notice" vd="root" logdesc="System performance statistics" action="perf-stats" cpu=1 mem=43 totalsession=33 disk=1 bandwidth="10/208" setuprate=0 disklograte=0 fazlograte=0 freediskstorage=15172 sysuptime=523228 waninfo="N/A" msg="Performance statistics: average CPU: 1, memory: 43, concurrent sessions: 33, setup-rate: 0"
However, the CPU usage recorded above is the average CPU usage seen across all the available CPU cores. Hence, a single CPU core spike may get overlooked on a FortiGate with multiple CPU cores.
Since v7.2.4, a new feature 'log-single-cpu-high' was implemented to allow the logging of a single core once it reaches a configurable threshold.
To log any CPU usage spike seen against a particular core, use the following command:
config system global
log-single-cpu-high: Enable/disable logging in the event of a single CPU core reaching the CPU usage threshold.
The CPU usage threshold is by default 90. It would then generate logs as shown in the sample below if the usage exceeds 90%:
date=2024-01-08 time=09:45:44 eventtime=1666143944430584293 tz="+0100" logid="0100040707" type="event" subtype="system" level="notice" vd="root" logdesc="CPU single core usage statistics" action="cpu-single-core-usage" core=8 cpu=99 msg="CPU core 8 usage reaches: 99"
To change the CPU use threshold, the following command can be used:
config system global
When enabled, CPU single-core usage will be polled every 3 seconds, and any single CPU core usage above the CPU usage threshold will report an event log. If a core is reported, that core will not be checked again for 30 seconds.
Note: In the System events log, the core-index is different than that of the actual index in CPU data, so that it will show core-1 and core-2 here instea of CPU0, CPU1 in other FortiGate CLI commands. The event logs start counting at 1 while the CLI commands start counting at 0.
date=2025-03-14 time=14:01:16 eventtime=1741935675876953903 tz="+0700" logid="0100040707" type="event" subtype="system" level="notice" vd="root" logdesc="CPU single core usage statistics" action="cpu-single-core-usage" core=2 cpu=92 msg="CPU core 2 usage reaches: 92"
get system performance status
diagnose sys mpstat 2 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.