Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
tecepeipe
New Contributor

Scripts Running Directly on devices get stuck

Hi there,

 

I'm going to monitor the health/status/performance of my fortigate devices using a script I've found online. [1]

It was supposed to execute using SSH/Bash, but as I do have a Fortimanager, I'd like to execute it periodically.

As this script collects some live data, it's required to execute it directly instead against the local database.

 

I have others scripts working pretty well. For configuring alertemails, timezone and so on. However, they are intended to run agains the database then install the new configuration.

 

This script that runs directly hangs after 30%.

Checking the log output I can only see config global / end... nothing else. (my 2 devices have vdom enabled)

It's a new environment. Recently erased fortimanager / with 2 800c factory defaults fortigates with vdom enabled (none created)

 

The script contents that makes it hangs is:

   config global    execute date    execute time    get system status

 

The original script was bigger but, if I've reduced it to just that above to debug.

Everytime that I add this last line it hangs. If I remove it, it runs well.

I've replaced this faulty line for 'get system performance status' but nothing has changed. Still hangs.

I've tried to set system console output to standard but didn't help.

And tried to run just in one device... or the other one.

 

Any ideas?

 

1-http://kb.fortinet.com/kb/documentLink.do?externalID=FD34839

 

Regards,

Fabricio Lima

 

 

2 REPLIES 2
tecepeipe
New Contributor

I've solved my issue inverting the order of the commands. (???)

 

I moved the 'exec date/time' to the bottom.

 

Here the working scripting scheduled to run each hour:

 

config global  get system status  get system performance status  diagnose sys logdisk usage  get system ha status  diagnose sys session stat  diagnose sys session6 stat  diagnose hardware sysinfo mem  diagnose hardware sysinfo shm  diagnose npu np6 stats 0  diagnose npu spm stats 0  diagnose debug crashlog get  diagnose debug crashlog clear  diagnose debug crash get  diagnose debug crash clear  execute date  execute time end

tecepeipe
New Contributor

Hi, I've solved my own issue changing command's execution order!

 

Putting the get date/time commands in the bottom, it works! Odd....

 

 1 config global 

2  get system status 

3  get system performance status 

4  diagnose sys logdisk usage 

5  get system ha status 

6  diagnose sys session stat 

7  diagnose sys session6 stat 

8  diagnose hardware sysinfo mem 

9  diagnose hardware sysinfo shm

10  diagnose npu np4 stats 0

11  diagnose npu np6 stats 0

12  diagnose npu spm stats 0

13  diagnose debug crashlog get

14  diagnose debug crashlog clear

15  diagnose debug crash get

16  diagnose debug crash clear

17  execute date

18  execute time

19 end

Labels
Top Kudoed Authors