[j-nsp] BGP Peer formatting
Michael Loftis
mloftis at wgops.com
Tue Sep 23 13:24:34 EDT 2014
For me at least, peer column needs to be wider (IPv6!) and duration
does too ( less than 1w you get a format like "2d 22:22:40")
On Mon, Sep 22, 2014 at 9:11 PM, Ben Dale <bdale at comlinx.com.au> wrote:
>
> On 23 Sep 2014, at 1:48 pm, Phil Shafer <phil at juniper.net> wrote:
>
>> Ben Dale writes:
>>> Okay, one small caveat to this script - it looks like the use of mutable variables (mvar
>>> and set) was only introduced in SLAX 1.1 / Junos 12.2, so it's actually not going to wo
>>> rk on older versions of Junos.
>>>
>>> I know 11.4 is the trusted choice for most people on MX at the moment, so when I get som
>>> e time I'll attempt a mind-bending re-write using the older immutable var format.
>>
>> In this case, you don't need the mvars. Let sum() do the iteration:
>>
>> for-each ($neighbour-list/bgp-peer) {
>> <output> jcs:printf("%-20s%-15s%-12s%-10s%-10s%-10s%-10s%-5s",
>> peer-address,
>> peer-as,
>> peer-state,
>> elapsed-time,
>> sum(bgp-rib/active-prefix-count),
>> sum(bgp-rib/received-prefix-count),
>> sum(bgp-rib/accepted-prefix-count),
>> description);
>> }
>>
>> Thanks,
>> Phil
>
> Love your work Phil : )
>
> That's a heck of a lot simpler/cleaner than the recursive monstrosity I've been putting together!
>
> Changes have been pulled into github, so if you're running 11.4 or earlier, give it another try now.
>
> Ben
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp
--
"Genius might be described as a supreme capacity for getting its possessors
into trouble of all kinds."
-- Samuel Butler
More information about the juniper-nsp
mailing list