GPRINT options

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

Moderators: Developers, Moderators

Post Reply
Guest

GPRINT options

Post by Guest »

Is there a way in cacti to force certain precision on numbers? I remember doing it with rrd, however I'm not sure how to go about it using the cacti interface. For example, with system load I it to read 0.06 instead of 60.00 m. Check the link below to see what I'm talking about.

http://www.meshier.com/cacti/graph.php? ... &rraid=all

Brent Meshier
Global Transport Logistics
http://www.shipgtl.com/
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I am pretty sure this is done with rrdtool's '--units-exponent' option. Right now cacti does not support this, but I will add support in the next version.

-Ian
gwynnebaer
Posts: 35
Joined: Sat Apr 13, 2002 5:16 pm
Location: Santa Barbara, CA

Post by gwynnebaer »

I changed the following lines in includes/rrd_functions.php:

Code: Select all

--- /tmp/cacti-0.6.7/include/rrd_functions.php  Mon Apr  1 10:34:19 2002
+++ rrd_functions.php   Wed Apr 24 21:21:48 2002
@@ -413,0 +414 @@
+               "--units-exponent 0 --alt-y-grid \\\n" .
@@ -835,0 +837 @@
+                                       $gprint_text = "%8.0lf";
@@ -837,0 +840,4 @@
+                               if (stristr($text_format[$i],"!")){
+                                       $text_format[$i] = ereg_replace ("!", "" ,$text_format[$i]); /* remove custom flag */
+                                       $gprint_text = "";
+                               }
The removal of the "%s" is the key. From the man page for rrdgraph:
If an additional '%s' is found AFTER the marker, the
value will be scaled and an appropriate SI magnitude
unit will be printed in place of the '%s' marker. The
scaling will take the '--base' argument into
consideration!

If a '%S' is used instead of a '%s', then instead of
calculating the appropriate SI magnitude unit for
this value, the previously calculated SI magnitude
unit will be used. This is useful if you want all
the values in a PRINT statement to have the same SI
magnitude unit. If there was no previous SI
magnitude calculation made, then '%S' behaves like a
'%s', unless the value is 0, in which case it does
not remember a SI magnitude unit and a SI magnitude
unit will only be calculated when the next '%s' is
seen or the next '%S' for a non-zero value.
This gives me exacting precision, but be careful that on some of your graphs, you may get numbers that are "too accurate" (ie, not the way you want them).

raX, this gets back to needing a modular way to pass any number of options to rrdtool, and a modular way to modify "$gprint_text".

See also this post on a way to do this now (hack in progress):
http://www.raxnet.net/board/viewtopic.p ... ght=gprint

Cheers,
-gwynnebaer
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I added a GPRINT Options field to the next version so you can specify whatever you want. I also added the following rrdtool graph options:

Code: Select all

--logarithmic
--unit
--units-exponents
-Ian
Guest

Post by Guest »

Hey, thanks for the Diff file ! My temperature graphs are rockin' !
Ricokey
Posts: 4
Joined: Tue May 14, 2002 5:47 pm

entires to plot load averages from snmp

Post by Ricokey »

i'm using .68 version
to get my load adverages to plot correctly instead of having .07 turn into 50m

i did the following

i set the units to -2 under rrd graph configuation ( still have to see how this turns out when the load reaches above 1....)

edit the graph items (gprint), select last for consolidated function, exact number for gprint options and type in %8.2lf into the box, and current: in the text format box.


hope this helps
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests