[rancid] [PATCH] nxrancid ShowEnvPower oscillating
Zenon Mousmoulas
zmousm at noc.grnet.gr
Wed Jun 6 09:42:15 UTC 2012
Hi,
ShowEnvPower in nxrancid tries to filter actual power/draw from the
output, but (as noted in a comment) it does not always chop enough for the
text to line up. Therefore nxrancid output oscillates when the power draw
of some module(s), as reported by "show environment power", switches
between 3-digit and 4-digit wattage. For example:
--- group/configs/n7k-device 2012/06/04 23:18:42 7973
+++ group/configs/n7k-device 2012/06/05 02:18:43 7974
@@ -192,7 +192,7 @@
!Env: 4 N7K-M148GS-11L 400 W Powered-Up
!Env: 5 N7K-SUP1 210 W Powered-Up
!Env: 6 N7K-SUP1 210 W Powered-Up
-!Env: 7 N7K-M132XP-12L 750 W Powered-Up
+!Env: 7 N7K-M132XP-12L 750 W Powered-Up
!Env: Xb1 N7K-C7010-FAB-1 80 W Powered-Up
!Env: Xb2 N7K-C7010-FAB-1 80 W Powered-Up
!Env: Xb3 N7K-C7010-FAB-1 80 W Powered-Up
The following patch tries to stop this. Fixed width parsing works with
NX-OS 6.0, I could not run this against other (previous) versions but it
should be the same -- I hope someone on the list can test it.
Best regards,
Zenon Mousmoulas
---
diff -ru rancid-2.3.8/bin/nxrancid.in rancid-2.3.8-zmousm/bin/nxrancid.in
--- rancid-2.3.8/bin/nxrancid.in 2011-07-29 23:40:40.000000000 +0300
+++ rancid-2.3.8-zmousm/bin/nxrancid.in 2012-06-06 11:56:59.000000000
+0300
@@ -374,13 +374,16 @@
#------- ------------------- ----------- ----------- --------------
#2 NURBURGRING N/A 573 W Powered-Up
#fan1 N/A 720 W Powered-Up
- s/ Actual / /;
- s/ Output / /;
- s/ \(Watts \) / /;
- s/ Draw / /;
- s/ ----------- / /;
- s/ N\/A / / ||
- s/ \d+ W / /; # Does not chop enough to line up.
+
+ if (/Actual +Total/ ||
+ /Actual +Power/ ||
+ /Draw +Allocated/ ||
+ /Output +Capacity/ ||
+ /(\(Watts \)) +\g{-1}/ ||
+ /(-----------) +\g{-1}/ ||
+ /(\d+ W|N\/A) +\d+ W/) {
+ substr $_, 30, 13, "";
+ }
/actual draw/ && next; # Drop changing total power output.
More information about the Rancid-discuss
mailing list