Have you tried the Metrics Library? It has a Ganglia reporter that takes care of when and how to send your measurements to gmond/gmetad. You can also check out the source if you want a code example.
For dmax, tmax, and how often to report, I found this to be a good source