|
下载安装prometheus
$ wget https://github.com/prometheus/prometheus/releases/download/v1.7.1/prometheus-1.7.1.linux-amd64.tar.gz
$ mkdir /opt/prometheus
$ tar zxf prometheus-1.7.1.linux-amd64.tar.gz -C /opt/prometheus --strip-components=1
编辑配置prometheus.yml文件,内容如下:
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: 'codelab-monitor'
rule_files:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['192.168.1.199:9090']
- job_name: linux
static_configs:
- targets: ['192.168.1.199:9100']
labels:
instance: db1
- job_name: mysql
static_configs:
- targets: ['192.168.1.199:9104']
labels:
instance: db1
后台启动prometheus
nohup /opt/prometheus/prometheus -config.file=prometheus.yml &
tail -200f nohup.out
time="2017-06-12T11:51:16+08:00" level=info msg="Starting prometheus (version=1.7.0, branch=master, revision=bfa37c8ee39d11078662dce16c162a61dccf616c)" source="main.go:88"
time="2017-06-12T11:51:16+08:00" level=info msg="Build context (go=go1.8.3, user=root@7a6329cc02bb, date=20170607-09:43:48)" source="main.go:89"
time="2017-06-12T11:51:16+08:00" level=info msg="Host details (Linux 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 monitor (none))" source="main.go:90"
time="2017-06-12T11:51:16+08:00" level=info msg="Loading configuration file prometheus.yml" source="main.go:252"
time="2017-06-12T11:51:16+08:00" level=info msg="Loading series map and head chunks..." source="storage.go:428"
time="2017-06-12T11:51:16+08:00" level=info msg="2200 series loaded." source="storage.go:439"
time="2017-06-12T11:51:16+08:00" level=info msg=" source="web.go:259"
|
|