FortiAnalyzer
FortiAnalyzer can receive logs and Windows host events directly from endpoints connected to EMS, and you can use FortiAnalyzer to analyze the logs and run reports.
mrashid
Staff
Staff
Article Id 299056
Description

This article describes how to update device geo coordinated under the FortiAnalyzer manager by using the Tcl script in FortiManager.

FortiAnalyzer does not automatically configure geo coordinates under dvm and it is necessary to configure manually under device manager or configure values for gui-device-latitude and gui-device-longitude parameters under FortiGate global config. FortiAnalyzer will automatically learn these coordinated through oftpd.

Scope FortiAnalyzer, FortiManager.
Solution
  • Run the below script from FortiManager on remote devices. This script will fetch the geo-coordinates from the WAN interface and configure them under global settings.
  • Configure and run below Tcl script from FortiManager:

 

#!

proc get_geo_coord gcoord {

upvar $gcoord a

set input [exec " dia sys  waninf\n" "# " 15 ]

set linelist [split $input \n]

foreach line $linelist {

if {![regexp {([^:]+):(.*)} $line dummy key value]} continue

switch -regexp -- $key {

Latitude {

set a(latitude) [string trim $value]

}

Longitude {

set a(longitude) [string trim $value]

}}

}

}

get_geo_coord coord

proc do_upd {cmd} {

puts [exec "$cmd\n" "# " 15]

}

do_upd "config system global"

do_upd "set gui-device-latitude $coord(latitude)"

do_upd "set gui-device-longitude $coord(longitude)"

do_upd "end"

 

In the first part of script, geo coordinates are fetched from the device and configured under device settings

 

 

  • Verify that script execution is successful in FortiManager.

After script execution gui-device-latitude and gui-device-longitude parameter values are updated successfully.

 

Coords saved under device global config.PNG

 

After parameters configurations, FortiAnalyzer will learn through oftpd and update geographic coordinates under the device manager.

 

Device coordinates after coordinates updated.PNG

 

Note:

Make sure the correct admin user and password are configured for the device under the FortiManager device manager. Otherwise, the Tcl script will not run.

 

Related documents:

Technical Tip: How to troubleshoot TCL Scripts failed in FortiManager

Tcl scripts

 

Contributors