https://github.com/wrouesnel/postgres_exporter
golang实现的
POST http://192.168.1.107:9093/api/v1/alerts: prometheus post 给 alertmanager的url地址
content-type:application/json
[{
"labels":{
"alertname":"InstanceDown",
"instance":"192.168.1.108:9100",
"job":"remote",
"severity":"page"
}
"annotations":{
"description":"192.168.1.108:9100 of job remote has been down for more than 5 minutes.",
"summary":"Instance 192.168.1.108:9100 down"
}
"startsAt":"2019-06-07T18:22:24.456891295+08:00",
"endsAt":"2019-06-07T18:24:09.456891295+08:00",
"generatorURL":"http://192.168.1.109:9090/graph?g0.expr=up+%3D%3D+0&g0.tab=1"
}]
对应prometheus 实例配置如下:
- job_name: 'remoge'
static_configs:
- targets: ['192.168.1.108:9100']
alert rules规则配置如下:
name:example
rules:
- alert:InstanceDown
expr: up==1
for:2m
labels:
severity: page
annotations:
summary: "Instance {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 5 minues."
How to manage Prometheus high-availability with PostgreSQL + TimescaleDB
https://blog.timescale.com/prometheus-ha-postgresql-8de68d19b6f5/
prometheus book
https://yunlzheng.gitbook.io/prometheus-book/
开发自己的分布式监控Prometheus Exporter时遇到的坑
https://micro.mu/docs/cn/index.html
Go语言开发Prometheus Exporter示例
https://www.cnblogs.com/momoyan/p/9943268.html
ubuntu1604安装,使用
wget https://dl.grafana.com/oss/release/grafana_6.1.3_amd64.deb
sudo dpkg -i grafana_6.1.3_amd64.deb
#below from https://www.cnblogs.com/xkus/p/7462953.html
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
systemctl enable grafana-server.service
#below https://blog.csdn.net/hfut_wowo/article/details/78536022
左侧configuration,data source,add data source,
设置一个name
http url输入http://localhost:9090,如果promethues是本机,其他默认
点选save&test
dashboards,import prometheus2.0和grafana metrics
------------------10.43.163.42上的相关环境和命令-----------------
prometheus,
位置:/usr/local/prometheus-2.8.1.linux-amd64/
配置文件:/usr/local/prometheus-2.8.1.linux-amd64/prometheus.yml
启动:prometheus
访问:http://127.0.0.1:9090
node_exporter主机节点代理:
位置:/usr/local/node_exporter-0.17.0.linux-amd64/
启动:node_exporter
访问:http://127.0.0.1:9100/metrics
grafana server:
systemctl start/stop/status grafana-server
访问:127.0.0.1:3000/