Fortinet 5.
4 CLI Scripting
config system auto-script
edit "getSystemInfo"
#^^^___DS
#The number of seconds the script will sleep if the repeat is greater than 1. Default: 0
set interval 0
#The number of times the command should be executed. Default: 1
set repeat 1
#Whether the script should be started automatically or manually. Default: manual
set start manual
# Capture OS Version
set script "get system status | grep Version
# Output routes
get router info routing-table all
# View crash log
#diagnose debug crashlog read
"
next
end
Run the Script
FG80EP4Q16000100 # execute auto-script start getSystemInfo
View the Script output
FG80EP4Q16000100 # execute auto-script result getSystemInfo
Send the output to an FTP or TFTP server
FG80EP4Q16000100 # execute auto-script backup
ftp Backup output file to FTP sever.
tftp Backup output file to TFTP sever
Sample Output from my script
FG80EP4Q16000100 # execute auto-script result getSystemInfo
Script getSystemInfo output:
########## script name: getSystemInfo ##########
========== #1, 2017-09-19 12:04:59 ==========
FG80EP4Q16000100 $ get system status | grep Version
Version: FortiGate-80E-POE v5.4.3,build5885,161221 (GA)
Release Version Information: GA
FG80EP4Q16000100 $ get router info routing-table all
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
S* 0.0.0.0/0 [5/0] via 81.1.115.55, ppp1
C 81.1.115.55/32 is directly connected, ppp1
C 92.17.13.70/32 is directly connected, ppp1
C 192.168.1.0/24 is directly connected, lan
C 192.168.2.0/24 is directly connected, TwoTimes_Wifi