add mail counter to a daily total

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

Moderators: Developers, Moderators

Post Reply
hansklose
Posts: 8
Joined: Fri Mar 16, 2007 4:25 am

add mail counter to a daily total

Post by hansklose »

Hi

ich have a graph which shows the mail traffic on our mailserver.
Is it possible to add a "Graph Item Type" which show the total mails
processed in the last 24 hour?

Thanks Hans
Attachments
MailScanner.png
MailScanner.png (9.46 KiB) Viewed 3420 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please follow instructions of "Bandwidth Summation" at http://www.cacti.net/downloads/docs/htm ... _VARIABLES
Reinhard
hansklose
Posts: 8
Joined: Fri Mar 16, 2007 4:25 am

Post by hansklose »

I tried the |sum:0:current:0:auto| in the Text Format Field
but it seem to me that the resulting value is
"sum of mail * 300" . I have 11 incomming mails
but the total is 3300. Why?
5min => 300sec * 11 mails /sec = 3300 mails ?

Who can i divert it through 300
Attachments
Graph
Graph
sum.png (4.15 KiB) Viewed 3383 times
Config
Config
sum2.png (34.55 KiB) Viewed 3383 times
lindor
Posts: 3
Joined: Fri Mar 16, 2007 5:05 pm

Post by lindor »

I'm wanting to do the same thing for several data sources on one graph. It would be nice if there was a CDEF function for the selected data source(in graph templates), but I don't know if that is possible. That was a nice discovery of the 300 multiple hansklose. If the CDEF function is possible, could someone provide a way of doing it?
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

hansklose wrote:I tried the |sum:0:current:0:auto| in the Text Format Field
but it seem to me that the resulting value is
"sum of mail * 300" . I have 11 incomming mails
but the total is 3300. Why?
5min => 300sec * 11 mails /sec = 3300 mails ?

Who can i divert it through 300
Please post the whole rrdtool graph statement found when clicking the graph and then one of the wrenches.
Reinhard
hansklose
Posts: 8
Joined: Fri Mar 16, 2007 4:25 am

Post by hansklose »

Hi

maybe i use the wrong kind of data source.
When cacti reads the counter it will be resettet to zero. I found in the
documentation that for this kind ouf data the "absolute" schould be
the right one. But when i take that i see 44.33 m Mails but we don't
send half mails :wink: so i choose gauge and the Values are right.

here is the output:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title=" MailScanner Mails In/Rejected/Spam" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
DEF:a="/var/www/tpadmin.thinprint.de/cacti/rra/thcmail01_snmp_incommingmails_246.rrd":snmp_incommingMails:AVERAGE \
AREA:a#00FF00:"Incomming Mails" \
GPRINT:a:LAST:"Current\:%8.0lf" \
GPRINT:a:AVERAGE:"Average\:%8.0lf" \
GPRINT:a:MAX:"Maximum\:%8.0lf" \
GPRINT:a:AVERAGE:"Total\: 469717%8.0lf\n"

Sometimes i see a leadig number at the end (picture).
Where does that come from?

Thanks Hans
Attachments
sum03.png
sum03.png (4.69 KiB) Viewed 3365 times
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You do not use CDEFs, currently. But remember, that rrdtool always stores rates. So the number graphed is the value retrieved after a 5 min polling interval divided by 300 to form a rate (per second). Actually, you suppressed the decimals by providing a 8.0 printf statement.
Assuming, you do not want to print the number of mails sent per second but per minute, you will have to apply a CDEF to those graph items. You may call it Make per Minute and it would read cdef=CURRENT_DATA_SOURCE,60,*. If you want to see per 5 min, you'd better change 60 to 300 instead.
Now I hope that numbers will fit better
Reinhard
hansklose
Posts: 8
Joined: Fri Mar 16, 2007 4:25 am

Post by hansklose »

Ok this Graph display a hole day. So I must use

cdef=CURRENT_DATA_SOURCE,86400,*

right? But when i see the graph for a week this ist wrong.
Is there a variable i can use to tell cacti "take the time
period from the graph" instead of 86400 etc. ?

Thank Hans!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

hansklose wrote:Ok this Graph display a hole day. So I must use

cdef=CURRENT_DATA_SOURCE,86400,*

right?
Wrong. My instructions only deal with the "original" graph items, not the totalling one. That is: they will correct the display for the AREA and for the GPRINTs as well. So you will see the correct numbers of mail on your graph (per minute). Totaling will be left unchanged.
Reinhard
hansklose
Posts: 8
Joined: Fri Mar 16, 2007 4:25 am

Post by hansklose »

Hi

i found a way to make it working for me!
I followed this post
http://forums.cacti.net/viewtopic.php?t ... =summation
and did at the end of the new function
$summation = $summation /300;

Now it looks like this.

Hans
Attachments
sum02.png
sum02.png (35.69 KiB) Viewed 3321 times
sum05.png
sum05.png (3.66 KiB) Viewed 3321 times
lindor
Posts: 3
Joined: Fri Mar 16, 2007 5:05 pm

Post by lindor »

Yes, I've seen that fix you found. I didn't want to do that because if we upgrade cacti that "fix" goes away and would have to be re-done each time. Kind of a pain. It seems to me that there should be a way to have cacti total a single value in an rrd file for the span of the graph. I would rather be able to add something like a CDEF function to do the calculation. Much like the one which totals all data sources, but have it only total the selected data source in a graph template. If someone can confirm that this cannot be done, I will have to use the "fix" noted above.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests