RRDTool Hacking

While setting up a monitoring graph for a trial, I had to revisit the issue of filtering "rollover" peaks (places where the interface counters roll over and cause instant traffic "variations" from 0 to MAXINT) on RRDTool. The trick consists in creating a new CDEF based on the original data source, but with some conditions attached.

I had sketched out a suitable CDEF earlier, but since I had to read through the whole thing four times to sort out the RPN notation (not to mention the Perl code that actually pieced the CDEF together), I decided to hammer out a properly annotated version. The dashed lines delimit binary and ternary operator scope:

              +---------+ <- if data point is unknown, return 1
                        +------------+ <- if data was unknown, push zero.
                                     +-----------------------+ <- unknown if outside
                                        if it was outside -> +--+
                               then replace with upper bound -> +------------------+

The last two operations (coercion to the upper bound) are optional. Most of the time it is better to have UNs on the graph (as breaks on the data) rather than have a large peak pushing the scale up, especially when you're trying to graph a 2Mbps interface with only 3-4Kbps data flowing (pushing up the scale to max_peak will render your data invisible).

Bit flipping - any which way

Spotted this Bit Twiddling Hacks page over at 0xDECAFBAD - extremely neat, especially considering that even if it's not something we actually need every day, it can save us from a lot of head-scratching those few times we do need it.

See Also: