[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-bugs
Subject:    [ net-snmp-Bugs-1445722 ] wrong values in disk statistics for disks
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2006-07-29 21:10:15
Message-ID: E1G6w4d-00077j-DP () sc8-sf-web6 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1445722, was opened at 2006-03-08 16:25
Message generated for change (Comment added) made by tanders
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1445722&group_id=12694

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: agent
Group: linux
Status: Open
Resolution: None
Priority: 3
Submitted By: Radek (radekrat)
Assigned to: Robert Story (rstory)
Summary: wrong values in disk statistics for disks larger then 2Tb

Initial Comment:
snmpget return negative value of -2^31 (-2147483648)
for partition larger than 2^31 Kbytes (>2Tb)

dskTotal described in
/usr/share/snmp/mibs/UCD-SNMP-MIB.txt as Integer32, so
wrong results are expected for >2Tb partition.

No luck for replacing type by Unsigned32 (possible
workaround for <4Tb partitions which never be negative
size):

$ grep -A1 dskTotal /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
    dskTotal            Unsigned32,
    dskAvail            Integer32,
--
dskTotal OBJECT-TYPE
    SYNTAX      Unsigned32

$ UCD-SNMP-MIB::dskTotal.6 = Wrong Type (should be
Gauge32 or Unsigned32):
INTEGER: -2147483648

Any solution, workaround for this?

----------------------------------------------------------------------

>Comment By: Thomas Anders (tanders)
Date: 2006-07-29 23:10

Message:
Logged In: YES 
user_id=848638

See patch [ 1523452 ] dsk(Total|Avail|Used)64 oids for 2Tb+
disk arrays:
https://sourceforge.net/tracker/?func=detail&atid=312694&aid=1523452&group_id=12694

----------------------------------------------------------------------

Comment By: BorisL (borislj)
Date: 2006-07-16 14:59

Message:
Logged In: YES 
user_id=1287482

diff-file is available via
http://slil.ru/22927841
(till 14 sept)

----------------------------------------------------------------------

Comment By: BorisL (borislj)
Date: 2006-07-16 14:52

Message:
Logged In: YES 
user_id=1287482

Here there is patch with Counter64 fields for dskAvail64,
dskUsed64, dskTotal64.

+#define DISKTOTAL64 11
+#define DISKAVAIL64 12
+#define DISKUSED64 13

So, oids are 
.1.3.6.1.4.1.2021.9.1.11
.1.3.6.1.4.1.2021.9.1.12
.1.3.6.1.4.1.2021.9.1.13
respectively

I wish this patch will be available next net-snmp release.

--------------cut here--------------
diff -aur net-snmp-5.2.2/agent/mibgroup/ucd-snmp/disk.c
net-snmp-5.2.2-64c/agent/mibgroup/ucd-snmp/disk.c
--- net-snmp-5.2.2/agent/mibgroup/ucd-snmp/disk.c	Fri Sep 16
14:55:17 2005
+++ net-snmp-5.2.2-64c/agent/mibgroup/ucd-snmp/disk.c	Sun
Jul 16 16:43:22 2006
@@ -187,6 +187,9 @@
    {DISKPERCENT}},
   {DISKPERCENTNODE, ASN_INTEGER, RONLY, var_extensible_disk, 1,
    {DISKPERCENTNODE}},
+  {DISKTOTAL64, ASN_COUNTER64, RONLY, var_extensible_disk,
1, {DISKTOTAL64}},
+  {DISKAVAIL64, ASN_COUNTER64, RONLY, var_extensible_disk,
1, {DISKAVAIL64}},
+  {DISKUSED64, ASN_COUNTER64, RONLY, var_extensible_disk,
1, {DISKUSED64}},
   {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_disk, 1,
{ERRORFLAG}},
   {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_disk, 1,
{ERRORMSG}}
 };
@@ -585,11 +588,13 @@
     double          totalblks, free, used, avail, availblks;
 #else
     static long     avail;
+    static unsigned long long lavail;
 #if defined(STRUCT_STATVFS_HAS_F_FILES) ||
