# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
# Alerting specifies settings related to the Alertmanager.
alerting:
alertmanagers:
- static_configs:
- targets:
- 127.0.0.1:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "/etc/prometheus/rules/*.yaml"
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
# VMs
- job_name: 'VMs'
static_configs:
- targets: ['192.168.1.2:9100']
labels:
instance: 'VM_1.2'
hostname: 'staging'
ip: '192.168.1.2'
- targets: ['192.168.1.4:9100']
labels:
instance: 'VM_1.4'
hostname: 'xcrawler'
ip: '192.168.1.4'
type: 'vm'
- targets: ['192.168.1.2:9121']
labels:
instance: 'Redis'
hostname: 'staging'
ip: '192.168.1.2'
type: 'cache'
- targets: ['192.168.1.2:9150']
labels:
instance: 'Memcached'
hostname: 'staging'
ip: '192.168.1.2'
type: 'cache'
- targets: ['192.168.1.2:9216']
labels:
instance: 'MongoDB'
hostname: 'staging'
ip: '192.168.1.2'
type: 'database'
- targets: ['192.168.1.2:9104']
labels:
instance: 'Mysql'
hostname: 'staging'
ip: '192.168.1.2'
type: 'database'
- targets: ['192.168.1.2:9117']
labels:
instance: 'Apache'
hostname: 'staging'
ip: '192.168.1.2'
type: 'webserver'
# Host
- job_name: 'Workstation'
static_configs:
- targets: ['127.0.0.1:9100']
labels:
instance: 'Host_1.10'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'system'
- targets: ['127.0.0.1:9104']
labels:
instance: 'Mysql'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'database'
- targets: ['127.0.0.1:9216']
labels:
instance: 'MongoDB'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'database'
- targets: ['127.0.0.1:9187']
labels:
instance: 'PosgreSQL'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'database'
- targets: ['127.0.0.1:9150']
labels:
instance: 'Memcached'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'cache'
- targets: ['127.0.0.1:9121']
labels:
instance: 'Redis'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'cache'
# Apache / Nginx for each VMs
# Nginx for Workstation as transparent proxy
- job_name: 'Nginx'
metrics_path: '_zs/status/format/prometheus'
static_configs:
- targets: ['127.0.0.1:8081']
labels:
instance: 'nginx'
hostname: 'workstation'
ip: '192.168.1.10'
type: 'webserver'
job_name
Không quá rõ. Nhưng mình tạm hiểu là targets. Nhưng cho purpose gì thì … dek hiểu ?

Đến khúc này chợt nghĩ. Viết cái bash scrip install / update tự động ha
1 role cho Ansible
https://github.com/jooservices/hosting/issues/10
1 bash script