向gmond发送数据时,Ganglia恶搞不起作用

时间:2014-01-14 08:56:56

标签: hadoop spoofing ganglia

我正在使用ganglia 3.6.0进行监控。我有一个应用程序收集,聚合群集中所有主机的一些指标。然后它将它们发送给gmond。该应用程序在host1上运行。

这里的问题是,当设置spoof = false时,ganglia最终认为这是仅来自host1的指标。实际上,这些指标由host1生成,但适用于群集中的所有主机。

但是当设置spoof = true时,我希望gmond接受我指定的主机名。但是gmond根本不接受这些指标。指标未在host1上显示。

我使用的代码是从应用Ganglia 3.1x格式的GangliaSink(来自hadoop common)复制的。

xdr_int(128);               // metric_id = metadata_msg
xdr_string(getHostName());       // hostname
xdr_string(name);           // metric name
xdr_int(1);                 // spoof = True
xdr_string(type);           // metric type
xdr_string(name);           // metric name
xdr_string(gConf.getUnits());    // units
xdr_int(gSlope.ordinal());  // slope
xdr_int(gConf.getTmax());        // tmax, the maximum time between metrics
xdr_int(gConf.getDmax());        // dmax, the maximum data value
xdr_int(1);                 /*Num of the entries in extra_value field for 
                              Ganglia 3.1.x*/
xdr_string("GROUP");        /*Group attribute*/
xdr_string(groupName);      /*Group value*/

// send the metric to Ganglia hosts
emitToGangliaHosts();

// Now we send out a message with the actual value.
// Technically, we only need to send out the metadata message once for
// each metric, but I don't want to have to record which metrics we did and
// did not send.
xdr_int(133);         // we are sending a string value
xdr_string(getHostName()); // hostName
xdr_string(name);     // metric name
xdr_int(1);           // spoof = True
xdr_string("%s");     // format field
xdr_string(value);    // metric value

// send the metric to Ganglia hosts
emitToGangliaHosts();

我为每个指标指定了主机名。但它似乎没有被gmond使用/认可。

1 个答案:

答案 0 :(得分:0)

解决了这个问题...... hostName格式问题。格式必须类似ip:hostname,例如1.2.3.4:host0000001或任何string:string都可以: - )