Blob Blame Raw
From 9f1bbff43c3e6ec01e60d35082b21b83a8795dc2 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Thu, 12 Jul 2018 10:48:11 -0400
Subject: [PATCH] Ticket 49546 - Fix issues with MIB file

Description:  Change dsMaxThreadsHit to dsMaxThreadsHits, and set the
              proper object type for dsIntIndex

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

Reviewed by: spichugi & firstyear(Thanks!!)

(cherry picked from commit 6d4caac04be4223971de54d292db82734f6d6a44)
---
 ldap/servers/slapd/agtmmap.c           | 2 +-
 ldap/servers/slapd/agtmmap.h           | 2 +-
 ldap/servers/slapd/connection.c        | 2 +-
 ldap/servers/slapd/slap.h              | 2 +-
 ldap/servers/slapd/snmp_collator.c     | 6 +++---
 ldap/servers/snmp/ldap-agent.c         | 4 ++--
 ldap/servers/snmp/ldap-agent.h         | 2 +-
 ldap/servers/snmp/redhat-directory.mib | 8 ++++----
 8 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/ldap/servers/slapd/agtmmap.c b/ldap/servers/slapd/agtmmap.c
index fbc730db6..352ccefda 100644
--- a/ldap/servers/slapd/agtmmap.c
+++ b/ldap/servers/slapd/agtmmap.c
@@ -298,7 +298,7 @@ agt_mread_stats(int hdl, struct hdr_stats_t *pHdrInfo, struct ops_stats_t *pDsOp
         pDsOpsTbl->dsErrors = pfile_stats->ops_stats.dsErrors;
         pDsOpsTbl->dsConnections = pfile_stats->ops_stats.dsConnections;
         pDsOpsTbl->dsConnectionsInMaxThreads = pfile_stats->ops_stats.dsConnectionsInMaxThreads;
-        pDsOpsTbl->dsMaxThreadsHit = pfile_stats->ops_stats.dsMaxThreadsHit;
+        pDsOpsTbl->dsMaxThreadsHits = pfile_stats->ops_stats.dsMaxThreadsHits;
     }
 
     if (pDsEntTbl != NULL) {
diff --git a/ldap/servers/slapd/agtmmap.h b/ldap/servers/slapd/agtmmap.h
index 2397dad3c..fb27ab2c4 100644
--- a/ldap/servers/slapd/agtmmap.h
+++ b/ldap/servers/slapd/agtmmap.h
@@ -102,7 +102,7 @@ struct ops_stats_t
     uint64_t dsErrors;
     uint64_t dsConnections;             /* Number of currently connected clients */
     uint64_t dsConnectionSeq;           /* Monotonically increasing number bumped on each new conn est */
-    uint64_t dsMaxThreadsHit;           /* Number of times a connection hit max threads */
+    uint64_t dsMaxThreadsHits;          /* Number of times a connection hit max threads */
     uint64_t dsConnectionsInMaxThreads; /* current number of connections that are in max threads */
     uint64_t dsBytesRecv;               /* Count of bytes read from clients */
     uint64_t dsBytesSent;               /* Count of bytes sent to clients */
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
index 1dbb49f06..188383b97 100644
--- a/ldap/servers/slapd/connection.c
+++ b/ldap/servers/slapd/connection.c
@@ -1911,7 +1911,7 @@ connection_activity(Connection *conn, int maxthreads)
         slapi_counter_increment(max_threads_count);
         slapi_counter_increment(conns_in_maxthreads);
         slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsConnectionsInMaxThreads);
-        slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHit);
+        slapi_counter_increment(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHits);
     }
     op_stack_obj = connection_get_operation();
     connection_add_operation(conn, op_stack_obj->op);
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
index eb97cdcc4..a02792648 100644
--- a/ldap/servers/slapd/slap.h
+++ b/ldap/servers/slapd/slap.h
@@ -1889,7 +1889,7 @@ struct snmp_ops_tbl_t
     Slapi_Counter *dsBytesSent;     /* Count of bytes sent to clients */
     Slapi_Counter *dsEntriesReturned;
     Slapi_Counter *dsReferralsReturned;
-    Slapi_Counter *dsMaxThreadsHit;
+    Slapi_Counter *dsMaxThreadsHits;
     Slapi_Counter *dsConnectionsInMaxThreads;
 };
 
diff --git a/ldap/servers/slapd/snmp_collator.c b/ldap/servers/slapd/snmp_collator.c
index d56379466..1da7ccbb2 100644
--- a/ldap/servers/slapd/snmp_collator.c
+++ b/ldap/servers/slapd/snmp_collator.c
@@ -122,7 +122,7 @@ snmp_collator_init(void)
     g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned = slapi_counter_new();
     g_get_global_snmp_vars()->ops_tbl.dsReferralsReturned = slapi_counter_new();
     g_get_global_snmp_vars()->ops_tbl.dsConnectionsInMaxThreads = slapi_counter_new();
