FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
ssriswadpong
Staff
Staff
Article Id 248991
Description

This article describes how to run auto-script and send the output to the FTP/TFTP server.

Scope FortiGate.
Solution

In this example, auto-script will be run when FortiGate enters conserve mode. This will be useful when troubleshooting the conserve mode issue.

 

  1. Create the auto-script:


config system auto-script
    edit "Collect logs"
        set script "
            get system status
            get system performance status
            get system session status

            diagnose sys top-mem 100
            diagnose sys top 1 99 10
            diagnose hardware sysinfo memory
            diagnose hardware sysinfo slab
            diagnose hardware sysinfo shm

                          "

    next
end

 

  1. Create automation-action.


    In this example, the FTP server IP address is 10.207.2.82 and username is 'admin' and the password is 'password'. The FTP server can be changed to a TFTP server and a username and password are not required for TFTP.

     

    config system automation-action
        edit "Send to FTP server"
            set action-type cli-script
            set script "execute auto-script backup ftp \"Collect logs\" 10.207.2.82:21 admin password"
            set accprofile "super_admin"
        next
        edit "Run collect logs"
            set action-type cli-script
            set script "execute auto-script start \"Collect logs\""
            set accprofile "super_admin"
        next
    end

     

     

  2. Create an automation-trigger for conserve mode.


    config system automation-trigger
        edit "Conserve Mode"
            set event-type low-memory
        next
    end

     

     

  3. Create automation-stitch.


    In this example, a delay of 15 seconds is added for waiting for the output of the auto-script.


    config system automation-stitch
        edit "Run auto-script"
            set trigger "Conserve Mode"
                config actions
                    edit 1
                        set action "Run collect logs"
                        set required enable
                    next
                    edit 2
                        set action "Send to FTP server"
                        set delay 15
                        set required enable
                    next
                end
        next
    end

     

    These can be configured in WebGUI under Security Fabric -> Automation:


    ssriswadpong_2-1678730568653.png


    When the FortiGate enters the conserve mode, the auto-script will be run and the output will be sent to the FTP server.


    ssriswadpong_0-1678730451553.png


    Sample of the output file:

     

    ssriswadpong_1-1678730511978.png