TSD_HOST=localhost
TSD_PORT=4242
COLLECTION_INTERVAL=60
nc -z $TSD_HOST $TSD_PORT >/dev/null || exit 13
while :; do
echo stats || exit
sleep $COLLECTION_INTERVAL
done | nc $TSD_HOST $TSD_PORT
输出:
tsd.hbase.rpcs 1389058717 2037068142 type=put host=x
tsd.hbase.rpcs 1389058717 0 type=rowLock host=x
tsd.hbase.rpcs 1389058717 17 type=openScanner host=x
tsd.hbase.rpcs 1389058717 29 type=scan host=x
tsd.hbase.rpcs.batched 1389058717 5258656 host=x
以上是自带的默认tcollector
脚本opentsdb
。我想为每个打印出来的元素添加一个额外的标签;前任:
tsd.hbase.rpcs 1389058717 2037068142 type=put host=x cluster=y
我想附加cluster=y
到统计数据的每个元素。但我找不到一个好的捷径来做到这一点。