向Grafana发送批注
grafannotate的Python项目详细描述
grafannotate
用于将grafana注释发送到不同目的地的cli工具。
安装
pip install grafannotate
用法
grafannotate --help
Usage: grafannotate [OPTIONS]
Send Grafana annotations
Options:
-u, --uri TEXT URI to send annotation to. Default:
"http://localhost:3000/api/annotations".
-T, --title TEXT Event title. Default: "event".
-t, --tag TEXT Event tags (can be used multiple times).
-d, --description TEXT Event description body. Optional.
-s, --start INTEGER Start timestamp (unix secs). Default: current
timestamp.
-e, --end INTEGER End timestamp (unix secs). Optional.
--help Show this message and exit.
示例
- 向Grafana API发送当前时间的批注
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title"
- 为时间区域向Grafana API发送批注
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --start 1557222057 --end 1557222259
- 向Grafana API发送带有扩展说明的注释
grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --description "Some longer description<br />with newlines<br />and <a href=\"https://something.com/\">links</a>"
- 管道输出到注释说明
START_TIME=`date +%s`
command_with_output | grafannotate --uri http://user:password@grafana:3000/api/annotations --tag my_tag --title "Event Title" --start $START_TIME