[rancid] patch for Nexus 9000 'show environment power'

Howard Jones howie at thingy.com
Tue Jun 20 09:00:02 UTC 2017


On N9K (our 9508 at least), the current power usage has decimal places.

!Env: Xb26     N9K-C9508-FM            119.00 W     250.80 W Powered-Up
!Env: 27       N9K-SUP-B                76.00 W      79.92 W Powered-Up
!Env: 28       N9K-SUP-B                58.00 W      79.92 W Powered-Up
!Env: 29       N9K-SC-A                 12.00 W      25.20 W Powered-Up
!Env: 30       N9K-SC-A                 12.00 W      25.20 W Powered-Up

I only changed the two-value clause below, since that's the one that 
fixed my issue.

--- nxos.pm-dist    2017-06-20 09:52:44.627985639 +0100
+++ nxos.pm    2017-06-20 09:53:37.712598200 +0100
@@ -468,7 +468,7 @@
  # nexus#
      if (/(.* +)(\d+ W +\d+ W)( +\d+ W.+)/) {
          $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3);
-    } elsif (/(.* +)(\d+ W)( +\d+ W.+)/) {
+    } elsif (/(.* +)(\d+\.?\d* W)( +\d+\.?\d* W.+)/) {
          $_ = sprintf("%s%-". length($2)."s%s\n", $1, "", $3);
      }




More information about the Rancid-discuss mailing list