Why GAUGE of int values is a float?
Moderators: Developers, Moderators
Why GAUGE of int values is a float?
Hi there
I thought that if my input method script produces only integers and my data template describes field as GAUGE it would be always integer on the graph.
Am i wrong? i thought that GAUGE is not averaged in any way over time, or is it?
- My script does cast to integer so im sure values are only ints.
- My data template describes fields as ints as well.
- I gather every 60 seconds and failure threshold is set to 300 seconds.
And my graph looks like this attached image.
What am i doing wrong?
THANKS A MILLION!!!!
I thought that if my input method script produces only integers and my data template describes field as GAUGE it would be always integer on the graph.
Am i wrong? i thought that GAUGE is not averaged in any way over time, or is it?
- My script does cast to integer so im sure values are only ints.
- My data template describes fields as ints as well.
- I gather every 60 seconds and failure threshold is set to 300 seconds.
And my graph looks like this attached image.
What am i doing wrong?
THANKS A MILLION!!!!
- Attachments
-
- non_int.jpg (70.55 KiB) Viewed 15455 times
All looks good except the keep alive data item. Please post a graph debug and data source debug outputs for that. Also an 'rrdtool info filename.rrd' output.
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
This happens because of specification of RRDtool.
In many case, The data collection is not performed according to the interval defined .
For example, there are a lot of devices to poll, it will take some time the script returns the result, and so on.
The data collection interval tends to become longer than the defined interval.
RRDtool corrects data to become a defined interval when the graph drawing.
Refer to the attached figure.
P.S. Sorry for my broken English. English is not my native language.
In many case, The data collection is not performed according to the interval defined .
For example, there are a lot of devices to poll, it will take some time the script returns the result, and so on.
The data collection interval tends to become longer than the defined interval.
RRDtool corrects data to become a defined interval when the graph drawing.
Refer to the attached figure.
P.S. Sorry for my broken English. English is not my native language.
- Attachments
-
- rrdtool_data_correction.png (27.79 KiB) Viewed 15420 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
That is indeed not only correct but well explained! I'd like to put this into cacti documentation; is this ok for you?engeishi wrote:This happens because of specification of RRDtool.
In many case, The data collection is not performed according to the interval defined .
For example, there are a lot of devices to poll, it will take some time the script returns the result, and so on.
The data collection interval tends to become longer than the defined interval.
RRDtool corrects data to become a defined interval when the graph drawing.
Refer to the attached figure.
P.S. Sorry for my broken English. English is not my native language.
Reinhard
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please see the result at http://docs.cacti.net/manual:087:8_rrdt ... n_integers
If you see improvements of the text, please let me know
Reinhard
If you see improvements of the text, please let me know
Reinhard
I had the same problem with integers which were displayed als float values. I used a CDEF to round them to integers again.
The CDEF is:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,ABS,+,CURRENT_DATA_SOURCE,CEIL,CURRENT_DATA_SOURCE,FLOOR,IF
The long equation is because RRDTool does not know a round function. So I had to extract the fraction part of the value and then use FLOOR and CEIL to round either up or down.
From looking at my Graphs this would solve the visualization problems of this RRDTool "feature".
The CDEF is:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,ABS,+,CURRENT_DATA_SOURCE,CEIL,CURRENT_DATA_SOURCE,FLOOR,IF
The long equation is because RRDTool does not know a round function. So I had to extract the fraction part of the value and then use FLOOR and CEIL to round either up or down.
From looking at my Graphs this would solve the visualization problems of this RRDTool "feature".
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
[quote="schurzi"]I had the same problem with integers which were displayed als float values. I used a CDEF to round them to integers again.
The CDEF is:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,ABS,+,CURRENT_DATA_SOURCE,CEIL,CURRENT_DATA_SOURCE,FLOOR,IF
The long equation is because RRDTool does not know a round function. So I had to extract the fraction part of the value and then use FLOOR and CEIL to round either up or down.
From looking at my Graphs this would solve the visualization problems of this RRDTool "feature".[/quote]
This is a very dumb question. ABS mentioned above is Absolute Value correct? I don't see a pre-defined CDEF for it.
The CDEF is:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,ABS,+,CURRENT_DATA_SOURCE,CEIL,CURRENT_DATA_SOURCE,FLOOR,IF
The long equation is because RRDTool does not know a round function. So I had to extract the fraction part of the value and then use FLOOR and CEIL to round either up or down.
From looking at my Graphs this would solve the visualization problems of this RRDTool "feature".[/quote]
This is a very dumb question. ABS mentioned above is Absolute Value correct? I don't see a pre-defined CDEF for it.
Exactly, ABS is for Absolute Vaule. It is a standard RRDTool function.mgupta wrote:This is a very dumb question. ABS mentioned above is Absolute Value correct? I don't see a pre-defined CDEF for it.
Maybe to explain the CDEF:
For example, RRDTool generates the Value 3.6:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,
0.5,-,
3.6 - 3
0.6 - 0.5
=
0.1
CURRENT_DATA_SOURCE, CURRENT_DATA_SOURCE,FLOOR,-,
0.5,-,
3.6 - 3
0.6 - 0.5
=
0.1
ABS,+
0.1 + ABS(0.1)
=
0.2
CURRENT_DATA_SOURCE,CEIL
3.6 = 4
CURRENT_DATA_SOURCE,FLOOR
3.6 = 3
IF
The if looks at 0.2, if it is non 0 the Value from CEIL is returned, if it is 0 the Value from Floor is returned.
For 3.4 it looks that way:
3.4 - 3
0.4 - 0.5
= -0.1
-0.1 + ABS(-0.1)
= 0
...
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
Re: Why GAUGE of int values is a float?
I understand why the system produce a non integer value but I didn't understand how to solve it.
For example I made a graph with SNMP generic OID for Asterisk to graph current calls but sometimes the value is not integer, how to solve?
Can you explain with simple words or with some screenshot?
Regards
Alessio
For example I made a graph with SNMP generic OID for Asterisk to graph current calls but sometimes the value is not integer, how to solve?
Can you explain with simple words or with some screenshot?
Regards
Alessio
Cacti Version 0.8.8c production / 0.8.8c test W2008 -- Plugin:Weathermap - Monitor - CAMM 1.6.7 :) - Nectar - GPS Map
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Why GAUGE of int values is a float?
You can't "solve" this.
See e.g. 1st link of my sig, RRDTool chapter for more help in case the picture from above is not enough.
But you can cut off fractional part by using a GPRINT preset
R.
See e.g. 1st link of my sig, RRDTool chapter for more help in case the picture from above is not enough.
But you can cut off fractional part by using a GPRINT preset
R.
Re: Why GAUGE of int values is a float?
But shurzi did it!!!! Some post before, but I didn't understand well how to set CDEF.
Regards
Alessio
schurzi wrote:I had the same problem with integers which were displayed als float values. I used a CDEF to round them to integers again.
The CDEF is:
CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,FLOOR,-,0.5,-,ABS,+,CURRENT_DATA_SOURCE,CEIL,CURRENT_DATA_SOURCE,FLOOR,IF
.
Regards
Alessio
Cacti Version 0.8.8c production / 0.8.8c test W2008 -- Plugin:Weathermap - Monitor - CAMM 1.6.7 :) - Nectar - GPS Map
Who is online
Users browsing this forum: No registered users and 2 guests