Re: [rancid] [PATCH] junos.pm: filter negative temperatures in ShowChassisEnvironment

Emille Blanc <[email protected]> Wed, 20 Feb 2019 08:54:39 -0800
Newsgroups gmane.network.rancid
Message-ID <4FBAFC2ECF5D6244BA4A26C1C94A1E2715254D011E@exchange>
Ironically, we rely on RANCID to tell us when our cabinets get too cold on such devices.
Mostly because our NMS is hopeless, and can't do it (Enterprise! Closed source!), so it never occurred to me to submit a patch for this.

However, some devices (namely, EX2200's) don't understand zero, or sub-zero degrees and report it as N/A.
I've attached a patch to cover this circumstance.

  # Class Item                           Status
  # Power FPC 0 Power Supply 0           OK        
  # Temp  FPC 0 GEPHY1                   OK        
- #       FPC 0 GEPHY2                   OK         N/A
+ #       FPC 0 GEPHY2                   OK        
  #       FPC 0 GEPHY3                   OK        
  #       FPC 0 GEPHY4                   OK        
  # 

-----Original Message-----
From: Rancid-discuss [mailto:[email protected]] On Behalf Of Anderson, Charles R
Sent: Tuesday, February 19, 2019 6:50 AM
To: [email protected]
Subject: [rancid] [PATCH] junos.pm: filter negative temperatures in ShowChassisEnvironment

One of our switches is in an outdoor cabinet.  It gets below 0 sometimes so we see output like this:

  # Temp  FPC 0 GEPHY1                   OK
  #       FPC 0 GEPHY2                   OK
  #       FPC 0 GEPHY3                   OK
- #       FPC 0 GEPHY4                   OK         -5 degrees C / 23 degrees F
+ #       FPC 0 GEPHY4                   OK
  #

The attached patch fixes ShowChassisEnvironment so it matches the - sign.

_______________________________________________
Rancid-discuss mailing list
[email protected]
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
junos.pm.na.patch (application/octet-stream, 594 B)
--- lib/rancid/junos.pm.orig Wed Jan 11 11:27:17 2017
+++ lib/rancid/junos.pm Thu Jan 12 07:56:04 2017
@@ -219,6 +219,10 @@
                ProcessHistory("","","","# $1\n") && next;
        /(^.*\S)\s+Measurement/ &&
                ProcessHistory("","","","# $1\n") && next;
+       # 2017-01-12 *EB* - Filter FPC's that report between 0 (zero) and -1 degrees as N/A
+       #       FPC 0 GEPHY3                   OK         N/A
+       /(^.*\S)\s+N\/A$/ &&
+               ProcessHistory("","","","# $1\n") && next;
        ProcessHistory("","","","# $_");
     }
     return(0);