From aab58477d155cbcf4af10131427f7bafcbe066c6 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Fri, 19 Jan 2018 16:18:59 -0500
Subject: [PATCH] Ticket 49546 - Fix broken snmp MIB file

Description:  Coverted our MIB file to be SMIv2 compliant

https://pagure.io/389-ds-base/issue/49546

Reviewed by: ?
---
 ldap/servers/snmp/redhat-directory.mib | 222 ++++++++++++++++++++++-----------
 1 file changed, 146 insertions(+), 76 deletions(-)

diff --git a/ldap/servers/snmp/redhat-directory.mib b/ldap/servers/snmp/redhat-directory.mib
index 184e34fe7..8cebfe045 100644
--- a/ldap/servers/snmp/redhat-directory.mib
+++ b/ldap/servers/snmp/redhat-directory.mib
@@ -1,6 +1,6 @@
 -- BEGIN COPYRIGHT BLOCK
 -- Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
--- Copyright (C) 2005 Red Hat, Inc.
+-- Copyright (C) 2018 Red Hat, Inc.
 -- All rights reserved.
 --
 -- License: GPL (version 3 or any later version).
@@ -11,44 +11,111 @@
 -- MIB for Red Hat Directory Server 
 --
 -- This is an implementation of the MADMAN mib for monitoring LDAP/CLDAP and X.500
--- directories described in RFC 2788 and 2789
+-- directories described in RFC 2788, 2789, and 1907
 -- with the addition of traps for server up and down events
 
 RHDS-MIB DEFINITIONS ::= BEGIN
 
-IMPORTS
-      MODULE-IDENTITY,  Counter64, Counter32, Gauge32, OBJECT-TYPE
+    IMPORTS
+      MODULE-IDENTITY,  Counter64, Counter32, OBJECT-TYPE, enterprises, Integer32, NOTIFICATION-TYPE
                  FROM SNMPv2-SMI 
-      DisplayString,    TimeStamp, TEXTUAL-CONVENTION
-                 FROM SNMPv2-TC
-      MODULE-COMPLIANCE, OBJECT-GROUP
+      MODULE-COMPLIANCE, OBJECT-GROUP, NOTIFICATION-GROUP
                  FROM SNMPv2-CONF
+      DisplayString,    TimeStamp
+                 FROM SNMPv2-TC
       applIndex, DistinguishedName, URLString
                  FROM NETWORK-SERVICES-MIB
-      enterprises
-                 FROM RFC1155-SMI
-      TRAP-TYPE 
-		 FROM RFC-1215;
-     
-      redhat OBJECT IDENTIFIER ::= {enterprises 2312}
-
-   URLString ::= TEXTUAL-CONVENTION
-       STATUS current
-       DESCRIPTION
-           "I couldn't find it but madman said it should be here, guessing DisplayString"
-       SYNTAX DisplayString
+      ;
 
     rhds MODULE-IDENTITY
-       LAST-UPDATED "200810230000Z"
+       LAST-UPDATED "201801180000Z"
        ORGANIZATION "Red Hat, Inc."
        CONTACT-INFO
               "Red Hat, Inc.
               Website: http://www.redhat.com"
-            DESCRIPTION
+       DESCRIPTION
                " An implementation of the MADMAN mib for monitoring LDAP/CLDAP and X.500
