prometheus监控linux模板,Prometheus监控可视化
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27global:
scrape_interval: 15s evaluation_interval: 15s
- job_name: prometheus
static_configs:
- targets: ['localhost:9090'] labels:
instance: prometheus
- job_name: t-luhxdb1
static_configs:
- targets: ['10.0.139.161:9100'] labels:
instance: db1
- job_name: t-luhxdb2
static_configs:
-
targets: ['10.0.139.162:9100']
labels:
instance: db2
- job_name: t-luhxdb3
static_configs:
- targets: ['10.0.139.163:9100']
labels:
instance: db3
启动Prometheus1# prometheus --config.file="/usr/local/l" & Grafana安装
下载安装包
安装grafana1# rpm -ivh grafana-6.4.3-1.x86_64.rpm
linux安装redis服务安装字体包1# yum install urw-fonts freetype* fontconfig -y
开启dashboard(/etc/grafana/provisioning/dashboards/sample.yaml)1
2
3
4
5
6
7
8
9
10
11# # config file version
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
folderUid: ''
type: file
options:
path: /var/lib/grafana/dashboards
5- job_name: t-luhxdb3
static_configs:
- targets: ['10.0.139.163:9100']
labels:
instance: db3
Consul服务发现
通过Consul可以动态注册监控服务,⽆需每次添加监控对象都重启Prometheus
下载Consul
解压并以WEB UI⽅式启动Consul1
2# unzip consul_1.0.0_linux_amd64.zip
# ./consul agent -server -ui -bootstrap-expect 1 -data-dir /tmp/consul -client 0.0.0.0 &
查看启动状态1
2
3# ./consul members
Node Address Status Type Build Protocol DC Segment
t-luhx01-v-szzb 10.0.139.161:8301 alive server 1.0.0 2 dc1
HTTP⽅式注册服务1# curl -X PUT -d '{"id":"mysql","name":"mysql","address":"10.0.139.163","port":9104,"tags": ["test"],"checks":[{"http":"10.0.139.163.9104/","interval":"5s"}]}' localhost:8500/v1/agent/service/register
配置⽂件⽅式注册服务(/etc/consul.d/mysql.json)1
2
3
4
5
6
7
8
9
10
11
12
13
14"service":{
"id": "mysql",
"name": "mysql",
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论