Added Kitchen tests and Travis
Change-Id: Ie5620ef3c416df76287d7864dbc46e0b9c66ab79
This commit is contained in:
parent
bb791375c6
commit
e9dc06012c
9 changed files with 217 additions and 60 deletions
56
.kitchen.yml
Normal file
56
.kitchen.yml
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
hostname: prometheus.ci.local
|
||||||
|
use_sudo: false
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: salt_solo
|
||||||
|
salt_install: bootstrap
|
||||||
|
salt_bootstrap_url: https://bootstrap.saltstack.com
|
||||||
|
salt_version: latest
|
||||||
|
require_chef: false
|
||||||
|
log_level: error
|
||||||
|
formula: prometheus
|
||||||
|
grains:
|
||||||
|
noservices: True
|
||||||
|
state_top:
|
||||||
|
base:
|
||||||
|
"*":
|
||||||
|
- prometheus
|
||||||
|
pillars:
|
||||||
|
top.sls:
|
||||||
|
base:
|
||||||
|
"*":
|
||||||
|
- prometheus
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: inspec
|
||||||
|
sudo: true
|
||||||
|
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
|
||||||
|
driver_config:
|
||||||
|
image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
|
||||||
|
platform: ubuntu
|
||||||
|
|
||||||
|
suites:
|
||||||
|
|
||||||
|
- name: alertmanager
|
||||||
|
provisioner:
|
||||||
|
pillars-from-files:
|
||||||
|
prometheus.sls: tests/pillar/alertmanager.sls
|
||||||
|
|
||||||
|
## Pushgateway not ready yet
|
||||||
|
# - name: pushgateway_complex
|
||||||
|
# provisioner:
|
||||||
|
# pillars-from-files:
|
||||||
|
# prometheus.sls: tests/pillar/pushgateway_complex.sls
|
||||||
|
|
||||||
|
- name: server
|
||||||
|
provisioner:
|
||||||
|
pillars-from-files:
|
||||||
|
prometheus.sls: tests/pillar/server.sls
|
||||||
|
|
||||||
|
# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
|
39
.travis.yml
Normal file
39
.travis.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
sudo: required
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
install:
|
||||||
|
- pip install PyYAML
|
||||||
|
- pip install virtualenv
|
||||||
|
- |
|
||||||
|
test -e Gemfile || cat <<EOF > Gemfile
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
gem 'rake'
|
||||||
|
gem 'test-kitchen'
|
||||||
|
gem 'kitchen-docker'
|
||||||
|
gem 'kitchen-inspec'
|
||||||
|
gem 'inspec'
|
||||||
|
gem 'kitchen-salt', :git => 'https://github.com/salt-formulas/kitchen-salt.git'
|
||||||
|
- bundle install
|
||||||
|
|
||||||
|
env:
|
||||||
|
- PLATFORM=trevorj/salty-whales:trusty
|
||||||
|
- PLATFORM=trevorj/salty-whales:xenial
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- set -o pipefail
|
||||||
|
- make test | tail
|
||||||
|
|
||||||
|
script:
|
||||||
|
- test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
webhooks:
|
||||||
|
urls:
|
||||||
|
- https://webhooks.gitter.im/e/6123573504759330786b
|
||||||
|
on_success: change # options: [always|never|change] default: always
|
||||||
|
on_failure: never # options: [always|never|change] default: always
|
||||||
|
on_start: never # options: [always|never|change] default: always
|
||||||
|
on_cancel: never # options: [always|never|change] default: always
|
||||||
|
on_error: never # options: [always|never|change] default: always
|
||||||
|
email: false
|
15
README.rst
15
README.rst
|
@ -25,6 +25,8 @@ Configure prometheus server
|
||||||
external_port: 15010
|
external_port: 15010
|
||||||
target:
|
target:
|
||||||
dns:
|
dns:
|
||||||
|
enabled: true
|
||||||
|
endpoint:
|
||||||
- name: 'pushgateway'
|
- name: 'pushgateway'
|
||||||
domain:
|
domain:
|
||||||
- 'tasks.prometheus_pushgateway'
|
- 'tasks.prometheus_pushgateway'
|
||||||
|
@ -36,11 +38,13 @@ Configure prometheus server
|
||||||
type: A
|
type: A
|
||||||
port: 9090
|
port: 9090
|
||||||
kubernetes:
|
kubernetes:
|
||||||
api_ip: ${_param:kubernetes_control_address}
|
enabled: true
|
||||||
|
api_ip: 127.0.0.1
|
||||||
ssl_dir: /opt/prometheus/config
|
ssl_dir: /opt/prometheus/config
|
||||||
cert_name: prometheus-server.crt
|
cert_name: prometheus-server.crt
|
||||||
key_name: prometheus-server.key
|
key_name: prometheus-server.key
|
||||||
etcd:
|
etcd:
|
||||||
|
endpoint:
|
||||||
scheme: https
|
scheme: https
|
||||||
ssl_dir: /opt/prometheus/config
|
ssl_dir: /opt/prometheus/config
|
||||||
cert_name: prometheus-server.crt
|
cert_name: prometheus-server.crt
|
||||||
|
@ -53,16 +57,9 @@ Configure prometheus server
|
||||||
- host: ${_param:cluster_node03_address}
|
- host: ${_param:cluster_node03_address}
|
||||||
port: ${_param:cluster_node03_port}
|
port: ${_param:cluster_node03_port}
|
||||||
recording:
|
recording:
|
||||||
- name: 'instance:fd_utilization'
|
instance:fd_utilization:
|
||||||
query: >-
|
query: >-
|
||||||
process_open_fds / process_max_fds
|
process_open_fds / process_max_fds
|
||||||
alert:
|
|
||||||
PrometheusTargetDown:
|
|
||||||
if: 'up != 1'
|
|
||||||
labels:
|
|
||||||
severity: down
|
|
||||||
annotations:
|
|
||||||
summary: 'Prometheus target down'
|
|
||||||
storage:
|
storage:
|
||||||
local:
|
local:
|
||||||
engine: "persisted"
|
engine: "persisted"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://prometheus/files/alertmanager.yml
|
- source: salt://prometheus/files/alertmanager.yml
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -7,11 +7,13 @@
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://prometheus/files/prometheus.yml
|
- source: salt://prometheus/files/prometheus.yml
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
{{server.dir.config}}/alerts.yml:
|
{{server.dir.config}}/alerts.yml:
|
||||||
file.managed:
|
file.managed:
|
||||||
- source: salt://prometheus/files/alerts.yml
|
- source: salt://prometheus/files/alerts.yml
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
prometheus:
|
prometheus:
|
||||||
alertmanager:
|
alertmanager:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
dir:
|
||||||
|
config: /srv/volumes/prometheus
|
||||||
bind:
|
bind:
|
||||||
address: 0.0.0.0
|
address: 0.0.0.0
|
||||||
port: 9093
|
port: 9093
|
||||||
|
external_port: 15011
|
||||||
config:
|
config:
|
||||||
global:
|
global:
|
||||||
resolve_timeout: 5m
|
resolve_timeout: 5m
|
||||||
|
@ -34,3 +37,12 @@ prometheus:
|
||||||
webhook_configs:
|
webhook_configs:
|
||||||
- url: http://127.0.0.1
|
- url: http://127.0.0.1
|
||||||
send_resolved: true
|
send_resolved: true
|
||||||
|
docker:
|
||||||
|
host:
|
||||||
|
enabled: true
|
||||||
|
experimental: true
|
||||||
|
insecure_registries:
|
||||||
|
- 127.0.0.1
|
||||||
|
log:
|
||||||
|
engine: json-file
|
||||||
|
size: 50m
|
|
@ -1,30 +0,0 @@
|
||||||
prometheus:
|
|
||||||
server:
|
|
||||||
enabled: true
|
|
||||||
bind:
|
|
||||||
port: 9090
|
|
||||||
address: 0.0.0.0
|
|
||||||
storage:
|
|
||||||
local:
|
|
||||||
engine: "persisted"
|
|
||||||
retention: "360h"
|
|
||||||
memory_chunks: 1048576
|
|
||||||
max_chunks_to_persist: 524288
|
|
||||||
num_fingerprint_mutexes: 4096
|
|
||||||
alertmanager:
|
|
||||||
notification_queue_capacity: 10000
|
|
||||||
config:
|
|
||||||
global:
|
|
||||||
scrape_interval: "15s"
|
|
||||||
scrape_timeout: "15s"
|
|
||||||
evaluation_interval: "1m"
|
|
||||||
external_labels:
|
|
||||||
region: 'region1'
|
|
||||||
alert:
|
|
||||||
PrometheusTargetDownKubernetesNodes:
|
|
||||||
if: 'up{job="kubernetes-nodes"} != 1'
|
|
||||||
labels:
|
|
||||||
severity: down
|
|
||||||
service: prometheus
|
|
||||||
annotations:
|
|
||||||
summary: 'Prometheus target down'
|
|
|
@ -4,3 +4,4 @@ prometheus:
|
||||||
bind:
|
bind:
|
||||||
address: 0.0.0.0
|
address: 0.0.0.0
|
||||||
port: 9091
|
port: 9091
|
||||||
|
external_port: 15012
|
79
tests/pillar/server.sls
Normal file
79
tests/pillar/server.sls
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
prometheus:
|
||||||
|
server:
|
||||||
|
enabled: true
|
||||||
|
dir:
|
||||||
|
config: /srv/volumes/prometheus
|
||||||
|
config_in_container: /opt/prometheus/config
|
||||||
|
bind:
|
||||||
|
port: 9090
|
||||||
|
address: 0.0.0.0
|
||||||
|
external_port: 15010
|
||||||
|
target:
|
||||||
|
dns:
|
||||||
|
enabled: true
|
||||||
|
endpoint:
|
||||||
|
- name: 'pushgateway'
|
||||||
|
domain:
|
||||||
|
- 'tasks.prometheus_pushgateway'
|
||||||
|
type: A
|
||||||
|
port: 9091
|
||||||
|
- name: 'prometheus'
|
||||||
|
domain:
|
||||||
|
- 'tasks.prometheus_server'
|
||||||
|
type: A
|
||||||
|
port: 9090
|
||||||
|
kubernetes:
|
||||||
|
enabled: true
|
||||||
|
api_ip: 127.0.0.1
|
||||||
|
ssl_dir: /opt/prometheus/config
|
||||||
|
cert_name: prometheus-server.crt
|
||||||
|
key_name: prometheus-server.key
|
||||||
|
etcd:
|
||||||
|
endpoint:
|
||||||
|
scheme: https
|
||||||
|
ssl_dir: /opt/prometheus/config
|
||||||
|
cert_name: prometheus-server.crt
|
||||||
|
key_name: prometheus-server.key
|
||||||
|
member:
|
||||||
|
- host: ${_param:cluster_node01_address}
|
||||||
|
port: ${_param:cluster_node01_port}
|
||||||
|
- host: ${_param:cluster_node02_address}
|
||||||
|
port: ${_param:cluster_node02_port}
|
||||||
|
- host: ${_param:cluster_node03_address}
|
||||||
|
port: ${_param:cluster_node03_port}
|
||||||
|
recording:
|
||||||
|
instance:fd_utilization:
|
||||||
|
query: >-
|
||||||
|
process_open_fds / process_max_fds
|
||||||
|
alert:
|
||||||
|
PrometheusTargetDown:
|
||||||
|
if: 'up != 1'
|
||||||
|
labels:
|
||||||
|
severity: down
|
||||||
|
annotations:
|
||||||
|
summary: 'Prometheus target down'
|
||||||
|
storage:
|
||||||
|
local:
|
||||||
|
engine: "persisted"
|
||||||
|
retention: "360h"
|
||||||
|
memory_chunks: 1048576
|
||||||
|
max_chunks_to_persist: 524288
|
||||||
|
num_fingerprint_mutexes: 4096
|
||||||
|
alertmanager:
|
||||||
|
notification_queue_capacity: 10000
|
||||||
|
config:
|
||||||
|
global:
|
||||||
|
scrape_interval: "15s"
|
||||||
|
scrape_timeout: "15s"
|
||||||
|
evaluation_interval: "1m"
|
||||||
|
external_labels:
|
||||||
|
region: 'region1'
|
||||||
|
docker:
|
||||||
|
host:
|
||||||
|
enabled: true
|
||||||
|
experimental: true
|
||||||
|
insecure_registries:
|
||||||
|
- 127.0.0.1
|
||||||
|
log:
|
||||||
|
engine: json-file
|
||||||
|
size: 50m
|
Loading…
Reference in a new issue