-		 directories described in RFC 2788 and 2789
-                 used for Red Hat Directory Server" 
-            ::= {redhat 6}
+		         directories described in RFC 2788 and 2789
+                 used for Red Hat Directory Server"
+       REVISION "201801180000Z"
+       DESCRIPTION
+               "Update MIB for SMIv2"
+       ::= {redhat 7}
+
+    redhat OBJECT IDENTIFIER ::= {enterprises 2312}
+
+    snmpMIBConformance OBJECT IDENTIFIER ::= { rhds 2 }
+    snmpMIBCompliances OBJECT IDENTIFIER ::= { snmpMIBConformance 1 }
+    snmpMIBGroups      OBJECT IDENTIFIER ::= { snmpMIBConformance 2 }
+
+    rhdsCompliance MODULE-COMPLIANCE
+        STATUS  current
+        DESCRIPTION
+            "The compliance statement for SNMPv2 entities which
+            implement the SNMPv2 MIB."
+        MODULE
+            MANDATORY-GROUPS  { rhdsGroup, rhdsTrapGroup }
+            GROUP  rhdsGroup
+            DESCRIPTION
+                "This group is mandatory for SNMPv2 entities which
+                support community-based authentication."
+        ::= { snmpMIBCompliances 1 }
+
+    rhdsTrapGroup NOTIFICATION-GROUP
+        NOTIFICATIONS { directoryServerDown, directoryServerStart }
+        STATUS  current
+        DESCRIPTION
+            "A collection of trap/nmotification objects."
+        ::= { snmpMIBGroups 9 }
+
+    rhdsGroup OBJECT-GROUP
+        OBJECTS { dsAnonymousBinds,
+              dsUnAuthBinds,
+              dsSimpleAuthBinds,
+              dsStrongAuthBinds,
+              dsBindSecurityErrors,
+              dsInOps,
+              dsReadOps,
+              dsCompareOps,
+              dsAddEntryOps,
+              dsRemoveEntryOps,
+              dsModifyEntryOps,
+              dsModifyRDNOps,
+              dsListOps,
+              dsSearchOps,
+              dsOneLevelSearchOps,
+              dsWholeSubtreeSearchOps,
+              dsReferrals,
+              dsChainings,
+              dsConnections,
+              dsMaxThreadsHit,
+              dsConnectionsInMaxThreads,
+              dsSecurityErrors,
+              dsErrors,
+              dsMasterEntries,
+              dsCopyEntries,
+              dsCacheEntries,
+              dsCacheHits,
+              dsSlaveHits,
+              dsName,
+              dsTimeOfCreation,
+              dsTimeOfLastAttempt,
+              dsTimeOfLastSuccess,
+              dsFailuresSinceLastSuccess,
+              dsFailures,
+              dsSuccesses,
+              dsURL,
+              dsEntityDescr,
+              dsEntityVers,
+              dsEntityOrg,
+              dsEntityLocation,
+              dsEntityContact,
+              dsEntityName }
+    STATUS  current
+    DESCRIPTION
+            "A collection of objects providing basic instrumentation and
+            control of an SNMPv2 entity."
+    ::= { snmpMIBGroups 8 }
 
     dsOpsTable OBJECT-TYPE
         SYNTAX SEQUENCE OF DsOpsEntry
@@ -80,7 +147,7 @@ IMPORTS
         dsSimpleAuthBinds
             Counter64,
         dsStrongAuthBinds
-            Counter64
+            Counter64,
         dsBindSecurityErrors
             Counter64,
 
@@ -151,6 +218,7 @@ IMPORTS
     -- the following fields will remain inaccessible for
     -- CLDAP and LDAP DSs: dsReferrals.
 
+
     dsAnonymousBinds OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
@@ -364,64 +432,64 @@ IMPORTS
             Section 14."
         ::= {dsOpsEntry 18}
 
-	dsSecurityErrors OBJECT-TYPE
+    dsConnections OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
         DESCRIPTION
-          " Number of operations forwarded to this DS
-            which did not meet the security requirements. "
+          " Number of total connections opened."
         REFERENCE
-          " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
-            Section 12.7. and, RFC1777 Section 4."
+          " Redhat-defined 1.1"
         ::= {dsOpsEntry 19}
 
-    dsErrors  OBJECT-TYPE
+    dsMaxThreadsHit OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
         DESCRIPTION
-          " Number of operations that could not be serviced
-            due to errors other than security errors, and
-            referrals.
-            A partially serviced operation will not be counted
-            as an error.
-            The errors include NameErrors, UpdateErrors, Attribute
-            errors and ServiceErrors."
+          " Number of times any connection has hit max threads."
         REFERENCE
-          " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
-            Sections 12.4, 12.5, 12.8 & 12.9. and, RFC1777 Section 4."
+          " Redhat defined 1.3."
         ::= {dsOpsEntry 20}
 
-    dsConnections OBJECT-TYPE
+    dsConnectionsInMaxThreads   OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
         DESCRIPTION
-          " Number of total connections opened."
+          " Number of connections that are currently in a max thread state."
         REFERENCE
-          " Redhat-defined 1.1"
+          " Redhat defined 1.2."
         ::= {dsOpsEntry 21}
-         
-    dsConnectionsInMaxThreads   OBJECT-TYPE
+
+	dsSecurityErrors OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
         DESCRIPTION
-          " Number of connections that are currently in a max thread state."
+          " Number of operations forwarded to this DS
+            which did not meet the security requirements. "
         REFERENCE
-          " Redhat defined 1.2."
+          " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+            Section 12.7. and, RFC1777 Section 4."
         ::= {dsOpsEntry 22}
-        
-    dsMaxThreadsHit OBJECT-TYPE
+
+    dsErrors  OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
         DESCRIPTION
-          " Number of times any connection has hit max threads."
+          " Number of operations that could not be serviced
+            due to errors other than security errors, and
+            referrals.
+            A partially serviced operation will not be counted
+            as an error.
+            The errors include NameErrors, UpdateErrors, Attribute
+            errors and ServiceErrors."
         REFERENCE
