|
GmetricProtocol
Reverse-Engineering of the Gmetric Protocol
Featured The Gmetric ProtocolThe gmetric protocol as used by ganglia encodes raw data using XDR and strings. XDR FormatThe XDR format is formally described in http://www.ietf.org/rfc/rfc4506.txt Numeric types are stored as big endian or 'network' order. This is the same as what Java uses, and the native format of Sun and PowerPC based machines. This is different than what x86 machines use. For integer types, any type that is 4 bytes, is converted to a full 32-bit integer type before being stored. Specifically:
For floating point types:
Strings are just a bit more complicated:
Enumerations and Constants
enum ganglia_slope {
GANGLIA_SLOPE_ZERO = 0, ///< data is fixed, mostly unchanging
GANGLIA_SLOPE_POSITIVE = 1, ///< value is always increasing (counter)
GANGLIA_SLOPE_NEGATIVE = 2, ///< value is always decreasing
GANGLIA_SLOPE_BOTH = 3, ///< value can be anything
GANGLIA_SLOPE_UNSPECIFIED = 4
};
static const char* typestrings[] = {
"string", // GANGLIA_VALUE_STRING
"uint16", // GANGLIA_VALUE_UNSIGNED_SHORT
"int16", // GANGLIA_VALUE_SHORT
"uint32", // GANGLIA_VALUE_UNSIGNED_INT
"int32", // GANGLIA_VALUE_INT
"float", // GANGLIA_VALUE_FLOAT
"double" // GANGLIA_VALUE_DOUBLE
};
The Protocol
slope bugAll versions of gmetric and gmond <= 3.0.4 have a bug. Gmetric (the command line application) will only send a slope of type "0" (zero) or type "3" (both). Gmond when printing XML data, will only print "zero" or "both" for the slope. Meaning if you send a slope of "1", (positive), gmond will print "both". This is fixed on mainline, I believe to be released as 3.1 | |||||||||||||||||||||||||||