for ganglia v3.1.2, the patch below ensures that all 'string' metrics are null terminated for python-based user metrics. without this patch, any string metric that is longer than MAX_G_STRING_SIZE (currently 32 bytes), will not be null terminated and will corrupt the value in the metric.
also, regarding MAX_G_STRING_SIZE, would it be possible to increase it in future releases? i've currently set it to 128 in include/gm_value.h. - gb ============= *** ganglia-3.1.2/gmond/modules/python/mod_python.c 2009-01-28 15:23:20.000000000 -0800 --- /tmp/patch-files/gmond/modules/python/mod_python.c 2009-07-08 13:04:40.000000000 -0700 *************** *** 127,134 **** --- 127,138 ---- } else if (PyString_Check(dv)) { char* p = PyString_AsString(dv); strncpy(bfr, p, len); + /* + * ensure bfr is null terminated + */ + bfr[len-1] = '\0'; } else if (PyFloat_Check(dv)) { double v = PyFloat_AsDouble(dv); snprintf(bfr, len, "%f", v); *************** *** 422,430 **** gmi->name = apr_pstrdup (pool, minfo->mname); gmi->tmax = minfo->tmax; if (!strcasecmp(minfo->vtype, "string")) { gmi->type = GANGLIA_VALUE_STRING; ! gmi->msg_size = UDP_HEADER_SIZE+32; } else if (!strcasecmp(minfo->vtype, "uint")) { gmi->type = GANGLIA_VALUE_UNSIGNED_INT; gmi->msg_size = UDP_HEADER_SIZE+8; --- 426,434 ---- gmi->name = apr_pstrdup (pool, minfo->mname); gmi->tmax = minfo->tmax; if (!strcasecmp(minfo->vtype, "string")) { gmi->type = GANGLIA_VALUE_STRING; ! gmi->msg_size = UDP_HEADER_SIZE+MAX_G_STRING_SIZE; } else if (!strcasecmp(minfo->vtype, "uint")) { gmi->type = GANGLIA_VALUE_UNSIGNED_INT; gmi->msg_size = UDP_HEADER_SIZE+8; ============= ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Ganglia-developers mailing list Ganglia-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ganglia-developers