将SQL结果发送到Graphite的工具
项目描述
# SQL-to-Graphite
将SQL查询结果轻松发送到Graphite的工具!
## 安装
` pip install sql-to-graphite `
## 运行
` export S2G_DSN="mysq://username:password@host/db" cat queries.sql | sql-to-graphite --graphite-host graphite.example.com --graphite-prefix db.metrics `
通过管道传递的查询应每行一个查询,返回至少两列。返回的第一列应该是指标名称(减去–graphite-prefix选项)和值。
` SELECT "metric", 1+1; SELECT "now", NOW(); `