From 2da1bca1ac57c8626e873a688ffa480342f3aca3 Mon Sep 17 00:00:00 2001 From: Jacob McGill <9847006+jmcgill298@users.noreply.github.com> Date: Tue, 7 Jan 2025 13:31:12 -0500 Subject: [PATCH] adding juniper_junos_show_system_processes_summary.textfsm support (#1965) Co-authored-by: Joseph Nicholson Co-authored-by: Joseph Nicholson Co-authored-by: Michael Bear <38406045+mjbear@users.noreply.github.com> --- ntc_templates/templates/index | 1 + ...unos_show_system_processes_summary.textfsm | 23 +++++++++++ ...er_junos_show_system_processes_summary.raw | 39 +++++++++++++++++++ ...er_junos_show_system_processes_summary.yml | 9 +++++ 4 files changed, 72 insertions(+) create mode 100644 ntc_templates/templates/juniper_junos_show_system_processes_summary.textfsm create mode 100644 tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.raw create mode 100644 tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.yml diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 3f9780bc6b..24e7f40e88 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -720,6 +720,7 @@ ipinfusion_ocnos_show_lldp_table.textfsm, .*, ipinfusion_ocnos, show ll[[dp]] t[ juniper_junos_show_chassis_cluster_interfaces.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] i[[nterface]] juniper_junos_show_ethernet-switching_table.textfsm, .*, juniper_junos, sh[[ow]] et[[hernet-switching]] t[[able]] +juniper_junos_show_system_processes_summary.textfsm, .*, juniper_junos, sh[[ow]] sys[[tem]] proc[[esses]] sum[[mary]] juniper_junos_show_chassis_cluster_status.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] c[[luster]] s[[tatus]] juniper_junos_show_chassis_firmware.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] fi[[rmware]] juniper_junos_show_chassis_hardware.textfsm, .*, juniper_junos, sh[[ow]] ch[[assis]] ha[[ardware]] diff --git a/ntc_templates/templates/juniper_junos_show_system_processes_summary.textfsm b/ntc_templates/templates/juniper_junos_show_system_processes_summary.textfsm new file mode 100644 index 0000000000..6cfb943ce5 --- /dev/null +++ b/ntc_templates/templates/juniper_junos_show_system_processes_summary.textfsm @@ -0,0 +1,23 @@ +Value MEMORY_ACTIVE (\S+) +Value MEMORY_INACTIVE (\S+) +Value MEMORY_WIRED (\S+) +Value MEMORY_BUFFER (\S+) +Value MEMORY_FREE (\S+) +Value SWAP_TOTAL (\S+) +Value SWAP_FREE (\S+) + +Start + ^\s*last\s+pid + ^\s*\d+\s+threads: + ^\s*CPU: + ^\s*\d+\s*processes: + ^\s*Mem:\s*${MEMORY_ACTIVE}\s*Active,\s*${MEMORY_INACTIVE}\s*Inact,\s*${MEMORY_WIRED}\s*Wired,\s*${MEMORY_BUFFER}\s*Buf,\s*${MEMORY_FREE}\s*Free + ^\s*Mem:\s*${MEMORY_ACTIVE}\s*Active,\s*${MEMORY_INACTIVE}\s*Inact,\s*${MEMORY_WIRED}\s*Wired,\s*\d*\D*\s*Cache,\s*${MEMORY_BUFFER}\s*Buf,\s*${MEMORY_FREE}\s*Free + ^\s*Mem:\s*${MEMORY_ACTIVE}\s*Active,\s*${MEMORY_INACTIVE}\s*Inact,\s*\d*\D*\s*Laundry,\s*${MEMORY_WIRED}\s*Wired,\s*${MEMORY_BUFFER}\s*Buf,\s*${MEMORY_FREE}\s*Free + ^\s*Swap:\s*${SWAP_TOTAL}\s*Total,\s*${SWAP_FREE}\s*Free -> Record + ^\s*Swap:\s*${SWAP_TOTAL}\s*Total,\s*\d*\D*\s*Used,\s*${SWAP_FREE}\s*Free -> Record + ^\s*Swap:\s*${SWAP_TOTAL}\s*Total,\s*\d*\D*\s*Used,\s*${SWAP_FREE}\s*Free,\s*\d*%\s*Inuse -> Record + ^\s*Swap: -> Record + ^\s*PID\s+USERNAME\s+PRI\s+NICE\s+SIZE\s+RES\s+STATE\s+C\s+TIME\s+WCPU\s+COMMAND -> EOF + ^\s*$$ + ^. -> Error diff --git a/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.raw b/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.raw new file mode 100644 index 0000000000..c462157d23 --- /dev/null +++ b/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.raw @@ -0,0 +1,39 @@ +last pid: 24931; load averages: 0.89, 0.94, 0.81 up 41+06:26:24 00:51:55 +545 threads: 9 running, 481 sleeping, 1 zombie, 54 waiting +CPU: 14.7% user, 0.0% nice, 4.1% system, 0.2% interrupt, 81.0% idle +Mem: 3977M Active, 14G Inact, 1815M Wired, 504M Buf, 74G Free +Swap: 12G Total, 12G Free + + PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND + 11 root 155 ki31 0B 128K CPU7 7 787.8H 98.58% idle{idle: cpu7} + 11 root 155 ki31 0B 128K CPU0 0 931.9H 98.39% idle{idle: cpu0} + 11 root 155 ki31 0B 128K CPU2 2 783.0H 96.88% idle{idle: cpu2} + 11 root 155 ki31 0B 128K RUN 5 787.6H 96.78% idle{idle: cpu5} + 11 root 155 ki31 0B 128K CPU4 4 786.1H 96.68% idle{idle: cpu4} + 11 root 155 ki31 0B 128K CPU6 6 787.6H 93.26% idle{idle: cpu6} + 11 root 155 ki31 0B 128K CPU1 1 785.5H 91.70% idle{idle: cpu1} + 11 root 155 ki31 0B 128K CPU3 3 785.6H 90.67% idle{idle: cpu3} +19880 root 25 0 801M 74M select 2 132.6H 15.09% cosd +19926 root 24 0 735M 27M select 7 113.5H 11.87% snmpd +19929 root 22 0 805M 86M select 3 81.9H 9.28% mib2d +19876 root 21 0 14G 13G kqread 3 938.4H 2.69% rpd{rpd} +19876 root 21 0 14G 13G kqread 3 20.3H 2.69% rpd{junos-bgpshard3} +19876 root 21 0 14G 13G kqread 4 20.3H 1.76% rpd{junos-bgpshard0} +19876 root 20 0 14G 13G kqread 0 24.6H 1.46% rpd{junos-bgpshard2} +19914 root 21 0 839M 118M select 5 18.4H 1.37% jinsightd{jinsightd} +19876 root 20 0 14G 13G kqread 1 22.2H 1.27% rpd{junos-bgpshard1} + 12 root -60 - 0B 864K WAIT 0 69:18 1.17% intr{swi4: clock (0)} +19315 root 21 0 880M 78M select 6 898:25 0.98% chassisd{chassisd} +19921 root 20 0 131M 49M select 2 596:38 0.59% na-grpcd{na-grpcd} +19876 root 20 0 14G 13G kqread 6 489:58 0.59% rpd{bgp-updio-3} +24926 remote 20 0 95M 25M select 1 0:00 0.59% cli + 12 root -92 - 0B 864K WAIT 0 162:55 0.49% intr{irq271: ixlv0:que 0} +24923 root 22 0 756M 13M select 7 0:00 0.29% sshd + 12 root -72 - 0B 864K WAIT 1 417:28 0.20% intr{swi1: netisr 2} +19352 root 20 0 724M 8544K select 2 106:54 0.20% timingd{ptp_stack} +24925 remote 20 0 756M 13M select 6 0:00 0.20% sshd +19858 root -16 - 0B 16K select 1 184:43 0.10% ppt_11_80000010 +19743 root -16 - 0B 16K select 7 172:15 0.10% ppt_11_80000013 +21670 root -16 - 0B 16K select 0 166:12 0.10% ppt_11_80000015 + 2 root -16 - 0B 16K jfe_jo 2 138:19 0.10% jfe_job_0_0 +24931 root 20 0 14M 3636K CPU5 5 0:00 0.00% top diff --git a/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.yml b/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.yml new file mode 100644 index 0000000000..da3ccdc0bc --- /dev/null +++ b/tests/juniper_junos/show_system_processes_summary/juniper_junos_show_system_processes_summary.yml @@ -0,0 +1,9 @@ +--- +parsed_sample: + - memory_active: "3977M" + memory_buffer: "504M" + memory_free: "74G" + memory_inactive: "14G" + memory_wired: "1815M" + swap_free: "12G" + swap_total: "12G"