Fortinet white logo
Fortinet white logo

Administration Guide

Use Tcl script to access FortiManager’s device database or ADOM database

Use Tcl script to access FortiManager’s device database or ADOM database

You can use Tcl script to access FortiManager’s device database or ADOM database (local database). The option to run a TCL script on remote FortiGate directly (via CLI) should be still used. However, for any portion of a script that needs to be run on a local database, FortiManager uses a syntax within the TCL script exec_ondb to define it.

Example 1:

Run the Tcl script on an ADOM database for a specify policy package. For example, creating new a policy or object:

Syntax

puts [exec_ondb "/adom/<adom_name>/pkg/<pkg_fullpath>" "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/52/pkg/default" "

config firewall address

edit port5_address

next

end

" "# "]

Example 2:

Run the Tcl script on the current ADOM database for a specify policy package. For example, creating a new policy and object:

Syntax

puts [exec_ondb "/adom/./pkg/<pkg_fullpath>" "embedded cli commands" "# "]

or

puts [exec_ondb "/pkg/<pkg_fullpath>" "embeded cli commands" "# "]

Usage

puts [exec_ondb "/adom/./pkg/default" "

config firewall address

edit port5_address

next

end

" "# "]

Example 3:

Run Tcl script on a specific device in an ADOM:

Syntax

puts [exec_ondb "/adom/<adom_name>/device/<dev_name>" "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/v52/device/FGT60CA" "

config global

config system global

set admintimeout 440

end

end

" "# "]

Example 4:

Run Tcl script on current devices in an ADOM:

Syntax

puts [exec_ondb "/adom/<adom_name>/device/." "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/v52/device/." "

config global

config system global

set admintimeout 440

end

end

" "# "]

exec_ondb cannot be run on the Global ADOM.

Use Tcl script to access FortiManager’s device database or ADOM database

Use Tcl script to access FortiManager’s device database or ADOM database

You can use Tcl script to access FortiManager’s device database or ADOM database (local database). The option to run a TCL script on remote FortiGate directly (via CLI) should be still used. However, for any portion of a script that needs to be run on a local database, FortiManager uses a syntax within the TCL script exec_ondb to define it.

Example 1:

Run the Tcl script on an ADOM database for a specify policy package. For example, creating new a policy or object:

Syntax

puts [exec_ondb "/adom/<adom_name>/pkg/<pkg_fullpath>" "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/52/pkg/default" "

config firewall address

edit port5_address

next

end

" "# "]

Example 2:

Run the Tcl script on the current ADOM database for a specify policy package. For example, creating a new policy and object:

Syntax

puts [exec_ondb "/adom/./pkg/<pkg_fullpath>" "embedded cli commands" "# "]

or

puts [exec_ondb "/pkg/<pkg_fullpath>" "embeded cli commands" "# "]

Usage

puts [exec_ondb "/adom/./pkg/default" "

config firewall address

edit port5_address

next

end

" "# "]

Example 3:

Run Tcl script on a specific device in an ADOM:

Syntax

puts [exec_ondb "/adom/<adom_name>/device/<dev_name>" "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/v52/device/FGT60CA" "

config global

config system global

set admintimeout 440

end

end

" "# "]

Example 4:

Run Tcl script on current devices in an ADOM:

Syntax

puts [exec_ondb "/adom/<adom_name>/device/." "embedded cli commands" "# "]

Usage

puts [exec_ondb "/adom/v52/device/." "

config global

config system global

set admintimeout 440

end

end

" "# "]

exec_ondb cannot be run on the Global ADOM.