-          " Redhat defined 1.3."
-        ::= {dsOpsEntry 23} 
+          " CCITT Blue Book Fascicle VIII.8 - Rec. X.511, 1988:
+            Sections 12.4, 12.5, 12.8 & 12.9. and, RFC1777 Section 4."
+        ::= {dsOpsEntry 23}
         
     -- Entry statistics/Cache performance
     dsEntriesTable OBJECT-TYPE
@@ -431,7 +499,7 @@ IMPORTS
         DESCRIPTION
           " The table holding information related to the
             entry statistics and cache performance of the DSs."
-        ::= {rhds 2}
+        ::= {rhds 3}
 
     dsEntriesEntry OBJECT-TYPE
         SYNTAX DsEntriesEntry
@@ -527,7 +595,7 @@ IMPORTS
             related to the history of the interaction
             of the monitored DSs with their respective
             peer DSs."
-        ::= { rhds 3 }
+        ::= { rhds 4 }
 
 	dsIntEntry OBJECT-TYPE
         SYNTAX  DsIntEntry
@@ -563,7 +631,7 @@ IMPORTS
     }
 
    dsIntIndex  OBJECT-TYPE
-     SYNTAX INTEGER (1..2147483647)
+     SYNTAX Integer32 (1..2147483647)
      MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
@@ -695,32 +763,32 @@ IMPORTS
 
     dsEntityDescr	OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS  read-only
-	STATUS  mandatory
+	MAX-ACCESS  read-only
+	STATUS  current
 	DESCRIPTION
 		"A general textual description of this directory server."
 	::= {dsEntityEntry 1}
 
     dsEntityVers	OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS  read-only
-	STATUS  mandatory
+	MAX-ACCESS  read-only
+	STATUS  current
 	DESCRIPTION
 		"The version of this directory server"
 	::={dsEntityEntry 2}
 
     dsEntityOrg		OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS	read-only
-	STATUS  mandatory
+	MAX-ACCESS	read-only
+	STATUS  current
 	DESCRIPTION
 		"Organization responsible for directory server at this installation"
 	::={dsEntityEntry 3}
 
     dsEntityLocation	OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS	read-only
-	STATUS  mandatory
+	MAX-ACCESS	read-only
+	STATUS  current
 	DESCRIPTION
 		"Physical location of this entity (directory server).
 		 For example: hostname, building  number, lab number, etc."
@@ -728,8 +796,8 @@ IMPORTS
 
     dsEntityContact 	OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS	read-only
-	STATUS  mandatory
+	MAX-ACCESS	read-only
+	STATUS  current
 	DESCRIPTION
 		"Contact person(s)responsible for the directory server at this 
 		 installation, together with information on how to conact."
@@ -737,8 +805,8 @@ IMPORTS
 	
     dsEntityName		OBJECT-TYPE
 	SYNTAX	DisplayString(SIZE (0..255))
-	ACCESS	read-only
-	STATUS  mandatory
+	MAX-ACCESS	read-only
+	STATUS  current
 	DESCRIPTION
 		"Name assigned to this entity at the installation site"
 	::={dsEntityEntry 6}
@@ -747,20 +815,22 @@ IMPORTS
 --  Traps 
 --
 --
-	DirectoryServerDown 	TRAP-TYPE
-		ENTERPRISE	redhat
-		VARIABLES	{ dsEntityDescr, dsEntityVers, dsEntityLocation,
-				  dsEntityContact } 
+	directoryServerDown 	NOTIFICATION-TYPE
+	    OBJECTS { dsEntityDescr, dsEntityVers, dsEntityLocation,
+                  dsEntityContact }
+	    STATUS current
+		-- ENTERPRISE	redhat
 		DESCRIPTION	"This trap is generated whenever the agent detects the
 				 directory server to be (potentially) Down."
-		::= 6001
+		::= { 6001 }
 				
-	DirectoryServerStart 	TRAP-TYPE
-		ENTERPRISE	redhat
-		VARIABLES	{ dsEntityDescr, dsEntityVers, dsEntityLocation }
+	directoryServerStart 	NOTIFICATION-TYPE
+	    OBJECTS { dsEntityDescr, dsEntityVers, dsEntityLocation }
+	    STATUS current
+		-- ENTERPRISE	redhat
 		DESCRIPTION	"This trap is generated whenever the agent detects the
 				 directory server to have (re)started."
-		::= 6002
+		::= { 6002 }
 				
    END
 
-- 
2.13.6

