graphite

yum install -y nc
#创建生成模拟数据的脚本
vi feed_random_data.sh
#!/bin/bash
# Generate random pageview data and feed Graphite
tree_path=metrics.random.pageview
time_period_hours=24
now_timestamp=$(date +%s)
minutes_number=$((${time_period_hours}*60))
echo ${minutes_number}
timestamp=$((${now_timestamp}-${minutes_number}*60))
for i in $(seq 1 ${minutes_number}); do
  echo "echo ${tree_path} $(($RANDOM%5000)) ${timestamp} | nc localhost 2003"
  echo ${tree_path} $(($RANDOM%5000)) ${timestamp} | nc localhost 2003
  let timestamp+=60
done
执行脚本,将数据喂给Graphite,在使用nc命令的时候固定格式为:
echo 目录结构 数值 时间戳 | nc 服务器地址 服务端口echo metrics.random.pageview 3680 1446095415 | nc localhost 2003

你可能感兴趣的:(graphite)