-    g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHit = slapi_counter_new();
+    g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHits = slapi_counter_new();
     g_get_global_snmp_vars()->entries_tbl.dsMasterEntries = slapi_counter_new();
     g_get_global_snmp_vars()->entries_tbl.dsCopyEntries = slapi_counter_new();
     g_get_global_snmp_vars()->entries_tbl.dsCacheEntries = slapi_counter_new();
@@ -592,7 +592,7 @@ snmp_update_ops_table(void)
     stats->ops_stats.dsConnections = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnections);
     stats->ops_stats.dsConnectionSeq = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq);
     stats->ops_stats.dsConnectionsInMaxThreads = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionsInMaxThreads);
-    stats->ops_stats.dsMaxThreadsHit = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHit);
+    stats->ops_stats.dsMaxThreadsHits = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHits);
     stats->ops_stats.dsBytesRecv = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesRecv);
     stats->ops_stats.dsBytesSent = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesSent);
     stats->ops_stats.dsEntriesReturned = slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned);
@@ -738,7 +738,7 @@ snmp_as_entry(Slapi_Entry *e)
     add_counter_to_value(e, "Connections", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnections));
     add_counter_to_value(e, "ConnectionSeq", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionSeq));
     add_counter_to_value(e, "ConnectionsInMaxThreads", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsConnectionsInMaxThreads));
-    add_counter_to_value(e, "ConnectionsMaxThreadsCount", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHit));
+    add_counter_to_value(e, "ConnectionsMaxThreadsCount", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsMaxThreadsHits));
     add_counter_to_value(e, "BytesRecv", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesRecv));
     add_counter_to_value(e, "BytesSent", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsBytesSent));
     add_counter_to_value(e, "EntriesReturned", slapi_counter_get_value(g_get_global_snmp_vars()->ops_tbl.dsEntriesReturned));
diff --git a/ldap/servers/snmp/ldap-agent.c b/ldap/servers/snmp/ldap-agent.c
index 4393a8956..bd9b8dd9b 100644
--- a/ldap/servers/snmp/ldap-agent.c
+++ b/ldap/servers/snmp/ldap-agent.c
@@ -496,8 +496,8 @@ dsOpsTable_get_value(netsnmp_request_info *request,
         the_stat = &context->ops_tbl.dsConnectionsInMaxThreads;
         break;
 
-    case COLUMN_DSMAXTHREADSHIT:
-        the_stat = &context->ops_tbl.dsMaxThreadsHit;
+    case COLUMN_DSMAXTHREADSHITS:
+        the_stat = &context->ops_tbl.dsMaxThreadsHits;
         break;
 
     default: /* We shouldn't get here */
diff --git a/ldap/servers/snmp/ldap-agent.h b/ldap/servers/snmp/ldap-agent.h
index 935d3a611..c98e467dd 100644
--- a/ldap/servers/snmp/ldap-agent.h
+++ b/ldap/servers/snmp/ldap-agent.h
@@ -161,7 +161,7 @@ extern size_t snmptrap_oid_len;
 #define COLUMN_DSERRORS 20
 #define COLUMN_DSCONNECTIONS 21
 #define COLUMN_DSCONNECTIONSINMAXTHREADS 22
-#define COLUMN_DSMAXTHREADSHIT 23
+#define COLUMN_DSMAXTHREADSHITS 23
 #define dsOpsTable_COL_MIN 1
 #define dsOpsTable_COL_MAX 23
 
diff --git a/ldap/servers/snmp/redhat-directory.mib b/ldap/servers/snmp/redhat-directory.mib
index c8608972e..579be8ee4 100644
--- a/ldap/servers/snmp/redhat-directory.mib
+++ b/ldap/servers/snmp/redhat-directory.mib
@@ -87,7 +87,7 @@ RHDS-MIB DEFINITIONS ::= BEGIN
                   dsErrors,
                   dsConnections,
                   dsConnectionsInMaxThreads,
-                  dsMaxThreadsHit,
+                  dsMaxThreadsHits,
                   dsMasterEntries,
                   dsCopyEntries,
                   dsCacheEntries,
@@ -190,7 +190,7 @@ RHDS-MIB DEFINITIONS ::= BEGIN
             Counter64,
         dsConnectionsInMaxThreads
             Counter64,
-        dsMaxThreadsHit
+        dsMaxThreadsHits
             Counter64
 
     }
@@ -472,7 +472,7 @@ RHDS-MIB DEFINITIONS ::= BEGIN
             "Redhat defined 1.2."
         ::= { dsOpsEntry 22 }
 
-    dsMaxThreadsHit OBJECT-TYPE
+    dsMaxThreadsHits OBJECT-TYPE
         SYNTAX Counter64
         MAX-ACCESS read-only
         STATUS current
@@ -596,7 +596,7 @@ RHDS-MIB DEFINITIONS ::= BEGIN
 
     DsIntEntry ::= SEQUENCE {
        dsIntIndex
-	       INTEGER,
+           Integer32,
        dsName
            DistinguishedName,
        dsTimeOfCreation
-- 
2.17.1