Discussion:
Incorrect disk space numbers when using SNMP
Maxim Yegorushkin
2013-01-04 10:46:02 UTC
Permalink
Maxim Yegorushkin [http://community.zenoss.org/people/max0x7ba] created the discussion

"Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70799#70799

--------------------------------------------------------------
Hi Zenoss community,

I use Zenoss Core 4.2 to monitor a few Linux hosts. My Linux hosts run RHEL 6.3 x86_64. /Server/SSH/Linux template is used with SNMP modeler plugins and no cmd plugins. Zenoss models my hosts correctly, however, disk space numbers are wrong. How do I fix this please?


|| *Zenoss* || *df output* ||
| Loading Image... (Loading Image...) | $ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                      227G  126G   90G  59% /
tmpfs                  16G     0   16G   0% /dev/shm
/dev/sda1             243M   80M  151M  35% /boot
/dev/mapper/DataVolGroup-Data
                      917G  421G  487G  47% /data |
| Loading Image... (Loading Image...) | [***@linux02 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       95G  3.6G   86G   5% /
tmpfs                 3.9G   56K  3.9G   1% /dev/shm
/dev/sda1             243M   80M  151M  35% /boot |
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70799#70799]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
nilie
2013-01-04 23:07:59 UTC
Permalink
nilie [http://community.zenoss.org/people/nilie] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70817#70817

--------------------------------------------------------------
I see you have some large disks here so it might be a problem with the snmp counters. Are the values of Total bytes correct for each disk ? Can you do a snmpget with the speciffic OIDs and see if the values are correct ?
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70817#70817]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Maxim Yegorushkin
2013-01-07 11:58:14 UTC
Permalink
Maxim Yegorushkin [http://community.zenoss.org/people/max0x7ba] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70805#70805

--------------------------------------------------------------
This is what I see (for the second host in my original message):
# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       95G  4.5G   86G   5% /
tmpfs                 3.9G   56K  3.9G   1% /dev/shm
/dev/sda1             243M   80M  151M  35% /boot

# snmpwalk -v3 localhost hrStorage
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 8061996 KBytes
HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrStorageIndex.6 = INTEGER: 6
HOST-RESOURCES-MIB::hrStorageIndex.7 = INTEGER: 7
HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10
HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageIndex.35 = INTEGER: 35
HOST-RESOURCES-MIB::hrStorageIndex.36 = INTEGER: 36
HOST-RESOURCES-MIB::hrStorageType.1 = OID: HOST-RESOURCES-TYPES::hrStorageRam
HOST-RESOURCES-MIB::hrStorageType.3 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory
HOST-RESOURCES-MIB::hrStorageType.6 = OID: HOST-RESOURCES-TYPES::hrStorageOther
HOST-RESOURCES-MIB::hrStorageType.7 = OID: HOST-RESOURCES-TYPES::hrStorageOther
HOST-RESOURCES-MIB::hrStorageType.10 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory
HOST-RESOURCES-MIB::hrStorageType.31 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.35 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.36 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Virtual memory
HOST-RESOURCES-MIB::hrStorageDescr.6 = STRING: Memory buffers
HOST-RESOURCES-MIB::hrStorageDescr.7 = STRING: Cached memory
HOST-RESOURCES-MIB::hrStorageDescr.10 = STRING: Swap space
HOST-RESOURCES-MIB::hrStorageDescr.31 = STRING: /
HOST-RESOURCES-MIB::hrStorageDescr.35 = STRING: /dev/shm
HOST-RESOURCES-MIB::hrStorageDescr.36 = STRING: /boot
HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.6 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.7 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.10 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.31 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.35 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.36 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 8061996
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 12256292
HOST-RESOURCES-MIB::hrStorageSize.6 = INTEGER: 8061996
HOST-RESOURCES-MIB::hrStorageSize.7 = INTEGER: 3531760
HOST-RESOURCES-MIB::hrStorageSize.10 = INTEGER: 4194296
HOST-RESOURCES-MIB::hrStorageSize.31 = INTEGER: 24706459
HOST-RESOURCES-MIB::hrStorageSize.35 = INTEGER: 1007749
HOST-RESOURCES-MIB::hrStorageSize.36 = INTEGER: 247919
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 7797044
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 7816984
HOST-RESOURCES-MIB::hrStorageUsed.6 = INTEGER: 247136
HOST-RESOURCES-MIB::hrStorageUsed.7 = INTEGER: 3531760
HOST-RESOURCES-MIB::hrStorageUsed.10 = INTEGER: 19940
HOST-RESOURCES-MIB::hrStorageUsed.31 = INTEGER: 1155677
HOST-RESOURCES-MIB::hrStorageUsed.35 = INTEGER: 14
HOST-RESOURCES-MIB::hrStorageUsed.36 = INTEGER: 81171



Not sure if Zenoss using the same OID mnemonic when querieng SNMP, but these numbers as reported by SNMP do not look correct.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70805#70805]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
j053ph4
2013-01-07 15:47:04 UTC
Permalink
j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70808#70808

--------------------------------------------------------------
I imagine everyone must have to deal with this issue...it's not a "problem" with SNMP.  It's numbers are techincally correct, but there is a difference in how df reports disk utilization.

My understanding may be off a bit, but here's my take.  Linux filesystems have 5% of the total space that can't be used by non-root users. The "df" command takes this into account when reporting, so what you see is really:

used/(total-.5*total)

while SNMP is giving you:

used/total.

I use an Event Transform in Zenoss to align the reported % more closely with the "df" output (since people tend to notice the disparity), which is as follows:

*def findFilesystem(device):*
*    fsid = device.prepId(evt.component)*
*    for f in device.os.filesystems():*
*        if fsid == device.prepId(f.id) or fsid == device.prepId(f.mount):*
*            return f*

*def transformMessage(device,filesystem):*
*    freespace = "UNKNOWN"*
*    total = float(filesystem.totalBytes())*
*    avail = 0*
*    pctused = 0*
*    used = 0*
*    overhead = 0*
*    if 'Linux' in device.deviceClass().getOrganizerName():*
*        overhead = .05 * total*
*    try:*
*        used = float(filesystem.usedBytes())*
*        avail = total-used*
*    except:*
*        try:*
*            avail = float(f.availBytes())*
*        except:*
*            avail = float(f.availBytes)*
*        used = total-avail*

*    pctused = used / (total-overhead) * 100*
*    if pctused > 100:*
*        pctused = 100*

*    try:*
*        freespace = fs.availBytesString()*
*    except:*
*        pass*
*    return "Disk space low: %3.1f%% used (%s free)" % (pctused,freespace)*

*import re*


*if re.search("[^:]+: current value ([\d\.]+)", evt.summary):*
*    fs = findFilesystem(device)*
*    try:*
*        msg = transformMessage(device,fs)*
*        evt.summary = msg*
*        evt.message = msg*
*    except:*
*        pass*


Hope this helps,
Joseph
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70808#70808]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Maxim Yegorushkin
2013-01-07 16:08:50 UTC
Permalink
Maxim Yegorushkin [http://community.zenoss.org/people/max0x7ba] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70809#70809

--------------------------------------------------------------
Well, I've seen these advice quite a few times when I googled for this issue.

My issue is not in the way Zenoss reports the amount of free space (or that is slightly different from the number reportd by df). Rather that it reports totally incorrect numbers.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70809#70809]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
j053ph4
2013-01-07 16:14:06 UTC
Permalink
j053ph4 [http://community.zenoss.org/people/j053ph4] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70810#70810

--------------------------------------------------------------
hmmm..well I just looked at your original post again and yeah it's off by quite a bit...

Sometimes I'll see wierd numbers like that if the partition is "grown" between runs of the modeler, but I don't think that's it in this case (wouldn't hurt to run the modeler manually though).

One thing I notice though is that these are in /Server/SSH/Linux, which (probably) means that the modeler and fs utilization is being collected with SSH and not SNMP.  If SNMP is configured, why not change the device class to /Server/Linux  and try running the modeler again and then seeing if the utilization metrics are correct?

Joseph
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70810#70810]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Maxim Yegorushkin
2013-01-07 16:54:15 UTC
Permalink
Maxim Yegorushkin [http://community.zenoss.org/people/max0x7ba] created the discussion

"Re: Incorrect disk space numbers when using SNMP"

To view the discussion, visit: http://community.zenoss.org/message/70826#70826

--------------------------------------------------------------
I changed the device class to /Server/Linux, re-modelled, waited a few minutes and it now display correct disk space numbers in Zenoss UI. What is a bit strange is that I did not have any of cmd modeller plugins enabled in /Server/SSH/Linux class, i.e. it has the same modeller plugins and configuration as /Server/Linux does.

Anyway...

Thanks a lot j053pha.
--------------------------------------------------------------

Reply to this message by replying to this email -or- go to the discussion on Zenoss Community
[http://community.zenoss.org/message/70826#70826]

Start a new discussion in zenoss-users by email
[discussions-community-forums-zenoss--***@community.zenoss.org] -or- at Zenoss Community
[http://community.zenoss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2003]
Loading...