The HEARTBEAT and the STEP
Here is an explanation by Don Baarda on the inner workings of RRDtool. It may help you to sort out why all this UNKNOWN data is popping up in your databases:
RRDtool gets fed samples/updates at arbitrary times. From these it builds Primary Data Points (PDPs) on every "step" interval. The PDPs are then accumulated into the RRAs.
The "heartbeat" defines the maximum acceptable interval between samples/updates. If the interval between samples is less than "heartbeat", then an average rate is calculated and applied for that interval. If the interval between samples is longer than "heartbeat", then that entire interval is considered "unknown". Note that there are other things that can make a sample interval "unknown", such as the rate exceeding limits, or a sample that was explicitly marked as unknown.
The known rates during a PDP's "step" interval are used to calculate an average rate for that PDP. If the total "unknown" time accounts for more than half the "step", the entire PDP is marked as "unknown". This means that a mixture of known and "unknown" sample times in a single PDP "step" may or may not add up to enough "known" time to warrant a known PDP.
The "heartbeat" can be short (unusual) or long (typical) relative to the "step" interval between PDPs. A short "heartbeat" means you require multiple samples per PDP, and if you don't get them mark the PDP unknown. A long heartbeat can span multiple "steps", which means it is acceptable to have multiple PDPs calculated from a single sample. An extreme example of this might be a "step" of 5 minutes and a "heartbeat" of one day, in which case a single sample every day will result in all the PDPs for that entire day period being set to the same average rate.