Categraf 是一款 All-in-One 的数据采集器,支持指标、日志采集;支持物理机、虚拟机、交换机、容器、K8s、多种中间件/数据库的数据采集,支持混合云架构、云原生架构、多云架构。同时,Categraf 期望不止提供采集能力,还附带提供仪表盘和告警规则,力求开箱即用。
加入微信群。如果二维码已过期,可以加我微信 picobyte 拉群,备注:“categraf 加群”。
❇️ 我们推荐你使用 夜莺Nightingale 作为监控服务端,和 Categraf 丝滑对接,夜莺中已经内置了各类告警规则和仪表盘。
❇️ 我们推荐你使用快猫星云旗下的 Flashduty 作为 OnCall 值班平台,Flashduty 支持告警聚合、降噪、认领、升级、排班,让告警的触达既高效,又确保告警处理不遗漏、件件有回响。
# export GO111MODULE=on
# export GOPROXY=https://goproxy.cn
go build
tar zcvf categraf.tar.gz categraf conf
Note: 对于mac os x 用户,请使用 gun-tar 工具打包
brew install gnu-tar
gtar zcvf categraf.tar.gz categraf conf
否则会出现以下报错:
F! failed to init config: failed to load configs of dir: ./conf err:toml: line 1: files cannot contain NULL bytes; probably using UTF-16; TOML files must be UTF-8
# test mode: just print metrics to stdout
./categraf --test
# test system and mem plugins
./categraf --test --inputs system:mem
# print usage message
./categraf --help
# run
./categraf
# run with specified config directory
./categraf --configs /path/to/conf-directory
# only enable system and mem plugins
./categraf --inputs system:mem
# use nohup to start categraf
nohup ./categraf &> stdout.log &
Categraf 可以以 daemonset, deployment 或者 sidecar 的形式运行在K8s中。
edit k8s/daemonset.yaml, replace NSERVER_SERVICE_WITH_PORT with service ip:port of nserver in your cluster, replace CATEGRAF_NAMESPACE with namespace value, then run:
kubectl apply -n monitoring -f k8s/daemonset.yaml # collect metrics, metrics/cadvisor of node
kubectl apply -n monitoring -f k8s/sidecar.yaml # collect service metrics
kubectl apply -n monitoring -f k8s/deployment.yaml #collect apiserver coredns etc
Notice: k8s/sidecar.yaml is a demo, replace mock with your own image of service.
see detail here
plugin list and document: https://github.com/flashcatcloud/categraf/tree/main/inputs
Categraf is developed on the basis of Telegraf, Exporters and the OpenTelemetry. Thanks to the great open source community.