Cacti 95th / rrdtool 95th discrepancies

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

Moderators: Developers, Moderators

Post Reply
acenetryan
Posts: 3
Joined: Wed Apr 13, 2011 5:49 pm

Cacti 95th / rrdtool 95th discrepancies

Post by acenetryan »

I'm writing a custom script to pull out bandwidth totals from the rrd files used by Cacti. For the most part, I'm able to directly duplicate the 95th percentile values that are being shown in Cacti. Based on the "Graph Properties" tab I can see that Cacti doesn't use rrdtool to calculate the 95th and, after going through the source, it looks like it uses a combination of rrdfetch with custom logic.

I've been looking at this all day and haven't been able to figure out why my rrdtool command would be generating different results from Cacti. Here's my command:

Code: Select all

/usr/bin/rrdtool graph dummy.png --start=STARTTIME --end=ENDTIME  
                DEF:tin=DATASOURCE:traffic_in:AVERAGE 
                DEF:tout=DATASOURCE:traffic_out:AVERAGE 
                VDEF:totalin=tin,TOTAL VDEF:totalout=tout,TOTAL 
                CDEF:maxinout=tin,tout,MAX,8,* 
                CDEF:tinbits=tin,8,* 
                CDEF:toutbits=tout,8,* 
                VDEF:nintyfifth=maxinout,95,PERCENTNAN 
                VDEF:nintyfifthin=tinbits,95,PERCENTNAN 
                VDEF:nintyfifthout=toutbits,95,PERCENTNAN 
                PRINT:totalin:\%lf 
                PRINT:totalout:\%lf 
                PRINT:nintyfifth:\%lf 
                PRINT:nintyfifthin:\%lf 
                PRINT:nintyfifthout:\%lf 
                 2>&1
Based on my testing today, it looks like Cacti more closely emulates the PERCENTNAN function which ignores unknown values. Using PERCENTNAN over PERCENT gave me near spot on 95th results compared to what Cacti gives. However, there are a few peculiarities here and there that I haven't been able to nail down. In conjunction with this command, I added 95th percentile values for my traffic_in, traffic_out, and overall to my Cacti graphs. I used these "Text Format" values in my Graph Template:

overall 95th: |95:bits:6:max:2|
traffic_in 95th: |95:bits:0:current:2|
traffic_out 95th: |95:bits:0:current:2|

Both traffic_in and traffic_out have the appropriate data source set. Cacti seems to report a higher 95th percentile than what my rrdgraph command is giving in the oddities. It also appears to be stemming from a higher traffic_in 95th percentile.

At this point, I'm asking the forums before going over Cacti's 95th percentile function in lib/graph_variables.php line-by-line to see why it's giving me differences in values.

Why am I getting higher 95th percentile values from Cacti than rrdtool only in certain cases?
acenetryan
Posts: 3
Joined: Wed Apr 13, 2011 5:49 pm

Re: Cacti 95th / rrdtool 95th discrepancies

Post by acenetryan »

Anyone know the resolution that's used when Cacti calculates the 95th percentile? Is it the same resolution used by the rrdgraph call used to generate the graph?
acenetryan
Posts: 3
Joined: Wed Apr 13, 2011 5:49 pm

Re: Cacti 95th / rrdtool 95th discrepancies

Post by acenetryan »

I just got a private message from user "douglasmauro" about this thread, but since I haven't been very active in these forums I can't respond or view it.

I never ended up resolving this. Since we don't primarily bill based on 95th percentile I let the discrepancies go. The 95th percentiles were close enough to make general conclusions about the traffic and then provide clients with the actual data from Cacti.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests