Skip to content

Commit

Permalink
Merge pull request #144 from ericdost/show_power_commands
Browse files Browse the repository at this point in the history
Show power commands
  • Loading branch information
itdependsnetworks authored Aug 30, 2017
2 parents eabee5b + 99c72f6 commit c5c05ec
Show file tree
Hide file tree
Showing 18 changed files with 267 additions and 0 deletions.
24 changes: 24 additions & 0 deletions templates/cisco_ios_show_power_available.template
Original file line number Diff line number Diff line change
@@ -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}

23 changes: 23 additions & 0 deletions templates/cisco_ios_show_power_status.template
Original file line number Diff line number Diff line change
@@ -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

10 changes: 10 additions & 0 deletions templates/cisco_ios_show_power_supplies.template
Original file line number Diff line number Diff line change
@@ -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}

3 changes: 3 additions & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,20 @@ 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]]
cisco_ios_show_processes_cpu.template, .*, cisco_ios, sh[[ow]] proc[[esses]] [[cpu]]
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]]
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -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: ''
11 changes: 11 additions & 0 deletions tests/cisco_ios/show_power_status/cisco_ios_show_power_status.raw
Original file line number Diff line number Diff line change
@@ -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***
Original file line number Diff line number Diff line change
@@ -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: ''
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
parsed_sample:

- ps_avail: '1'
ps_needed: '1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Power supplies needed by system : 1
Power supplies currently available : 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
parsed_sample:

- ps_avail: '2'
ps_needed: '1'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Power supplies needed by system : 1
Power supplies currently available : 2

0 comments on commit c5c05ec

Please sign in to comment.