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

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