Skip to main content
vifi
Staff
Staff
March 5, 2025

Technical Tip: How to configure automation stitch to receive the output of diagnostics debugs via E-mail

  • March 5, 2025
  • 0 replies
  • 860 views
Description This article describes the configuration of automation stitch to collect diagnostics commands and receive the output via E-mail.
Scope FortiGate v7.6.1
Solution

In some situations, it is required to collect diagnostics commands at a certain period and receive the output via email.

In this example automation stitch is configured to monitor and check the communication to FortiGuard Servers and to receive via E-mail the output of these diagnostic commands:

diagnose debug application update -1
diagnose debug enable
execute update-now

To stop the debug processes in the end, press 'Ctrl+C' and enter 'diagnose debug disable'.

 

Note

This configuration is possible starting from v7.6.1

 

In this example, trigger: 'FortiGuard webfilter unreachable' has been used. A schedule trigger or any other trigger can be used.


config system automation-trigger
    edit "trigger_forti"
        set event-type event-log
        set logid 20119
    next
end

config system automation-actionv
    edit "debugs"
        set action-type diagnose-script <----- New option added in 7.6.
        set script "diagnose debug application update -1
            diagnose debug enable
                execute update-now"
                    set duration 200
                    set accprofile "super_admin"
                next
            end

 

config system automation-action
    edit "email_stitch"
        set action-type email
        set email-to "xxx@abc.com"  <-----Set the correct email.
        set email-subject "FortiGuard debugs" <----- Set the subject accordingly.
        set message "%%results%%"
    next
end

 

config system automation-stitch
    edit "debugs"
        set trigger "trigger_forti"
            config actions
                edit 1
                    set action "debugs"
                    set required enable
                next
            edit 2
                set action "email_stitch"
                set delay 120
                set required enable
            next
        end
    next
end

 

The E-mail received will be as follows:

 

***********************************
Diagnose script action: diag_crash_log
Start Time: Tue Mar 4 02:58:12 2025
Script duration (seconds): 200
***********************************
diagnose debug application update -1
diagnose debug enable
execute update-now

FortiGate# diagnose debug application update -1

Debug messages will be on for 24 minutes.

FortiGate # diagnose debug enable
FortiGate # execute update-now

upd_daemon[1911]-Received update request from pid=2698

upd_daemon[1911]-Received update request from pid=2699 upd_daemon[1730]-Found cached action=00000002 do_update[744]-Starting now UPDATE (final try)

 

The other part of the output is omitted.


Note:

In v7.0, v7.2, and v7.4 certain diagnostic commands may not function as expected with CLI scripts and result in no output.


Related documents:

7.0 administration-guide
7.2 administration-guide
7.4 administration-guide