defined(STRUCT_STATFS_HAS_F_FILES)
     int             percent_inode;
 #endif
 #endif
     static long     long_ret;
+    static unsigned long long    llong_ret;
     static char     errmsg[300];
     float           multiplier;
 
@@ -667,8 +672,9 @@
         multiplier = (float)vfs.f_frsize / (float)1024.0;
 #endif
     avail = (long)(vfs.f_bavail * multiplier);
+    lavail = (unsigned long long)(vfs.f_bavail * multiplier);
     iserror = (disks[disknum].minimumspace >= 0 ?
-               avail < disks[disknum].minimumspace :
+               lavail < (unsigned long
long)disks[disknum].minimumspace :
                100 - percent <= disks[disknum].minpercent)
? 1 : 0;
 #if defined(STRUCT_STATVFS_HAS_F_FILES) || defined
STRUCT_STATFS_HAS_F_FAVAIL
     percent_inode = vfs.f_favail <= 0 ? 100 :
@@ -694,6 +700,17 @@
     case DISKPERCENT:
         long_ret = percent;
         return ((u_char *) (&long_ret));
+    case DISKTOTAL64:
+        llong_ret = (unsigned long long)(vfs.f_blocks *
multiplier);
+        llong_ret =
(llong_ret>>32)|((llong_ret&0xffffffff)<<32);
+        return ((u_char *) (&llong_ret));
+    case DISKAVAIL64:
+        lavail = (lavail>>32)|((lavail&0xffffffff)<<32);
+        return ((u_char *) (&lavail));
+    case DISKUSED64:
+        llong_ret = (unsigned long long)((vfs.f_blocks -
vfs.f_bfree) * multiplier);
+        llong_ret =
(llong_ret>>32)|((llong_ret&0xffffffff)<<32);
+        return ((u_char *) (&llong_ret));
 #if defined(STRUCT_STATVFS_HAS_F_FILES) || defined
(STRUCT_STATFS_HAS_F_FILES)
     case DISKPERCENTNODE:
         long_ret = percent_inode;
@@ -767,6 +784,18 @@
     case DISKPERCENT:
         long_ret = percent;
         return ((u_char *) (&long_ret));
+    case DISKTOTAL64:
+        llong_ret = (unsigned long long)(totalblocks *
multiplier);
+        llong_ret =
(llong_ret>>32)|((llong_ret&0xffffffff)<<32);
+        return ((u_char *) (&llong_ret));
+    case DISKAVAIL64:
+	lavail *= multiplier;
+        lavail = (lavail>>32)|((lavail&0xffffffff)<<32);
+        return ((u_char *) (&lavail));
+    case DISKUSED64:
+        llong_ret = (unsigned long long)(used * multiplier);
+        llong_ret =
(llong_ret>>32)|((llong_ret&0xffffffff)<<32);
+        return ((u_char *) (&llong_ret));
     case ERRORFLAG:
         long_ret = iserror;
         return ((u_char *) (&long_ret));
diff -aur net-snmp-5.2.2/agent/mibgroup/ucd-snmp/disk.h
net-snmp-5.2.2-64c/agent/mibgroup/ucd-snmp/disk.h
--- net-snmp-5.2.2/agent/mibgroup/ucd-snmp/disk.h	Tue Feb  3
09:56:07 2004
+++ net-snmp-5.2.2-64c/agent/mibgroup/ucd-snmp/disk.h	Sun
Jul 16 16:43:57 2006
@@ -21,5 +21,8 @@
 #define DISKUSED 8
 #define DISKPERCENT 9
 #define DISKPERCENTNODE 10
+#define DISKTOTAL64 11
+#define DISKAVAIL64 12
+#define DISKUSED64 13
 
 #endif                          /* _MIBGROUP_DISK_H */
diff -aur net-snmp-5.2.2/apps/snmpdf.c
net-snmp-5.2.2-64c/apps/snmpdf.c
--- net-snmp-5.2.2/apps/snmpdf.c	Mon May  9 20:37:14 2005
+++ net-snmp-5.2.2-64c/apps/snmpdf.c	Fri Jul 14 12:26:25 2006
@@ -347,7 +347,11 @@
                 &(vlp->name[base_length]), vlp->name_length
