This article provides information on how to compare two files or outputs of a command run at different timestamps on a SRX device.
Use this command incase you want to compare the output of a command run in time intervals to check for any specific counters
incrementing.
For troubleshooting purpose, we need to compare the output of a command run in an interval to check the counters.
On SRX devices, you can use the following command to find the difference between two outputs.
Example command and output:
Let us consider , for example the “no route present” counter is exhibiting a slow, constant increment. Something on the order of a few pps:
{primary:node0} root@srx01> show interfaces extensive reth1 | match route Jun 10 15:22:22 No route present: 532540 Protocol inet, MTU: 1500, Generation: 166, Route table: 7 Protocol multiservice, MTU: Unlimited, Generation: 167, Route table: 7 {primary:node0} root@srx01> show interfaces extensive reth1 | match route Jun 10 15:22:27 No route present: 532550 Protocol inet, MTU: 1500, Generation: 166, Route table: 7 Protocol multiservice, MTU: Unlimited, Generation: 167, Route table: 7 {primary:node0} root@srx01> show interfaces extensive reth1 | match route Jun 10 15:22:33 No route present: 532562 Protocol inet, MTU: 1500, Generation: 166, Route table: 7
We capture the output to a file ,
[capturing just route-related flow counters] root@srx01% srx-cprod.sh -s spu -c "show usp flow counters all" | grep "o route" > /var/tmp/route1 root@srx01% srx-cprod.sh -s spu -c "show usp flow counters all" | grep "o route" > /var/tmp/route2 root@srx01% diff -bwi /var/tmp/route1 /var/tmp/route2
We can check for the difference in the output as below :
[again, but capturing all flow counters] root@srx01% srx-cprod.sh -s spu -c "show usp flow counters all" > /var/tmp/route1 root@srx01% srx-cprod.sh -s spu -c "show usp flow counters all" > /var/tmp/route2 root@srx01% diff -bwi /var/tmp/route1 /var/tmp/route2 | grep -i error root@srx01% diff -bwi /var/tmp/route1 /var/tmp/route2 | grep -i route root@srx01% diff -bwi /var/tmp/route1 /var/tmp/route2 | grep -i discard root@srx01% diff -bwi /var/tmp/route1 /var/tmp/route2 | grep -i drop < Dropped 104776 > Dropped 104876 < First path drop: Policy check failed 3153195 > First path drop: Policy check failed 3153271 < Dropped 103518 > Dropped 103679 < Drop: Embedded ICMP no sess match 924 > Drop: Embedded ICMP no sess match 925 < First path drop: Policy check failed 3126084 > First path drop: Policy check failed 3126217 < Dropped 109511 > Dropped 109679 < First path drop: Policy check failed 3444588 > First path drop: Policy check failed 3444742 < Dropped 110346 > Dropped 110478 < First path drop: Policy check failed 3306174 > First path drop: Policy check failed 3306282 < Dropped 109385 > Dropped 109488 < First path drop: Policy check failed 3290553 > First path drop: Policy check failed 3290631 < Dropped 110971 > Dropped 111077 < First path drop: Policy check failed 3321878 > First path drop: Policy check failed 3321959 < Dropped 105374 > Dropped 105481 < First path drop: Policy check failed 3311204 > First path drop: Policy check failed 3311287
With this output, we are able to compare the counters, which will be helpful during the troubleshooting.