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

adding juniper_junos_show_system_processes_brief.textfsm support #1922

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jnicholson56
Copy link

adding juniper_junos_show_system_processes_brief.textfsm support

Copy link
Contributor

@jmcgill298 jmcgill298 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jnicholson56 just a couple of minor adjustments.

Comment on lines +4 to +7
Value MEM_ACTIVE (\d*\D*\d*)
Value MEM_FREE (\d*\D*\d*)
Value MEM_USED (\d*\D*\d*)
Value MEM_BUFFER (\d*\D*\d*)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Value MEM_ACTIVE (\d*\D*\d*)
Value MEM_FREE (\d*\D*\d*)
Value MEM_USED (\d*\D*\d*)
Value MEM_BUFFER (\d*\D*\d*)
Value MEMORY_ACTIVE (\d*\D*\d*)
Value MEMORY_FREE (\d*\D*\d*)
Value MEMORY_USED (\d*\D*\d*)
Value MEMORY_BUFFER (\d*\D*\d*)

We should keep this consistent

^top\s*
^Tasks:\s*
^\%Cpu
^${MEMORY_FORMAT}iB\s*Mem\s*:\s*${MEM_ACTIVE}\s*total,\s*${MEM_FREE}\s*free,\s*${MEM_USED}\s*used,\s*${MEM_BUFFER}\s*buff/cache\s*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
^${MEMORY_FORMAT}iB\s*Mem\s*:\s*${MEM_ACTIVE}\s*total,\s*${MEM_FREE}\s*free,\s*${MEM_USED}\s*used,\s*${MEM_BUFFER}\s*buff/cache\s*
^${MEMORY_FORMAT}i*B\s*Mem\s*:\s*${MEMORY_ACTIVE}\s*total,\s*${MEMORY_FREE}\s*free,\s*${MEMORY_USED}\s*used,\s*${MEMORY_BUFFER}\s*buff/cache\s*

I think the i could not be present depending on what storage is being used

^Tasks:\s*
^\%Cpu
^${MEMORY_FORMAT}iB\s*Mem\s*:\s*${MEM_ACTIVE}\s*total,\s*${MEM_FREE}\s*free,\s*${MEM_USED}\s*used,\s*${MEM_BUFFER}\s*buff/cache\s*
^${SWAP_FORMAT}iB\s*Swap:\s*${SWAP_TOTAL}\s*total,\s*${SWAP_FREE}\s*free,\s*${SWAP_USED}\s*used\.\s*${SWAP_AVAIL}\s*avail\s*Mem\s* -> Record
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
^${SWAP_FORMAT}iB\s*Swap:\s*${SWAP_TOTAL}\s*total,\s*${SWAP_FREE}\s*free,\s*${SWAP_USED}\s*used\.\s*${SWAP_AVAIL}\s*avail\s*Mem\s* -> Record
^${SWAP_FORMAT}i*B\s*Swap:\s*${SWAP_TOTAL}\s*total,\s*${SWAP_FREE}\s*free,\s*${SWAP_USED}\s*used\.\s*${SWAP_AVAIL}\s*avail\s*Mem\s* -> Record

^{master}
^. -> Error

EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EOF

I don't think the EOF is necessary since there aren't any FillDowns

Tasks: 407 total, 1 running, 406 sleeping, 0 stopped, 0 zombie
%Cpu(s): 2.1 us, 2.7 sy, 0.0 ni, 94.6 id, 0.0 wa, 0.3 hi, 0.3 si, 0.0 st
MiB Mem : 128191.6 total, 93230.9 free, 6286.2 used, 28674.5 buff/cache
MiB Swap: 4096.0 total, 1131.7 free, 2964.2 used. 119812.1 avail Mem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
MiB Swap: 4096.0 total, 1131.7 free, 2964.2 used. 119812.1 avail Mem
MiB Swap: 4096.0 total, 1131.7 free, 2964.2 used. 119812.1 avail Mem

Comment on lines +3 to +28
- mem_active: "31554.4"
mem_buffer: "3661.7"
mem_free: "17292.4"
mem_used: "10600.3"
memory_format: "M"
node: "fpc0"
swap_avail: "19854.3"
swap_format: "M"
swap_free: "100.0"
swap_total: "100.0"
swap_used: "0.0"
- mem_active: "128191.6"
mem_buffer: "45096.8"
mem_free: "65543.4"
mem_used: "17551.4"
memory_format: "M"
node: "re0"
swap_avail: "108490.7"
swap_format: "M"
swap_free: "8192.0"
swap_total: "8192.0"
swap_used: "0.0"
- mem_active: "128191.6"
mem_buffer: "28674.5"
mem_free: "93230.9"
mem_used: "6286.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- mem_active: "31554.4"
mem_buffer: "3661.7"
mem_free: "17292.4"
mem_used: "10600.3"
memory_format: "M"
node: "fpc0"
swap_avail: "19854.3"
swap_format: "M"
swap_free: "100.0"
swap_total: "100.0"
swap_used: "0.0"
- mem_active: "128191.6"
mem_buffer: "45096.8"
mem_free: "65543.4"
mem_used: "17551.4"
memory_format: "M"
node: "re0"
swap_avail: "108490.7"
swap_format: "M"
swap_free: "8192.0"
swap_total: "8192.0"
swap_used: "0.0"
- mem_active: "128191.6"
mem_buffer: "28674.5"
mem_free: "93230.9"
mem_used: "6286.2"
- memory_active: "31554.4"
memory_buffer: "3661.7"
memory_free: "17292.4"
memory_used: "10600.3"
memory_format: "M"
node: "fpc0"
swap_avail: "19854.3"
swap_format: "M"
swap_free: "100.0"
swap_total: "100.0"
swap_used: "0.0"
- memory_active: "128191.6"
memory_buffer: "45096.8"
memory_free: "65543.4"
memory_used: "17551.4"
memory_format: "M"
node: "re0"
swap_avail: "108490.7"
swap_format: "M"
swap_free: "8192.0"
swap_total: "8192.0"
swap_used: "0.0"
- memory_active: "128191.6"
memory_buffer: "28674.5"
memory_free: "93230.9"
memory_used: "6286.2"

Value SWAP_AVAIL (\d*\D*\d*)

Start
^-------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
^-------------------------------
^-+\s*$$

We can match however many dashes there are

Start
^-------------------------------
^node:\s*${NODE}
^-------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
^-------------------------------

matched be existing regex

^\%Cpu
^${MEMORY_FORMAT}iB\s*Mem\s*:\s*${MEM_ACTIVE}\s*total,\s*${MEM_FREE}\s*free,\s*${MEM_USED}\s*used,\s*${MEM_BUFFER}\s*buff/cache\s*
^${SWAP_FORMAT}iB\s*Swap:\s*${SWAP_TOTAL}\s*total,\s*${SWAP_FREE}\s*free,\s*${SWAP_USED}\s*used\.\s*${SWAP_AVAIL}\s*avail\s*Mem\s* -> Record
^\s+\S+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
^\s+\S+

This is a little too loose of a match, and could lead to incorrect parsing without raising an error. I don't see any example of this in the provided test case, is this something you would expect to see?

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.

2 participants