Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Juniper junos show system processes brief #1974

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

jnicholson56
Copy link
Contributor

Updating juniper_junos_show_system_processes_brief.textfsm to support both Classic and EVO varieties of Junos.

@jnicholson56
Copy link
Contributor Author

Set this to draft status until it is verified by someone else. This does work when using output from both Junos Classic and EVO. I had to make a few adjustments to the template to make it work for both properly. I tested using the Nornir site and the output in the test files I provided.

@jnicholson56
Copy link
Contributor Author

I did a double check for the {master} in the router output. Netmiko strips that data out, but other sources such as Ansible do not. In Dual RE setups, Junos EVO is returning the {master} designation in the output. I can also verify this with a | display output on the CLI itself.

@mjbear
Copy link
Contributor

mjbear commented Jan 14, 2025

I did a double check for the {master} in the router output. Netmiko strips that data out, but other sources such as Ansible do not. In Dual RE setups, Junos EVO is returning the {master} designation in the output. I can also verify this with a | display output on the CLI itself.

Thank you for verifying.

What I found does indicate the {master} output is natively sent back by the JunOS device and Netmiko has code in place to trim that text out.
ktbyers/netmiko#1328
https://github.com/ktbyers/netmiko/pull/2787/files

…ief.textfsm

Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com>
@jnicholson56
Copy link
Contributor Author

I did a double check for the {master} in the router output. Netmiko strips that data out, but other sources such as Ansible do not. In Dual RE setups, Junos EVO is returning the {master} designation in the output. I can also verify this with a | display output on the CLI itself.

Thank you for verifying.

What I found does indicate the {master} output is natively sent back by the JunOS device and Netmiko has code in place to trim that text out. ktbyers/netmiko#1328 https://github.com/ktbyers/netmiko/pull/2787/files

I concur with that. Ansible on the other hand which can use textfsm templates, does not strip that out.

@jnicholson56
Copy link
Contributor Author

The suggested fix of ^%Cpu\s+ did not work. The output does not have a space after Cpu.

Output:
%Cpu(s): 0.4 us, 0.8 sy, 0.0 ni, 98.5 id, 0.0 wa, 0.4 hi, 0.0 si, 0.0 st

I updated that line in the template to ^%Cpu\(s\):\s+ which should work.

@mjbear Out of curiosity, when we are adding lines to the template like this that cover the line being there but don't actually capture anything, is there a rule of thumb as to how much of the line to add?

@mjbear
Copy link
Contributor

mjbear commented Jan 15, 2025

The suggested fix of ^%Cpu\s+ did not work. The output does not have a space after Cpu.

Output: %Cpu(s): 0.4 us, 0.8 sy, 0.0 ni, 98.5 id, 0.0 wa, 0.4 hi, 0.0 si, 0.0 st

I updated that line in the template to ^%Cpu\(s\):\s+ which should work.

Ooops on my part there. 😞
Good you fixed it.

@mjbear Out of curiosity, when we are adding lines to the template like this that cover the line being there but don't actually capture anything, is there a rule of thumb as to how much of the line to add?

That's where I was headed.
From everything I've heard or seen there isn't an absolute project rule on that.
Oftentimes when it's tabular data with column headers at the top, the exact headers will be added. However in this case it's a bit different since the labels for user/system/nice/idle/wait/hw irq/soft irq/steal CPU time are inline with the data.

@jnicholson56
Copy link
Contributor Author

That's where I was headed. From everything I've heard or seen there isn't an absolute project rule on that. Oftentimes when it's tabular data with column headers at the top, the exact headers will be added. However in this case it's a bit different since the labels for user/system/nice/idle/wait/hw irq/soft irq/steal CPU time are inline with the data.

In this template I set the values that applied to me to variables and ignored the rest. After thinking about this a bit more, I am going to update this template and future ones to include all of the values listed in case those apply to someone else. That seems like the more complete way of doing this so others don't have to circle back later and "finish" the incomplete template I am contributing.

@jnicholson56
Copy link
Contributor Author

I am going to make this PR ready for review. I don't think I can do anything else to it unless there is some bad syntax that someone points out.

I skipped adding collection for the top uptime lines in both EVO and Classic. They were not quick and simple to get working and in reality that data has better methods of collection in Junos and other templates anyway.

@jnicholson56 jnicholson56 marked this pull request as ready for review January 15, 2025 15:24
@mjbear
Copy link
Contributor

mjbear commented Jan 15, 2025

In this template I set the values that applied to me to variables and ignored the rest. After thinking about this a bit more, I am going to update this template and future ones to include all of the values listed in case those apply to someone else. That seems like the more complete way of doing this so others don't have to circle back later and "finish" the incomplete template I am contributing.

You don't have to capture all the data unless there's really value in capturing that data (reference).

(Use your best judgement, hehe.)

@jnicholson56
Copy link
Contributor Author

You don't have to capture all the data unless there's really value in capturing that data (reference).

(Use your best judgement, hehe.)

I understand and can see there may be value to others by adding the capture now. There just was not value in my particular use case so I never bothered capturing the data. Other than the top uptime lines, it was pretty quick and easy to add the other two lines to the template using the syntax we had already established in the work I had submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants