Monitor FortiGate WAN health and clear top bandwidth users via Gmail

Go to Workflow
0 views
Built by Amir Anwar Amir Anwar
Created on October 24, 2026

Description

Quick overview
Monitors FortiGate SD-WAN link health and real-time bandwidth usage. Sends Gmail reports and alerts for WAN outages, congestion, and slow connections. Supports secure, passphrase-verified email commands to identify the top bandwidth user and optionally clear their sessions through SSH, enabling automated network visibility, troubleshooting, and traffic management.

How it works
Triggers either when a matching Gmail message is received or every 10 minutes on a schedule.
Parses the newest allowed email command to decide whether to run a read-only report or request a session clear, and loads the full email to verify the sender for kill requests.
Queries the FortiGate REST API for SD-WAN members, health-check status, interface bandwidth capacity, and FortiView top sources and destinations.
Analyzes WANs as OK/SLOW/CHOKED/DOWN based on capacity, latency, and packet loss thresholds, and selects an eligible top private-IP bandwidth user that is not in the protected list.
If a verified email command requests it, connects to the FortiGate via SSH to clear sessions for the selected top source, waits 10 seconds, and re-queries top sources and SD-WAN members.
Builds an HTML email report and sends it via Gmail for every email command, or only on WAN problems and once on recovery for scheduled monitoring.

Setup
Create a FortiGate REST API admin and add an n8n HTTP Header Auth credential with an Authorization Bearer token for the FortiGate API requests.
Create a FortiGate CLI admin with SSH access from your n8n host and configure an SSH credential for the session-clearing step.
Connect a Gmail account for reading command emails and sending reports, then update the Gmail search query to include your chosen passphrase.
In the workflow settings values, set your FortiGate URL, allowed sender emails, report recipient, WAN interface names, protected IPs, and any thresholds (choke/latency/loss, cooldown, top N).

This workflow was created by Amir Anwar and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.

Nodes Used (3)

Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
HTTP Request
n8n-nodes-base.httpRequest