This article describes how to use the automated scripting on FortiGate.
#config system auto-scriptwhereas in this example:
edit "backup"
set interval 120 <----- Interval of time in seconds to execute the task.
set repeat 0 <----- Time of repeats, 0 means always. Default is 1.
set start auto
set script "execute backup config ftp backup.conf 10.10.10.2 test test"
next
end
# config system auto-scriptwhere:
edit "backup"
set interval 120
set repeat 0
set start auto
set script "
# config global
# execute backup config ftp backup.conf 10.10.10.2 test test"
next
end
#get system status
#get system performance status
FGT # config system auto-scriptTo check the script output stored in the file.
FGT (auto-script) # edit "status"
FGT (status) # set interval 300
FGT (status) # set repeat 0
FGT (status) # set start auto
FGT (status) # set script " <----- Press enter key here add first command.
> get system status <----- Press enter key here and add second command in next line.
> get system performance status" <----- Make sure that the last command ends with double quotation mark. Once double quotation mark is added, it will redirect to the command prompt.
FGT (status) # sh
# config system auto-script
edit "status"
set interval 120
set repeat 0
set start auto
set script "
# get system status
# get system performance status
"
next
end
# exec auto-script result status
Script status output:
########## script name: status ##########
========== #1, 2019-10-01 14:24:04 ==========
FGT $ get system status
Version: FortiGate-100D v6.2.1,build0932,190716 (GA)
Virus-DB: 72.00005(2019-10-01 03:19)
Extended DB: 1.00000(2018-04-09 18:07)
... output continues ...
To view results of the script named “status” (with VDOMs - enter it in global)
# config global
# exec auto-script result status
# exec auto-script start “name”Other examples:
# exec auto-script stop “name” or stopall
# config system auto-scriptTo get a session list every 10 seconds for the IP 10.10.10.48
edit "firewall-user-list"
set interval 5
set repeat 0
set script "diag firewall auth list | grep 172.16.17.132 -A 7"
set output-size 100
next
edit "auth-user-list"
set interval 5
set repeat 0
set script "diag debug auth fsso list | grep 172.16.17.132"
set output-size 100
next
end
# exec auto-script start firewall-user-list
# exec auto-script start auth-user-list
# config system auto-script
edit "session-list"
set interval 5
set repeat 0
set script "diag sys session filter src 10.10.10.48
# diag sys session list"
set output-size 100
next
end
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 2023 Fortinet, Inc. All Rights Reserved.