Hello,
FortiGate with FortiOS 7.2.5.
I try to create an automation stitch that sends me output of
diagnose debug config-error-log read
command upon FortiGate start.
As described e.g. here
https://docs.fortinet.com/document/fortigate/7.2.5/administration-guide/639044
I should create two actions, first for CLI command, second for sending mail with %%result%% in message body.
I used this setting:
config system automation-action
edit "get_config_errors"
set action-type cli-script
set script "diagnose debug config-error-log read"
next
edit "send_mail_result"
set action-type email
set email-from "***"
set email-to "***"
set email-subject "command output"
set message "%%result%%"
next
end
# LogID 32009 = FortiGate Start
config system automation-trigger
edit "Start"
set event-type event-log
set logid 32009
next
end
config system automation-stitch
edit "send_config_errors_upon_start"
set trigger "Start"
config actions
edit 1
set action "get_config_errors"
set required enable
set delay 5
next
edit 2
set action "send_mail_result"
set required enable
next
end
next
end
But when I test this automation (using one time schedule) I receive e-mail (two e-mails, there are two FortiGates in HA cluster) with body "%%result%%" verbatim, there is no command output.
Any tip what is wrong?
Solved! Go to Solution.
It may be the variable:
set email-body "%%results%%"
but I see you use:
set email-body "%%result%%"
It may be the variable:
set email-body "%%results%%"
but I see you use:
set email-body "%%result%%"
Thank you very much for confirming I'm half blind.
And for saving time to find the s.
By the way, it is message, not email-body (at least in 7.2.5).
The missing s (result vs results) was the only issue.
*** (send_mail_result) # set ?
description Description.
action-type Action type.
email-to Email addresses.
email-from Email sender name.
email-subject Email subject.
minimum-interval Limit execution to no more than once in this interval (in seconds).
*message Message content.
*replacement-message Enable/disable replacement message.
*** (send_mail_result) # set
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1739 | |
1108 | |
752 | |
447 | |
240 |
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 2024 Fortinet, Inc. All Rights Reserved.