Skip to content

utilities debug_output.py

Ondrej Holecek edited this page Oct 19, 2018 · 4 revisions

Summary

This utility is used to enable some debug outputs (usually with 'diagnose debug application ...' but other commands will work too) and capture the data appearing on the terminal.

The program automatically takes care of the SSH session timeout - by default it sends a space and backspace characters every 30 seconds. The string can be changed with --keepalive-string option and the timeout with --keepalive-time option. By default the program automatically removes the string from displayed outputs, but in case you use some general purpose string (such as '\n') you may want to disable this feature with --no-remove-string option.

By default the output is printed on standard output (if --no-stdout is not used). Additionally the same output can be appended to a file specified with --outfile parameter. If you want to overwrite the output file instead of appending at the end, use ! as the first character.

Automatic commands

Normally you don't need to bother with enabling debugging, timestamps, etc. The application automatically runs following commands before the commands entered by user:

  • diagnose debug reset
  • diagnose debug duration 0
  • diagnose debug console timestamp enable

And following commands after the commands entered by user:

  • diagnose debug enable

In some cases (like debugging in multiple instances) you might want to disable this automatisation. In that case the command line parameters --no-auto-commands can be used. In that case you need to enter all commands manually and in the right order.

Context

By default all commands are executed in the global context in the order they appear on the command line. The context can be changed globally with --vdom or --mgmt-vdom parameters.

Also the context can be specified for each command individually with <...> command prefix:

  • <> Means to run the command in management VDOM.
  • <global> Means to run it in global context.
  • <vdom_name> Will run the command in the context of VDOM vdom_name.

Example

Simple IKE debug with output also written to output.txt file in the local directory:

$ ./debug_output.py --host 10.0.0.1 --command 'diag deb app ike -1' --command 'diag debug app zebos-launcher -1' --outfile output.txt
[2018-10-19 10:15:14+02:00] (diagnose_debug_reset)
[2018-10-19 10:15:14+02:00] (diagnose_debug_duration_0) Current duration is set to unlimited.
[2018-10-19 10:15:14+02:00] (diagnose_debug_duration_0)
[2018-10-19 10:15:14+02:00] (diagnose_debug_console_timestamp_enable)
[2018-10-19 10:15:14+02:00] (diag_deb_app_ike_-1) Debug messages will be on for unlimited time.
[2018-10-19 10:15:14+02:00] (diag_deb_app_ike_-1)
[2018-10-19 10:15:14+02:00] (diag_debug_app_zebos-launcher_-1) Debug messages will be on for unlimited time.
[2018-10-19 10:15:14+02:00] (diag_debug_app_zebos-launcher_-1)
[2018-10-19 10:15:14+02:00] (diagnose_debug_enable)
2018-10-19 10:17:10.769018 ike 0:Priv_pxxxx: link is idle 54 2.2.2.2->1.1.1.1:0 dpd=2 seqno=10b5
2018-10-19 10:17:10.769047 ike 0:Priv_pxxxx:7893: send IKEv1 DPD probe, seqno 4277
2018-10-19 10:17:10.769126 ike 0:Priv_pxxxx:7893: enc D606FAF9600029C07E39318AE000010B5[...]
2018-10-19 10:17:10.769142 ike 0:Priv_pxxxx:7893: out D606FAF96F7E740EED1A66D54DA16A368[...]
2018-10-19 10:17:10.769169 ike 0:Priv_pxxxx:7893: sent IKE msg (R-U-THERE): 2.2.2.2:500->1.1.1.1:500, len=108, id=xxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxx:3316b6cd
2018-10-19 10:17:10.778309 ike 0: comes 1.1.1.1:500->2.2.2.2:500,ifindex=54....
2018-10-19 10:17:10.778321 ike 0: IKEv1 exchange=Informational id=xxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxx:ad56b3df len=108
2018-10-19 10:17:10.778327 ike 0: in D606FAF96F7E739B10D09C07E39318AE081005[...]
2018-10-19 10:17:10.778342 ike 0:Priv_pxxxx:7893: dec D606FAF96F7E739B10D09C07E39318AE0810[...]
2018-10-19 10:17:10.778357 ike 0:Priv_pxxxx:7893: notify msg received: R-U-THERE-ACK
[...]
Clone this wiki locally