Day One Tips
Day One Tips

Tip - using refresh option to collect repeated outputs

[ Edited ]
‎01-09-2017 06:35 PM

Hi all,

 

During troubleshooting, we often need to collect certain outputs periodically to see if there is any difference. For example:

 

- we may need to check the traffic rate on an interface periodically to see if there is an increase or dip in traffic.

- if we have to monitor CPU utilization of a line card to see if it is increasing or not

- or if a particular FRU is coming online or not

- or to check the temperature of the a FRU periodically etc...

 

For all such activities we usually type the command manually multiple times or use the "up" arrow key on our keyboard to execute the CLI command again.

 

Starting from Junos 13.3, there is an option to use the "refresh" knob where you can specify the internal after which you want to repeat the same CLI command again. This knob is very handy and useful for executing the CLI commands repeatedly.

 

By default the refresh internal is set to 1 second, so the CLI command will get executed again every second.

 

You can modify the internal as per the requirement.

 

Here is an example where I am using this command to check the rate of traffic on an interface:

 

root@lab-re0> show interfaces et-4/3/0 | match rate | refresh 1
---(refreshed at 2017-01-10 07:50:06 IST)---
  Input rate     : 0 bps (0 pps)
  Output rate    : 0 bps (0 pps)
---(refreshed at 2017-01-10 07:50:07 IST)---
  Input rate     : 0 bps (0 pps)
  Output rate    : 0 bps (0 pps)
---(refreshed at 2017-01-10 07:50:08 IST)---
  Input rate     : 0 bps (0 pps)
  Output rate    : 0 bps (0 pps)
---(*more 100%)---[abort]

 

In below example, I am checking the CPU utilization of FPC every 5 seconds:

 

root@lab-re0> show chassis fpc 4 | refresh 5
---(refreshed at 2017-01-10 08:02:54 IST)---
                     Temp  CPU Utilization (%)   Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      DRAM (MB) Heap     Buffer
  4  Online            45      7          0       3584        5         24
---(refreshed at 2017-01-10 08:02:59 IST)---
                     Temp  CPU Utilization (%)   Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      DRAM (MB) Heap     Buffer
  4  Online            45      9          0       3584        5         24
---(refreshed at 2017-01-10 08:03:04 IST)---
                     Temp  CPU Utilization (%)   Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      DRAM (MB) Heap     Buffer
  4  Online            45      9          0       3584        5         24
---(refreshed at 2017-01-10 08:03:09 IST)---
                     Temp  CPU Utilization (%)   Memory    Utilization (%)
Slot State            (C)  Total  Interrupt      DRAM (MB) Heap     Buffer
  4  Online            45      9          0       3584        5         24
---(*more 100%)---[abort]

 

To come out of this command execution, you can use "Ctrl + C".

 

For reference:

Refreshing the Output of a Command

 

Thanks

Hope this helps

--------------------------------------------------------------------------------------------------------
If this post was helpful, please mark this post as an "Accepted Solution".
Kudos are always appreciated!
--------------------------------------------------------------------------------------------------------