Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.65k stars 406 forks source link

Memory used and memory free values appear to be flipped when using Net-SNMP #3329

Closed stormonts closed 4 years ago

stormonts commented 4 years ago

Logging this here as requested in https://forums.cacti.net/viewtopic.php?f=21&t=60726

Describe the bug Memory used and memory free values appear to be flipped when using Net-SNMP - Buffers, Net-SNMP - Cache, Net-SNMP - Free, Net-SNMP - Total "Get SNMP Data" data templates.

We are using Cacti 1.2.10 on CentOS 7 with NET-SNMP version: 5.7.2 and polling CentOS 7 servers

As shown in the graph below, the "Memory Used" and "Memory Free' values are reversed based on what is shown in "top" on that server. 1

The debug of the graph is below with the CDEFs shown. They appear to be correct, but the numbers aren't correct. (unless I am missing something) 2

The graphs are using the Net-SNMP - Buffers, Net-SNMP - Cache, Net-SNMP - Free, Net-SNMP - Total "Get SNMP Data" data templates.

bsi-util-btp - Memory - Buffers bsi-util-btp SNMP Version: 2, Community: public, OID: .1.3.6.1.4.1.2021.4.14.0 RRD: /usr/local/cacti-1.2.9/rra/bsi-util-btp_mem_buffers_3410.rrd bsi-util-btp - Memory - Cache bsi-util-btp SNMP Version: 2, Community: public, OID: .1.3.6.1.4.1.2021.4.15.0 RRD: /usr/local/cacti-1.2.9/rra/bsi-util-btp_mem_cache_3411.rrd bsi-util-btp - Memory - Free bsi-util-btp SNMP Version: 2, Community: public, OID: .1.3.6.1.4.1.2021.4.6.0 RRD: /usr/local/cacti-1.2.9/rra/bsi-util-btp_mem_free_3412.rrd bsi-util-btp - Memory - memTotalReal bsi-util-btp SNMP Version: 2, Community: public, OID: .1.3.6.1.4.1.2021.4.5.0 RRD: /usr/local/cacti-1.2.9/rra/bsi-util-btp_memtotalreal_3414.rrd Top

cigamit commented 4 years ago

So, this looks like a custom graph template, not written by The Cacti Group. Reviewing the Data Template, the specific OID's seem to be correct. Review the various Graph Items and ensure that they are using the CDEF "Multiply by 1024" each and that the base units of the Graph Template are also 1024. If you want the unit's to be SI (KiB, GiB), then you need to add a "Multiply by 1000" CDEF and change the base units for the Graph Template to 1000.

stormonts commented 4 years ago

That doesn't explain why the two values (memory free and memory used) seem to be backwards.

Memory free is d,c,1,1024, Which is (MemoryTotalReal-MemFree)1024 correct? Why would that be giving me the value of the memory used according to top on the server (and why is the "memory used" cdef giving me the total of the memory free according to top?

TheWitness commented 4 years ago

The data displayed, on the standard template anyway, comes directly from SNMP. If there is a bug, it's the part of SNMP. We would have to see your template to know otherwise.

stormonts commented 4 years ago

I posted the template at https://forums.cacti.net/viewtopic.php?f=21&t=60726&p=281694#p281694