自定义监控指标 pushgateway
# 下载地址
https://github.com/prometheus/pushgateway/releases/download/v1.4.0/pushgateway-1.4.0.linux-amd64.tar.gz
# 解压
tar xf pushgateway-1.4.0.linux-amd64.tar.gz
mv pushgateway-1.4.0.linux-amd64 pushgateway-1.4.0
# 添加配置文件
vim /usr/lib/systemd/system/pushgateway.service
[Unit]
Description=pushgateway
After=network.target
[Service]
ExecStart=/opt/pushgateway-1.4.0/pushgateway
Restart=on-failure
[Install]
WantedBy=multi-user.target
# 启动
/opt/pushgateway-1.4.0/pushgateway --web.listen-address="0.0.0.0:9091"
systemctl daemon-reload
systemctl start pushgateway.service
# Prometheus配置
- job_name: 'pushgateway'
static_configs:
- targets: ['pushgatewayIP:9091']
honor_labels: true #作用:如果没有设置instance标签,Prometheus服务器也会附加标签,否则instance标签值会为空
cat <<EOF | curl --data-binary @- http://x.x.x.x:9091/metrics/job/some_job/instance/some_instance
# TYPE some_metric counter
some_metric{label="val1"} 42
# TYPE another_metric gauge
# HELP another_metric Just an example.
another_metric 2398.283
EOF
echo "some_metric 3.14" | curl --data-binary @- http://pushgateway.example.org:9091/metrics/job/some_job
echo "zhangning 3306" | curl --data-binary @- http://x.x.x.x:9091/metrics/job/redis/instance/3306
echo "key value" | curl --data-binary @- http://ip地址:9091/metrics/job标签名/job标签命名/instance名/实例标签命名
https://www.cnblogs.com/zqj-blog/p/11106724.html
https://www.cnblogs.com/zqj-blog/p/11024834.html
https://github.com/cppla/ServerStatus
https://github.com/tianshiyeben/wgcloud
# 接口监控
https://github.com/liwei128/apimonitor
https://github.com/jsyzjhj/httpMonitor
https://github.com/yjlch1016/dmonitor
https://github.com/yangziwen/web-monitor