Blame SOURCES/net-snmp-5.7.2-systemstats-ipv4.patch

9a6c41
1235697 - ipSystemStatsInOctets & ipSystemStatsHCInOctets for IPV4 not implemented with net-snmp in RHEL 7 
9a6c41
9a6c41
commit b4caf543cff7dba8f9acca2b9ea88c9b79dc39ee
9a6c41
Author: Niels Baggesen <nba@users.sourceforge.net>
9a6c41
Date:   Mon Oct 22 16:32:12 2012 +0200
9a6c41
9a6c41
    Pick up HC octets and McastOctets from /proc/net/netstat of current RHEL6
9a6c41
    and Fedora kernels.
9a6c41
9a6c41
diff --git a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c
9a6c41
index fbfd8a2..3ba8646 100644
9a6c41
--- a/agent/mibgroup/ip-mib/data_access/systemstats_linux.c
9a6c41
+++ b/agent/mibgroup/ip-mib/data_access/systemstats_linux.c
9a6c41
@@ -271,7 +271,7 @@ _additional_systemstats_v4(netsnmp_systemstats_entry* entry,
9a6c41
     FILE           *devin;
9a6c41
     char            line[1024];
9a6c41
     int             scan_count;
9a6c41
-    unsigned long long scan_vals[6];
9a6c41
+    unsigned long long scan_vals[12];
9a6c41
     int             retval = 0;
9a6c41
 
9a6c41
     DEBUGMSGTL(("access:systemstats:container:arch",
9a6c41
@@ -301,9 +301,11 @@ _additional_systemstats_v4(netsnmp_systemstats_entry* entry,
9a6c41
             memset(scan_vals, 0x0, sizeof(scan_vals));
9a6c41
             scan_count = sscanf(line,
9a6c41
                                 "%*s"   /* ignore `IpExt:' */
9a6c41
-                                "%llu %llu %llu %llu %llu %llu",
9a6c41
+                                "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu %llu",
9a6c41
                                 &scan_vals[0], &scan_vals[1], &scan_vals[2],
9a6c41
-                                &scan_vals[3], &scan_vals[4], &scan_vals[5]);
9a6c41
+                                &scan_vals[3], &scan_vals[4], &scan_vals[5],
9a6c41
+                                &scan_vals[6], &scan_vals[7], &scan_vals[8],
9a6c41
+                                &scan_vals[9], &scan_vals[10], &scan_vals[11]);
9a6c41
             if (scan_count < 6) {
9a6c41
                 snmp_log(LOG_ERR,
9a6c41
                         "error scanning addtional systemstats data"
9a6c41
@@ -331,6 +333,21 @@ _additional_systemstats_v4(netsnmp_systemstats_entry* entry,
9a6c41
             entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTPKTS] = 1;
9a6c41
             entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINBCASTPKTS] = 1;
9a6c41
             entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTBCASTPKTS] = 1;
9a6c41
+	    if (scan_count >= 12) {
9a6c41
+		entry->stats.HCInOctets.low        = scan_vals[6] & 0xffffffff;
9a6c41
+		entry->stats.HCInOctets.high       = scan_vals[6] >> 32;
9a6c41
+		entry->stats.HCOutOctets.low       = scan_vals[7] & 0xffffffff;
9a6c41
+		entry->stats.HCOutOctets.high      = scan_vals[7] >> 32;
9a6c41
+		entry->stats.HCInMcastOctets.low   = scan_vals[8] & 0xffffffff;
9a6c41
+		entry->stats.HCInMcastOctets.high  = scan_vals[8] >> 32;
9a6c41
+		entry->stats.HCOutMcastOctets.low  = scan_vals[9] & 0xffffffff;
9a6c41
+		entry->stats.HCOutMcastOctets.high = scan_vals[9] >> 32;
9a6c41
+		/* 10 and 11 are In/OutBcastOctets */
9a6c41
+		entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINOCTETS] = 1;
9a6c41
+		entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTOCTETS] = 1;
9a6c41
+		entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCINMCASTOCTETS] = 1;
9a6c41
+		entry->stats.columnAvail[IPSYSTEMSTATSTABLE_HCOUTMCASTOCTETS] = 1;
9a6c41
+	    }
9a6c41
         }
9a6c41
     }
9a6c41