- base_length);
             add(pdu, "UCD-SNMP-MIB:dskTotal",
                 &(vlp->name[base_length]), vlp->name_length
- base_length);
+            add(pdu, "UCD-SNMP-MIB:dskTotal64",
+                &(vlp->name[base_length]), vlp->name_length
- base_length);
             add(pdu, "UCD-SNMP-MIB:dskUsed",
+                &(vlp->name[base_length]), vlp->name_length
- base_length);
+            add(pdu, "UCD-SNMP-MIB:dskUsed64",
                 &(vlp->name[base_length]), vlp->name_length
- base_length);
 
             status = snmp_synch_response(ss, pdu, &response);
diff -aur net-snmp-5.2.2/mibs/UCD-SNMP-MIB.txt
net-snmp-5.2.2-64c/mibs/UCD-SNMP-MIB.txt
--- net-snmp-5.2.2/mibs/UCD-SNMP-MIB.txt	Thu Feb 10 19:53:51
2005
+++ net-snmp-5.2.2-64c/mibs/UCD-SNMP-MIB.txt	Fri Jul 14
10:00:27 2006
@@ -30,14 +30,14 @@
 
 IMPORTS
     OBJECT-TYPE, NOTIFICATION-TYPE, MODULE-IDENTITY,
-    Integer32, Opaque, enterprises, Counter32
+    Integer32, Opaque, enterprises, Counter32, Counter64
         FROM SNMPv2-SMI
 
     TEXTUAL-CONVENTION, DisplayString, TruthValue
 	FROM SNMPv2-TC;
 
 ucdavis MODULE-IDENTITY
-    LAST-UPDATED "200209050000Z"
+    LAST-UPDATED "200609050000Z"
     ORGANIZATION "University of California, Davis"
     CONTACT-INFO    
 	"This mib is no longer being maintained by the University of
@@ -541,6 +541,9 @@
     dskUsed		Integer32,
     dskPercent		Integer32,
     dskPercentNode	Integer32,
+    dskTotal64		Counter64,
+    dskAvail64		Counter64,
+    dskUsed64		Counter64,
     dskErrorFlag	Integer32,
     dskErrorMsg		DisplayString
 }
@@ -628,6 +631,31 @@
     DESCRIPTION  
 	"Percentage of inodes used on disk"
     ::= { dskEntry 10 } 
+dskTotal64 OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Total size of the disk/partion (kBytes)"
+    ::= { dskEntry 11 }
+dskAvail64 OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Available space on the disk"
+    ::= { dskEntry 12 }
+dskUsed64 OBJECT-TYPE
+    SYNTAX      Counter64
+    MAX-ACCESS  read-only
+    STATUS      current
+    DESCRIPTION
+        "Used space on the disk"
+    ::= { dskEntry 13 }
 
 dskErrorFlag OBJECT-TYPE
     SYNTAX	Integer32
--------------cut here--------------

----------------------------------------------------------------------

Comment By: Robert Story (rstory)
Date: 2006-06-07 23:28

Message:
Logged In: YES 
user_id=76148

Well, the only bug here is really that values that exceed
the signed integer range are reported as negative values. I
think the best you can expect from this object is the max
value for a signed 32 bit integer. Unfortunately, this
object is labeled to be in units of kbytes, and we can't
change that.

Looking to the HOST-RESOURCES-MIB, we have the same problem
with the hrDiskStorageTable, also defined as a signed 32bit
integer for kbytes.

However, the hrStorageTable has a size which is in variable
units, found in hrStorageAllocationUnits. This should allow
for reporting of numbers in the range you are talking about,
but you'll have to do the math to get results in bytes.


----------------------------------------------------------------------

Comment By: Orion Poplawski (opoplawski)
Date: 2006-04-12 23:36

Message:
Logged In: YES 
user_id=17422

Any progress on this?  This is going to be more and more
common...

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112694&aid=1445722&group_id=12694

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-bugs mailing list
Net-snmp-bugs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-bugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic