This article describes how to create a custom automation stitch that runs a CLI script and sends its output to email when the automation stitch is triggered.
FortiGate V7.0, v7.2, v7.4, v7.6.
The trigger condition used for this case is when the FortiGuard web filtering service is unavailable.
Select the Action and Trigger created previously, and select the email notification action after the CLI script Action.
Once completed, the FortiGate will send the CLI output to the email address in the Email Notification section.
CLI Reference:
config system automation-trigger
edit "Webfilter Unreachable"
set event-type event-log
set logid 20119
next
end
config system automation-action
edit "Webfilter Unreachable_Action"
set action-type cli-script
set script "diagnose debug rating
diagnose sniffer packet any \"host 173.243.141.16 or host 173.243.140.16\" 6 50 l"
set accprofile "super_admin"
next
end
config system automation-action
edit "Email Notification_Webfilter"
set action-type email
set email-to "test@example.com"
set email-subject "%%log%%"
set message "%%results%%"
next
end
config system automation-stitch
edit "Webfilter Un reachable"
set trigger "Webfilter Unreachable"
config actions
edit 1
set action "Webfilter Unreachable_Action"
set required enable
next
edit 2
set action "Email Notification_Webfilter"
set required enable
next
end
next
end
To test an automation stitch:
On the FortiGate GUI, go to Security Fabric -> Automation, 'right-click' on the dedicated automation stitch, select Test Automation Stitch. Testing an automation stitch from the CLI is performed using the command: diagnose automation test <stitch-name> <log>.
Related articles:
Technical Tip: Creating automation stitches
Technical Tip: Automation stitch for conserve mode
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.