Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
rgala
New Contributor II

automation stitch to send output of an CLI command

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?

 

1 Solution
AlexC-FTNT
Staff
Staff

It may be the variable:

 set email-body "%%results%%"

but I see you use:

 set email-body "%%result%%"

 


- Toss a 'Like' to your fixxer, oh Valley of Plenty! and chose the solution, too00oo -

View solution in original post

3 REPLIES 3
AlexC-FTNT
Staff
Staff

It may be the variable:

 set email-body "%%results%%"

but I see you use:

 set email-body "%%result%%"

 


- Toss a 'Like' to your fixxer, oh Valley of Plenty! and chose the solution, too00oo -
rgala
New Contributor II

Thank you very much for confirming I'm half blind.

And for saving time to find the s.

rgala
New Contributor II

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

 

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors