Ideas for checking RRD's

I have nagios set up with pnp to log performance data in RRD’s and generate graphs. It does a fantastic job, but I’m looking to extend it.

I have several data sources that are counters… traffic (in Octets) is an example. I would like to be able to throw warning and critical values when traffic levels pass a particular threshold. However, since the perf data is being logged to rrd by nagios, the check occurs before updating the rrd file. This means any check I build into the plugin that is fetching the performance data will be checking data that is n-1 steps old.

I thought about comparing the new data to the currently logged data, but for counter data types, that data is logged as a rate… the last counter value isn’t stored.

Any ideas on how to get this to work? I thought about moving the check to the process perf data plugin and then have it write to the command file to change the service state, but I haven’t thought all the way through that.

Any ideas?