石墨仪表板自动化石墨仪表板的创建
python-graphite-dashgen的Python项目详细描述
概述
Graphite DashGen自动创建Graphite仪表板。它创造了 基于yaml配置文件的每个主机或每个组仪表板。这个 每个主机主机仪表板被设计成在现有的面板上创建仪表板。 collectd度量。与以下大多数备选方案不同,本项目旨在 使用现有的代码。
示例
# Graphite Maintenance # Delete stale Graphite data 0 22 * * * find /opt/graphite/storage/log/ -type f -mtime +180 -delete 0 22 * * * find /opt/graphite/storage/whisper/collectd/ -type f -mtime +90 -delete 0 22 * * * find /opt/graphite/storage/whisper/statsd/ -type f -mtime +90 -delete # Delete empty directories 0 23 * * * find /opt/graphite/storage/log/ -type d -empty -delete 0 23 * * * find /opt/graphite/storage/whisper/collectd/ -type d -empty -delete 0 23 * * * find /opt/graphite/storage/whisper/statsd/ -type d -empty -delete # Regenerate all dashboards @daily /usr/local/sbin/dashgen.py -q -f /usr/local/etc/dashgen/dashconf.yml -f /usr/local/etc/dashgen/all_*.yml -H '*'
上面的crontab示例:
- 清理旧石墨原木
- 清理旧的Whisper数据库
- 使用以下配置文件按主机重新生成仪表板
- dashconf.yml:基本配置值
- all_dash.yml:每主机仪表板配置(主机所有仪表板)
- all_graphs.yml:集合度量的每主机图定义
注释
- yaml配置文件
- 目标条目尽可能接近web gui,以使其更易于使用 来回
- 仪表板类型
- 每主机
- 每组
- 每主机图表
- 类型
- 主机度量:由glob_verify标识,可以包含 glob_metrics
- 碳指标:由carbon_match和主机识别
- glob_metrics和glob_verify的组合应该导致 单个文件系统全局匹配
- 类型
- 字符串模板
- 命名替换从target_vars中提取。图 包含不在目标变量中的命名替换的定义是 跳过。
- 常见的目标变量包括:
- ${color_combined}
- ${color_free}
- ${host}
- ${metric}
- 石墨图形提示和技巧
- 石墨画的线模糊了前面画的线。Z顺序是 很重要。因此,许多图的度量根据颜色而改变 他们的价值观。
- 对于具有自由度量(例如内存)的图,该自由度量是 始终为绿色(模板的lineColor中不应包含绿色)
要求
- 石墨0.9.9+
- PyYAML(ubuntu包:python yaml)
待办事项
- 更多文档!
- 使用具有不同colorList的模板来轻松区分图形
- (?)应按父级而不是子级(例如,所有磁盘)对图形进行排序 vda在任何vdb图之前的图)
备选方案
与石墨仪表盘略有不同(令人耳目一新):
在石墨仪表板视图中存在以下项目:
Graphite 0.9.12文档包含了一系列相关软件: