Min / Max Values show decimal, but SNMP only delivers Integer

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
buedi
Posts: 2
Joined: Tue Sep 06, 2022 4:45 am

Min / Max Values show decimal, but SNMP only delivers Integer

Post by buedi »

I found quite some discussions about logging Min / Max values and keeping them over time (so they do not get averaged out), but I still can not wrap my head around it. I hope someone can push me in the right direction, give me a tip if I am searching in the wrong place or just give me a link to read it up. Because I just did not find the right thing that helps me here.

What do I have?
I have temperature sensors that I can query via SNMP and they give me an integer of the current temperature. Snmpwalk clearly shows that this is indeed an integer:
SNMP Walk Temperatur Sensor
SNMP Walk Temperatur Sensor
snmpwalk.png (5.39 KiB) Viewed 1037 times
To query this in my Cacti version 1.2.22, I used the "SNMP - Generic OID Template" via the Create --> New Graph feature. Since I wanted also a MIN value, which is not part of the default graph, I also added the Min in the same way Max exists in the default template, but of course changing the Consolidation function to Min. However, since both (Min and Max) show values I do not expect, I do not think adding the Min function messed all up... but who knows ;-)

What I get in the graph is this:
Graph with Min Max as Decimal
Graph with Min Max as Decimal
graph_min_max.png (28.13 KiB) Viewed 1037 times
As you can see, the Min and Max values show Decimal values. They make no sense to me, since the Temperature sensor only delivers an Integer. So I suspect it has something to do with how the .rrd file is set up and it averages out the values over time.

I then had a look at the Graph --> Graph Details --> Graph Source/properties and I was able to spot these lines:

Code: Select all

DEF:a='/usr/share/cacti/site/rra/messbox_snmp_oid_8.rrd':'snmp_oid':AVERAGE \
AREA:a#C04000FF:'Temperatur in °C'  \
GPRINT:a:LAST:'Current\:%8.2lf %s'  \
GPRINT:a:MIN:'Minimum\:%8.2lf %s'  \
GPRINT:a:AVERAGE:'Average\:%8.2lf %s'  \
GPRINT:a:MAX:'Maximum\:%8.2lf %s\n' 
What catched my eye was in the first line: AVERAGE. Is this the base setting of the RRD how it works with the values? If yes, that would explain to me why the Min / Max get averaged out over time.

My specific questions if this is right:
  • How is it possible for me to advise Cacti to create the rrd file with MIN or MAX instead? I suppose I can not change it afterwards with rrdtool, but it has to be re-created, right?
  • If I want graphs that keep the min and max temperatures over time, I would need to create separate RRD Files, one with Min, one with Max, right?
I hope someone can shed some light on this. Thank you very much in advance :-)

P.S. This will be an unmonitored system in a remote location and we want to make sure to see the Min and Max temperature values when we come back after a few months.
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Min / Max Values show decimal, but SNMP only delivers Integer

Post by TheWitness »

Create a specific graph template and use the Exact Number GPRINT Preset instead of the others. Averages will ALWAYS be floats and not integers through. Think about it.

Say you have 3 readings

25 26 25

The average is:

76 / 3 = 25.333333
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
buedi
Posts: 2
Joined: Tue Sep 06, 2022 4:45 am

Re: Min / Max Values show decimal, but SNMP only delivers Integer

Post by buedi »

Thank you very much for looking at my post and helping me out here! I appreciate that very much :-)

I will do as you advised and see how it behaves. It will take a few days of recording values again... plenty of time to read more about the various Graph settings.

So my problem is not the RRD as I first suspected, it is the graph itself. Looking at my existing setup and the RRD file I spot that the RRD contains RRAs for AVERAGE, MIN, MAX and LAST already and that I was just plotting the graph wrong.

Did I grasp that correctly?


Edit: After reading up on the GPRINT Presets and their Syntax, by using Exact Numbers (%8.0lf instead of Normal = %8.2lf %s) am I not just cutting off the 2 decimals visually? Taking the example Min value from my Screenshot, it would show 24 instead of 24.67, but would still be 24.67 from the RRD and not the true MIN value from that timeframe?
User avatar
TheWitness
Developer
Posts: 17061
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Min / Max Values show decimal, but SNMP only delivers Integer

Post by TheWitness »

There are separate GPRINT types to pull values from those RRA's in the RRDfile. You will have to edit the template to choose them.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests