CDEF to Show diference over time

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

Moderators: Developers, Moderators

Post Reply
lawton27
Posts: 11
Joined: Fri Jul 30, 2010 9:39 am

CDEF to Show diference over time

Post by lawton27 »

I want to be able to plot a graph of the difference over a certain length of time on a counter data source.

My particular case is a printer, I am receiving its total printed pages value into a graph but it would be good if I could display this as a graph of either total prints today or total prints in the last X seconds. It's not an option to reset the printers page count.

I've been trying to create a CDEF to do this for me currently I have this:
cdef=CURRENT_DATA_SOURCE,CURRENT_DATA_SOURCE,PREV,-
I rote this intending it to take the latest data value and then take the previous one from it and plot the result. Clearly it hasn't worked.

I would appreciate anyone’s help in making this work or creating a better one making use of the TIME function, but I don't fully understand how that one works.

Thanks.
lawton27
Posts: 11
Joined: Fri Jul 30, 2010 9:39 am

Post by lawton27 »

bump
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: CDEF to Show diference over time

Post by BSOD2600 »

lawton27 wrote:... total prints in the last X seconds.
This is how graphs are displayed by default. Well technically it would be 'prints per second'.

To display the number of prints from the last 5 minutes, use the following CDEF 'Make per 5 minutes'

Code: Select all

cdef=CURRENT_DATA_SOURCE,300,*
lawton27
Posts: 11
Joined: Fri Jul 30, 2010 9:39 am

Post by lawton27 »

All that does it multiply every value in the graph by 300.

That's not what I want. My graph is a continuous count of all printed pages by the printer, I want to be able to take a graph value and subtract from it the value of that graph 5 minutes ago to get the amount the graph has increased in the last 5 minutes.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

What DS type are you using for your page count?

Have you read through http://docs.cacti.net/manual:087:6_refe ... cdef#cdefs to see if what you want is possible?
lawton27
Posts: 11
Joined: Fri Jul 30, 2010 9:39 am

Post by lawton27 »

From what I understand it is possible, yet I don’t understand how to do it either so it may not be.

I'm using gauge, I presume from your question I should be using counter?
jmroth
Cacti User
Posts: 60
Joined: Sun Jan 20, 2002 7:00 pm

Post by jmroth »

for the data types see http://docs.cacti.net/manual:087:3_temp ... a_template

When using a counter, the value per time unit is calculated.
So this is probably what you want instead of a gauge.

I'm not sure though what happens when the counter overflows (when does this happen? when the printer is reset?)

Say you define a maximum of a million and when the value drops from 1000 to 0 it thinks there was an overflow and plots a peak of 999000....

Therefore, a DERIVE may also not be that wrong....
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest