diff --git a/templates/cisco_ios_show_power_available.template b/templates/cisco_ios_show_power_available.template new file mode 100644 index 0000000000..94183f2c5b --- /dev/null +++ b/templates/cisco_ios_show_power_available.template @@ -0,0 +1,24 @@ +#### +# For 4500 switches +### +Value SYS_USED_WATTS (\d+) +Value SYS_AVAIL_WATTS (\d+) +Value INLINE_USED_WATTS (\d+) +Value INLINE_AVAIL_WATTS (\d+) +Value BACKPLANE_USED_WATTS (\d+) +Value BACKPLANE_AVAIL_WATTS (\d+) +Value TOTAL_USED_WATTS (\d+) +Value MAX_AVAIL_WATTS (\d+) + +Start + ^Power.*Maximum -> SUMMARY + +SUMMARY + ^System Power \(12V\)\s+${SYS_USED_WATTS}\s+${SYS_AVAIL_WATTS} -> Continue + ^Inline Power \(-50V\)\s+${INLINE_USED_WATTS}\s+${INLINE_AVAIL_WATTS} -> Continue + ^Backplane Power \(3.3V\)\s+${BACKPLANE_USED_WATTS}\s+${BACKPLANE_AVAIL_WATTS} -> Continue + # Capture output that uses a phrase like not to exceed Total Maximum Available + ^Total\s+${TOTAL_USED_WATTS}.*Available\s=\s${MAX_AVAIL_WATTS} + # Capture output that only displays digits + ^Total\s+${TOTAL_USED_WATTS}\s+${MAX_AVAIL_WATTS} + diff --git a/templates/cisco_ios_show_power_status.template b/templates/cisco_ios_show_power_status.template new file mode 100644 index 0000000000..d46b9e14fb --- /dev/null +++ b/templates/cisco_ios_show_power_status.template @@ -0,0 +1,23 @@ +#### +# For 4500 switches +### +Value Required PS (\S+) +Value INPUT_TYPE (\S+) +Value INPUT_STATUS (off|good|err-disable) +Value Filldown MODEL (\S+) +Value TYPE (.+?) +Value STATUS (off|good|err-disable) +Value Filldown FAN_SENSOR (\w+) +Value Filldown INLINE_STATUS (good|n.a.) + +Start + ^Supply.*Model -> POWER + + +POWER + ^${PS}\s+${MODEL}\s+${TYPE}\s+${STATUS}\s+${FAN_SENSOR}\s+${INLINE_STATUS} -> Record + ^${PS}\s{25}${INPUT_TYPE}\s+${INPUT_STATUS} -> Record + # Capture just INPUT_STATUS when INPUT_TYPE field is blank + ^${PS}\s{32}${INPUT_STATUS} -> Record + ^$$ -> Clearall + diff --git a/templates/cisco_ios_show_power_supplies.template b/templates/cisco_ios_show_power_supplies.template new file mode 100644 index 0000000000..2427d14fa5 --- /dev/null +++ b/templates/cisco_ios_show_power_supplies.template @@ -0,0 +1,10 @@ +#### +# For 4500 switches +### +Value PS_NEEDED (\d) +Value PS_AVAIL (\d) + +Start + ^Power\ssupplies\sneeded\sby\ssystem\s+:\s${PS_NEEDED} -> Continue + ^Power\ssupplies\scurrently\savailable\s+:\s${PS_AVAIL} + diff --git a/templates/index b/templates/index index bb7727c2b9..04ecff448a 100644 --- a/templates/index +++ b/templates/index @@ -89,10 +89,12 @@ cisco_ios_show_interfaces_status.template, .*, cisco_ios, sh[[ow]] int[[erfaces] cisco_ios_show_mac-address-table.template, .*, cisco_ios, sh[[ow]] m[[ac-address-table]] cisco_ios_show_ip_ospf_database.template, .*, cisco_ios, sh[[ow]] ip ospf data[[base]] cisco_ios_show_ip_ospf_neighbor.template, .*, cisco_ios, sh[[ow]] ip ospf nei[[ghbor]] +cisco_ios_show_power_available.template, .*, cisco_ios, sh[[ow]] pow[[er]] a[[vailable]] cisco_ios_show_ip_bgp_summary.template, .*, cisco_ios, sh[[ow]] ip bgp sum[[mary]] cisco_ios_show_ipv6_int_brief.template, .*, cisco_ios, sh[[ow]] ipv[[6]] i[[nterface]] b[[rief]] cisco_ios_show_isis_neighbors.template, .*, cisco_ios, sh[[ow]] isis ne[[ighbors]] cisco_ios_show_lldp_neighbors.template, .*, cisco_ios, sh[[ow]] lld[[p]] neig[[hbors]] +cisco_ios_show_power_supplies.template, .*, cisco_ios, sh[[ow]] pow[[er]] su[[pplies]] cisco_ios_show_snmp_community.template, .*, cisco_ios, sh[[ow]] sn[[mp]] com[[munity]] cisco_ios_show_cdp_neighbors.template, .*, cisco_ios, sh[[ow]] c[[dp]] neig[[hbors]] cisco_ios_show_platform_diag.template, .*, cisco_ios, sh[[ow]] plat[[form]] di[[ag]] @@ -100,6 +102,7 @@ cisco_ios_show_processes_cpu.template, .*, cisco_ios, sh[[ow]] proc[[esses]] [[c cisco_ios_show_spanning-tree.template, .*, cisco_ios, sh[[ow]] sp[[anning-tree]] cisco_ios_show_standby_brief.template, .*, cisco_ios, sh[[ow]] standby br[[ief]] cisco_ios_show_ip_int_brief.template, .*, cisco_ios, sh[[ow]] ip int[[erface]] br[[ief]] +cisco_ios_show_power_status.template, .*, cisco_ios, sh[[ow]] pow[[er]] st[[atus]] cisco_ios_show_access-list.template, .*, cisco_ios, sh[[ow]] acc[[ess-list]] cisco_ios_show_interfaces.template, .*, cisco_ios, sh[[ow]] int[[erfaces]] cisco_ios_show_vtp_status.template, .*, cisco_ios, sh[[ow]] vtp stat[[us]] diff --git a/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.parsed b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.parsed new file mode 100644 index 0000000000..dc5a989309 --- /dev/null +++ b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.parsed @@ -0,0 +1,11 @@ +--- +parsed_sample: + +- backplane_avail_watts: '40' + backplane_used_watts: '40' + inline_avail_watts: '3189' + inline_used_watts: '683' + max_avail_watts: '4200' + sys_avail_watts: '1360' + sys_used_watts: '971' + total_used_watts: '1694' diff --git a/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.raw b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.raw new file mode 100644 index 0000000000..0f05ff494b --- /dev/null +++ b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available.raw @@ -0,0 +1,16 @@ +Power Summary Maximum + (in Watts) Used Available +---------------------- ---- --------- +System Power (12V) 971 1360 +Inline Power (-50V) 683 3189 +Backplane Power (3.3V) 40 40 +---------------------- ---- --------- +Total 1694 (not to exceed Total Maximum Available = 4200) + +Power Measurement Inline Power (-50V) +(in Watts) (+/- 50Watts) +------------------ ------------------- +PS1 250 +PS2 100 +------------------ ------------------- +Total 350 diff --git a/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.parsed b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.parsed new file mode 100644 index 0000000000..d28c2d7685 --- /dev/null +++ b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.parsed @@ -0,0 +1,11 @@ +--- +parsed_sample: + +- backplane_avail_watts: '0' + backplane_used_watts: '0' + inline_avail_watts: '0' + inline_used_watts: '0' + max_avail_watts: '750' + sys_avail_watts: '750' + sys_used_watts: '575' + total_used_watts: '575' diff --git a/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.raw b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.raw new file mode 100644 index 0000000000..7a9e528387 --- /dev/null +++ b/tests/cisco_ios/show_power_available/cisco_ios_show_power_available1.raw @@ -0,0 +1,9 @@ +Power Summary Maximum + (in Watts) Used Available +---------------------- ---- --------- +System Power (12V) 575 750 +Inline Power (-50V) 0 0 +Backplane Power (3.3V) 0 0 +---------------------- ---- --------- +Total 575 750 + diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.parsed b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.parsed new file mode 100644 index 0000000000..3eb1cb6ec0 --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.parsed @@ -0,0 +1,51 @@ +--- +parsed_sample: + +- fan_sensor: good + inline_status: good + input_status: '' + input_type: '' + model: PWR-C45-4200ACV + ps: PS1 + status: good + type: AC 4200W +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS1-1 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS1-2 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: '' + input_type: '' + model: PWR-C45-4200ACV + ps: PS2 + status: err-disable + type: AC 4200W +- fan_sensor: good + inline_status: good + input_status: 'off' + input_type: '' + model: PWR-C45-4200ACV + ps: PS2-1 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS2-2 + status: '' + type: '' diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.raw b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.raw new file mode 100644 index 0000000000..8d6b017ba1 --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status.raw @@ -0,0 +1,11 @@ +Power Fan Inline +Supply Model No Type Status Sensor Status +------ ---------------- --------- ----------- ------- ------- +PS1 PWR-C45-4200ACV AC 4200W good good good +PS1-1 220V good +PS1-2 220V good +PS2 PWR-C45-4200ACV AC 4200W err-disable good good +PS2-1 off +PS2-2 220V good + +*** Power Supplies of different type have been detected*** diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.parsed b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.parsed new file mode 100644 index 0000000000..e96bceaabc --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.parsed @@ -0,0 +1,51 @@ +--- +parsed_sample: + +- fan_sensor: good + inline_status: good + input_status: '' + input_type: '' + model: PWR-C45-4200ACV + ps: PS1 + status: good + type: AC 4200W +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS1-1 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS1-2 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: '' + input_type: '' + model: PWR-C45-4200ACV + ps: PS2 + status: good + type: AC 4200W +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS2-1 + status: '' + type: '' +- fan_sensor: good + inline_status: good + input_status: good + input_type: 220V + model: PWR-C45-4200ACV + ps: PS2-2 + status: '' + type: '' diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.raw b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.raw new file mode 100644 index 0000000000..9b1f5ceeec --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status1.raw @@ -0,0 +1,9 @@ +Power Fan Inline +Supply Model No Type Status Sensor Status +------ ---------------- --------- ----------- ------- ------- +PS1 PWR-C45-4200ACV AC 4200W good good good +PS1-1 220V good +PS1-2 220V good +PS2 PWR-C45-4200ACV AC 4200W good good good +PS2-1 220V good +PS2-2 220V good diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.parsed b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.parsed new file mode 100644 index 0000000000..73fe266075 --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.parsed @@ -0,0 +1,19 @@ +--- +parsed_sample: + +- fan_sensor: good + inline_status: n.a. + input_status: '' + input_type: '' + model: PWR-C4KX-750AC-R + ps: PS1 + status: good + type: AC 750W +- fan_sensor: good + inline_status: n.a. + input_status: '' + input_type: '' + model: PWR-C4KX-750AC-R + ps: PS2 + status: good + type: AC 750W diff --git a/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.raw b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.raw new file mode 100644 index 0000000000..cfa03143cd --- /dev/null +++ b/tests/cisco_ios/show_power_status/cisco_ios_show_power_status2.raw @@ -0,0 +1,5 @@ +Power Fan Inline +Supply Model No Type Status Sensor Status +------ ---------------- --------- ----------- ------- ------- +PS1 PWR-C4KX-750AC-R AC 750W good good n.a. +PS2 PWR-C4KX-750AC-R AC 750W good good n.a. diff --git a/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.parsed b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.parsed new file mode 100644 index 0000000000..5a74805a0e --- /dev/null +++ b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.parsed @@ -0,0 +1,5 @@ +--- +parsed_sample: + +- ps_avail: '1' + ps_needed: '1' diff --git a/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.raw b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.raw new file mode 100644 index 0000000000..bed9e21b1a --- /dev/null +++ b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies.raw @@ -0,0 +1,2 @@ +Power supplies needed by system : 1 +Power supplies currently available : 1 diff --git a/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.parsed b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.parsed new file mode 100644 index 0000000000..995a669840 --- /dev/null +++ b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.parsed @@ -0,0 +1,5 @@ +--- +parsed_sample: + +- ps_avail: '2' + ps_needed: '1' diff --git a/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.raw b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.raw new file mode 100644 index 0000000000..8ad4c88f19 --- /dev/null +++ b/tests/cisco_ios/show_power_supplies/cisco_ios_show_power_supplies1.raw @@ -0,0 +1,2 @@ +Power supplies needed by system : 1 +Power supplies currently available : 2