CDEF assistance requested ;-)

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

Moderators: Developers, Moderators

Post Reply
jvanhambelgium
Posts: 33
Joined: Fri Jan 10, 2003 3:16 am
Location: Antwerpen (Belgium)
Contact:

CDEF assistance requested ;-)

Post by jvanhambelgium »

Hi,

I can't figure out how to get this done, altough it should be pretty basic.
i have a working RRA with about 14 DS in it.
Currently I'm graphics without problems the VALUES of the DS.

I want to have a percentage "relative" to a total count value (which is also on the same RRD as a separate DS

In detail ;

1 DS called MDMTOT contains total modemcalls
1 DS called MDM1031 contains calls terminated with code 10/31 (Ascend gear)

I want to have a value graphed where I divide the (DMD1031 by MDMTOT)*100 that will then represent the "relative percentage of calls terminated with a code 10/31"


The problem is I created a CDEF with ;

Item 1 ; Current DATASOURCE
Item 2 ; ???? How do I represent MDMTOT ? I can only select "ALL_DATA_SOURCES" or someting
Item 3 ; 100
Item 4 ; Operator "/"
Item 5 ; Operator "*"

Where can I configure in a CDEF "now that THAT particular DS" (should it be then something like "custom string" ?

Basically this does not work ;-(
Anyone keen in helping me out ?
Thanks & regards,
Jan
"Never Trust A Computer You Can't Throw Out A Window" - Steve Wozniak
Deano
Cacti User
Posts: 101
Joined: Wed Oct 29, 2003 7:08 am
Contact:

Post by Deano »

If you want to start doing some more manipulation within CDEFs than the inbuilt definitions allow you'll need to create some custom CDEFs.

Within the List view for your graph - view the source. This will tell you the Variables used internally by RRD for each DS (a,b,c,d,e,f.....etc). CDEFS get called (cdefa,cdefb etc). These names are all automatically assigned by Cacti.

You can then create a custom CDEF for your exact requirements.

For example one of my graphs has 6 DS (a,b,c,d,e,f)
Each of those is converted to Bits by the "bytes to bits" CDEF giving me(cdefb,cdefe,cdefi,cdefbb,cdefbf,cdefbi).
I also have a total line (cdefcd=a,b,c,d,e,f,+,+,+,+,+,8,*) Using the built-in total function (bytes to bits)

With that set of DEFs if I wanted to create a line that expressed the 3rd DS as a % of the total I'd create a custom CDEF (under "Graph Setup") with a single custom string of...

"cdefi, cdefcd, / ,100 ,*"

Which is "Divide cdefi by cdefcd and mulitply by 100".

You then add a graph item with "None" for the data source, line type and color of your choice and selct your New Custome CDEF from the list.

The downside to this is if you have alot of this sort of requirement you end up with lots of custom CDEFs and if you change your DS around later you'll have to change your Custom CDEF to match how Cacti has assigned its variable names.

Hope that helps....
Deano
Deano
Cacti User
Posts: 101
Joined: Wed Oct 29, 2003 7:08 am
Contact:

Post by Deano »

Just to add (re-reading your Q) if you want a whole new graph for just this percentage...

You'll have to add all the DS from the original - but dont assign a colour.
Add a graph Item for total (dont assign the colour) using the std "total" cdef

Then you can add more graph items to use your custom CDEF. (you might need to go round the loop a few times to creat your graph, view the source to get variable names, adjust your Custom CDEF, etc etc.)

I have a graph template which uses this technique to do a few % graphs using a standard "2nd Data Source as a % of 1st DataSource" type arrangement.

Dean
jvanham

Post by jvanham »

Deano,

Thanks for the CDEF lesson, things start to get more clear now.
I seem to be able to calculate what I needed.

I'll remember this one ;-)

Regards,
Jan
jvanhambelgium
Posts: 33
Joined: Fri Jan 10, 2003 3:16 am
Location: Antwerpen (Belgium)
Contact:

Post by jvanhambelgium »

Hi again,

it seems I'm not quite there yet, now I can't figure out how to represent certain numbers.

The CDEF part is ok, it seems to calculate but it also has to print the value.
Sometimes (because of the relative-percentage) the value is very small (0.1% or so) and then it prints "100m" (which IS correct, only I want values like 0.453 or 0.954.

Can this be done ?
I've looked at "GPRINT Presets" in the menu and see things like

%8.2lf%s (for "Normal" preset)
I've changed this to %8.3lf%s and now I have up to 3 digits behind the comma. (ex 2.345) BUT with values less than 1 it displays in "milli" values.

Is there a way to tweak this ? The RRDTOOL manual tells not that much about GPRINT parameters, the "%s" seems markup characters ??

Anyone ?
Thanks & regards,
Jan
"Never Trust A Computer You Can't Throw Out A Window" - Steve Wozniak
Deano
Cacti User
Posts: 101
Joined: Wed Oct 29, 2003 7:08 am
Contact:

Post by Deano »

At the edge of my udnerstanding of RRD etc here but I think dropping the "%s" will do what you want.

Have you tried using the existing "Exact Numbers" GRPRINT instead though ?

Deano
jvanhambelgium
Posts: 33
Joined: Fri Jan 10, 2003 3:16 am
Location: Antwerpen (Belgium)
Contact:

Post by jvanhambelgium »

Hi,

Yep, I fiddled wiyth the GPRINT Preset and dropped the %s.
All is cool now ;-)

Thanks for your support on this one
Jan
"Never Trust A Computer You Can't Throw Out A Window" - Steve Wozniak
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests