Check fortios-cpu-usage¶
Overview¶
Monitors CPU utilization on FortiGate appliances running FortiOS via the REST API. Alerts only if the threshold has been exceeded for a configurable number of consecutive check runs (default: 5), suppressing short spikes. First checks against the globally configured cpu-use-threshold on the appliance, then falls back to command-line thresholds.
Important Notes:
- FortiGate appliances running FortiOS with REST API access
--count=5(the default) while checking every minute means the check reports a warning only if the CPU usage exceeds the threshold for 5 consecutive minutes- The globally configured
cpu-use-thresholdon the appliance takes precedence over the--warningcommand-line value. The--criticalthreshold is always used as-is.
Data Collection:
- Queries the FortiOS REST API endpoint
/api/v2/monitor/system/resource/usage?resource=cpu&interval=1-minfor the current CPU usage - Queries
/api/v2/cmdb/system/globalto read the appliance's globally configuredcpu-use-threshold; if present, this value overrides--warning - Stores each measurement in a local SQLite database, retaining the last
--countrows - Authentication uses a single API token (Token-based authentication)
Fact Sheet¶
| Fact | Value |
|---|---|
| Check Plugin Download | https://github.com/Linuxfabrik/monitoring-plugins/tree/main/check-plugins/fortios-cpu-usage |
| Nagios/Icinga Check Name | check_fortios_cpu_usage |
| Check Interval Recommendation | Every minute |
| Can be called without parameters | No (--hostname and --password are required) |
| Runs on | Cross-platform |
| Compiled for Windows | No (runs with Python interpreter) |
| Handles Periods | Yes (alerts only after --count consecutive threshold violations) |
| Uses State File | $TEMP/linuxfabrik-monitoring-plugins-fortios-cpu-usage.db |
Help¶
usage: fortios-cpu-usage [-h] [-V] [--always-ok] [--count COUNT] [-c CRIT]
-H HOSTNAME [--insecure] [--no-perfdata] [--no-proxy]
--password PASSWORD [--proxy PROXY]
[--timeout TIMEOUT] [-w WARN]
Monitors CPU utilization on FortiGate appliances running FortiOS via the REST
API. Alerts only if the threshold has been exceeded for a configurable number
of consecutive check runs (default: 5), suppressing short spikes. First checks
against the globally configured cpu-use-threshold on the appliance, then falls
back to command-line thresholds.
options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
--always-ok Always returns OK.
--count COUNT Number of consecutive checks the threshold must be
exceeded before alerting. Default: 5
-c, --critical CRIT CRIT threshold for CPU usage in percent. The plugin
first checks against the globally configured `cpu-use-
threshold` on the appliance; this value is only used
if no global threshold exists. Default: 90
-H, --hostname HOSTNAME
FortiOS-based appliance address, optionally including
port. Example: `--hostname 192.168.1.1:443`.
--insecure This option explicitly allows insecure SSL
connections.
--no-perfdata Suppress the performance data section from the output.
The status message and the exit code are unaffected,
so alerting keeps working while trending data is
dropped.
--no-proxy Do not use a proxy, not even one the environment
names. Overrides `--proxy`.
--password PASSWORD FortiOS REST API single-use access token.
--proxy PROXY Proxy to reach the target through. The scheme defaults
to `http` when omitted. Overrides the proxy the
environment names (`http_proxy`, `https_proxy`,
`all_proxy`) together with the exceptions it lists in
`no_proxy`, and is itself overridden by `--no-proxy`.
Without either parameter the environment applies.
Credentials belong into the environment variable
rather than here, because a command-line argument is
visible to every user on the host. Example:
`--proxy=http://proxy.example.com:3128`.
--timeout TIMEOUT Network timeout in seconds. Default: 3 (seconds)
-w, --warning WARN WARN threshold for CPU usage in percent. The plugin
first checks against the globally configured `cpu-use-
threshold` on the appliance; this value is only used
if no global threshold exists. Default: 80
Documentation:
https://linuxfabrik.github.io/monitoring-plugins/check-plugins/fortios-cpu-usage/
Usage Examples¶
./fortios-cpu-usage --hostname=fortigate-cluster.linuxfabrik.io --password=mypass --count=15 --warning=50 --critical=70
Output:
0%
States¶
- OK if CPU usage is below the thresholds within the last
--countconsecutive checks. - WARN if CPU usage exceeds the warning threshold (appliance's
cpu-use-thresholdor--warning, default: 80%) for--countconsecutive checks (default: 5). - CRIT if CPU usage exceeds
--critical(default: 90%) for--countconsecutive checks (default: 5). --always-oksuppresses all alerts and always returns OK.
Perfdata / Metrics¶
| Name | Type | Description |
|---|---|---|
| cpu-usage | Percentage | Current CPU usage of the FortiGate appliance. |
Credits, License¶
- Authors: Linuxfabrik GmbH, Zurich
- License: The Unlicense, see LICENSE file.