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

How to identify CLI script errors

Hello,

I'm trying to upload CLI scripts from FG in 5.6.3 and I have noticed that when the script fails, the GUI reports the failure in the script execution history, but it does not tell me wtf the error is inside the script. As you can imagine, without this information in hand it is very difficult to locate CLI script errors in very large scripts. Does anybody know where/how can I locate this information?

 

Thanks

Andreas

1 Solution
Philippe_Gagne

Hi,

 

oupsss, use "diag debug cli 7". My mistake. I often use -1 in debug with application.

 

Can you tell me what you want to do?

 

Philippe

View solution in original post

6 REPLIES 6
Philippe_Gagne
Contributor

Hi,

 

Best way to do it: diag debug cli -1 in ssh windows then start you script.

 

All lines will start with 0: except errors! :)

 

Have a nice day!

 

Philippe

 

Toshi_Esumi

Thank you for the info. Looks like the level range is 1-8.  level 0 would disable it.

 

sea5601-fg1 # diag debug cli -1 Invalid level, set to level 5 sea5601-fg1 # diag debug info debug output:           disable console timestamp:      disable console no user log message:    disable CLI debug level:        5 sea5601-fg1 # diag debug cli ? <Integer>    Debug level (0 - 8). sea5601-fg1 (interface) # edit internal10 new entry 'internal10' added sea5601-fg1 (internal10) # end Attribute 'vdom' MUST be set. child return 0x0 Command fail. Return code -56

Philippe_Gagne

Hi,

 

oupsss, use "diag debug cli 7". My mistake. I often use -1 in debug with application.

 

Can you tell me what you want to do?

 

Philippe

Toshi_Esumi

I just saw you're useful comment and quickly ran it manually to see what I can get when a command fails (in the example "end" without any interface config). Do you know any descriptions somewhere about what exactly those levels do differently from the others?

Philippe_Gagne

Hi,

 

Sorry, I can't find each level description. I think, more level number is high, more details you will have. 

 

I use this command often when I write scripts. Very usefull! 

 

Have a nice day.

 

Philippe

 

 

aagrafi

Thank you for that. It certainly helps. Although I was expecting that the GUI should provide this information, debug cli is much better that searching inside the script for typos.

 

Cheers

Andreas

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors