Merge pull request #30 from noelmcloughlin/refactor2
refactor(all): align to template-formula; add clientlibs
This commit is contained in:
commit
1b03b51f6c
90
.travis.yml
90
.travis.yml
@ -25,17 +25,14 @@ stages:
|
|||||||
- name: 'release'
|
- name: 'release'
|
||||||
if: 'branch = master AND type != pull_request'
|
if: 'branch = master AND type != pull_request'
|
||||||
jobs:
|
jobs:
|
||||||
allow_failures:
|
|
||||||
- env: Lint_rubocop
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
include:
|
||||||
## Define the test stage that runs the linters (and testing matrix, if applicable)
|
## Define the test stage that runs the linters (and testing matrix, if applicable)
|
||||||
|
|
||||||
# Run all of the linters in a single job (except `rubocop`)
|
# Run all of the linters in a single job
|
||||||
- language: 'node_js'
|
- language: 'node_js'
|
||||||
node_js: 'lts/*'
|
node_js: 'lts/*'
|
||||||
env: 'Lint'
|
env: 'Lint'
|
||||||
name: 'Lint: salt-lint, yamllint, shellcheck & commitlint'
|
name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint'
|
||||||
before_install: 'skip'
|
before_install: 'skip'
|
||||||
script:
|
script:
|
||||||
# Install and run `salt-lint`
|
# Install and run `salt-lint`
|
||||||
@ -46,6 +43,9 @@ jobs:
|
|||||||
# Need at least `v1.17.0` for the `yaml-files` setting
|
# Need at least `v1.17.0` for the `yaml-files` setting
|
||||||
- pip install --user yamllint>=1.17.0
|
- pip install --user yamllint>=1.17.0
|
||||||
- yamllint -s .
|
- yamllint -s .
|
||||||
|
# Install and run `rubocop`
|
||||||
|
- gem install rubocop
|
||||||
|
- rubocop -d
|
||||||
# Run `shellcheck` (already pre-installed in Travis)
|
# Run `shellcheck` (already pre-installed in Travis)
|
||||||
- shellcheck --version
|
- shellcheck --version
|
||||||
- git ls-files -- '*.sh' '*.bash' '*.ksh'
|
- git ls-files -- '*.sh' '*.bash' '*.ksh'
|
||||||
@ -54,50 +54,52 @@ jobs:
|
|||||||
- npm i -D @commitlint/config-conventional
|
- npm i -D @commitlint/config-conventional
|
||||||
@commitlint/travis-cli
|
@commitlint/travis-cli
|
||||||
- commitlint-travis
|
- commitlint-travis
|
||||||
# Run the `rubocop` linter in a separate job that is allowed to fail
|
|
||||||
# Once these lint errors are fixed, this can be merged into a single job
|
|
||||||
- language: node_js
|
|
||||||
node_js: lts/*
|
|
||||||
env: Lint_rubocop
|
|
||||||
name: 'Lint: rubocop'
|
|
||||||
before_install: skip
|
|
||||||
script:
|
|
||||||
# Install and run `rubocop`
|
|
||||||
- gem install rubocop
|
|
||||||
- rubocop -d
|
|
||||||
|
|
||||||
## Define the rest of the matrix based on Kitchen testing
|
## Define the rest of the matrix based on Kitchen testing
|
||||||
# Make sure the instances listed below match up with
|
# Make sure the instances listed below match up with
|
||||||
# the `platforms` defined in `kitchen.yml`
|
# the `platforms` defined in `kitchen.yml`
|
||||||
|
# NOTE: Please try to select up to six instances that add some meaningful
|
||||||
|
# testing of the formula's behaviour. If possible, try to refrain from
|
||||||
|
# the classical "chosing all the instances because I want to test on
|
||||||
|
# another/all distro/s" trap: it will just add time to the testing (see
|
||||||
|
# the discussion on #121). As an example, the set chosen below covers
|
||||||
|
# the most used distros families, systemd and non-systemd and the latest
|
||||||
|
# three supported Saltstack versions with python2 and 3.
|
||||||
|
# As for `kitchen.yml`, that should still contain all of the platforms,
|
||||||
|
# to allow for comprehensive local testing
|
||||||
|
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
|
||||||
|
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
|
||||||
- env: INSTANCE=default-debian-10-master-py3
|
- env: INSTANCE=default-debian-10-master-py3
|
||||||
- env: INSTANCE=default-ubuntu-1804-master-py3
|
# env: INSTANCE=default-ubuntu-2004-master-py3
|
||||||
# - env: INSTANCE=default-centos-8-master-py3
|
# - env: INSTANCE=default-ubuntu-1804-master-py3
|
||||||
|
- env: INSTANCE=default-centos-8-master-py3
|
||||||
|
# env: INSTANCE=default-fedora-32-master-py3
|
||||||
# - env: INSTANCE=default-fedora-31-master-py3
|
# - env: INSTANCE=default-fedora-31-master-py3
|
||||||
# - env: INSTANCE=default-opensuse-leap-151-master-py3
|
# - env: INSTANCE=default-opensuse-leap-152-master-py3
|
||||||
# - env: INSTANCE=default-amazonlinux-2-master-py3
|
# - env: INSTANCE=default-amazonlinux-2-master-py3
|
||||||
|
# - env: INSTANCE=default-debian-10-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-debian-9-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-ubuntu-1804-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-centos-8-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-centos-7-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-fedora-31-3000-3-py3
|
||||||
|
# env: INSTANCE=default-opensuse-leap-152-3000-3-py3
|
||||||
|
# env: INSTANCE=default-amazonlinux-2-3000-3-py3
|
||||||
|
# - env: INSTANCE=default-ubuntu-1804-3000-3-py2
|
||||||
|
# - env: INSTANCE=default-ubuntu-1604-3000-3-py2
|
||||||
|
# - env: INSTANCE=default-arch-base-latest-3000-3-py2
|
||||||
# - env: INSTANCE=default-debian-10-2019-2-py3
|
# - env: INSTANCE=default-debian-10-2019-2-py3
|
||||||
- env: INSTANCE=default-debian-9-2019-2-py3
|
# - env: INSTANCE=default-debian-9-2019-2-py3
|
||||||
- env: INSTANCE=default-ubuntu-1804-2019-2-py3
|
# - env: INSTANCE=default-ubuntu-1804-2019-2-py3
|
||||||
|
# - env: INSTANCE=default-ubuntu-1604-2019-2-py3
|
||||||
# - env: INSTANCE=default-centos-8-2019-2-py3
|
# - env: INSTANCE=default-centos-8-2019-2-py3
|
||||||
|
# - env: INSTANCE=default-centos-7-2019-2-py3
|
||||||
# - env: INSTANCE=default-fedora-31-2019-2-py3
|
# - env: INSTANCE=default-fedora-31-2019-2-py3
|
||||||
# - env: INSTANCE=default-opensuse-leap-151-2019-2-py3
|
# - env: INSTANCE=default-opensuse-leap-152-2019-2-py3
|
||||||
# - env: INSTANCE=default-centos-7-2019-2-py2
|
|
||||||
# - env: INSTANCE=default-amazonlinux-2-2019-2-py3
|
# - env: INSTANCE=default-amazonlinux-2-2019-2-py3
|
||||||
# - env: INSTANCE=default-arch-base-latest-2019-2-py2
|
# - env: INSTANCE=default-centos-6-2019-2-py2
|
||||||
# - env: INSTANCE=default-fedora-30-2018-3-py3
|
# - env: INSTANCE=default-amazonlinux-1-2019-2-py2
|
||||||
- env: INSTANCE=default-debian-9-2018-3-py2
|
- env: INSTANCE=default-arch-base-latest-2019-2-py2
|
||||||
# - env: INSTANCE=default-ubuntu-1604-2018-3-py2
|
|
||||||
# - env: INSTANCE=default-centos-7-2018-3-py2
|
|
||||||
# - env: INSTANCE=default-opensuse-leap-151-2018-3-py2
|
|
||||||
# - env: INSTANCE=default-amazonlinux-1-2018-3-py2
|
|
||||||
# - env: INSTANCE=default-arch-base-latest-2018-3-py2
|
|
||||||
# - env: INSTANCE=default-debian-8-2017-7-py2
|
|
||||||
- env: INSTANCE=default-ubuntu-1604-2017-7-py2
|
|
||||||
# - env: INSTANCE=default-centos-6-2017-7-py2
|
|
||||||
# - env: INSTANCE=default-fedora-30-2017-7-py2
|
|
||||||
# - env: INSTANCE=default-opensuse-leap-151-2017-7-py2
|
|
||||||
# - env: INSTANCE=default-amazonlinux-1-2017-7-py2
|
|
||||||
# - env: INSTANCE=default-arch-base-latest-2017-7-py2
|
|
||||||
|
|
||||||
## Define the release stage that runs `semantic-release`
|
## Define the release stage that runs `semantic-release`
|
||||||
- stage: 'release'
|
- stage: 'release'
|
||||||
@ -124,15 +126,3 @@ jobs:
|
|||||||
edge: true
|
edge: true
|
||||||
# Run `semantic-release`
|
# Run `semantic-release`
|
||||||
script: 'npx semantic-release@15.14'
|
script: 'npx semantic-release@15.14'
|
||||||
|
|
||||||
# Notification options: `always`, `never` or `change`
|
|
||||||
notifications:
|
|
||||||
webhooks:
|
|
||||||
if: 'repo = saltstack-formulas/prometheus-formula'
|
|
||||||
urls:
|
|
||||||
- https://saltstack-formulas.zulipchat.com/api/v1/external/travis?api_key=HsIq3o5QmLxdnVCKF9is0FUIpkpAY79P&stream=CI&topic=saltstack-formulas%2Fprometheus-formula&ignore_pull_requests=true
|
|
||||||
on_success: always # default: always
|
|
||||||
on_failure: always # default: always
|
|
||||||
on_start: always # default: never
|
|
||||||
on_cancel: always # default: always
|
|
||||||
on_error: always # default: always
|
|
||||||
|
@ -12,6 +12,9 @@ ignore: |
|
|||||||
node_modules/
|
node_modules/
|
||||||
test/**/states/**/*.sls
|
test/**/states/**/*.sls
|
||||||
.kitchen/
|
.kitchen/
|
||||||
|
bin/kitchen
|
||||||
|
prometheus/osfamilymap.yaml
|
||||||
|
pillar.example
|
||||||
|
|
||||||
yaml-files:
|
yaml-files:
|
||||||
# Default settings
|
# Default settings
|
||||||
@ -30,7 +33,7 @@ rules:
|
|||||||
line-length:
|
line-length:
|
||||||
# Increase from default of `80`
|
# Increase from default of `80`
|
||||||
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
|
||||||
max: 88
|
max: 98
|
||||||
octal-values:
|
octal-values:
|
||||||
forbid-implicit-octal: true
|
forbid-implicit-octal: true
|
||||||
forbid-explicit-octal: true
|
forbid-explicit-octal: true
|
||||||
|
15
AUTHORS.md
15
AUTHORS.md
@ -1,15 +0,0 @@
|
|||||||
# Authors
|
|
||||||
|
|
||||||
This list is sorted by the number of commits per contributor in _descending_ order.
|
|
||||||
|
|
||||||
Avatar|Contributor|Contributions
|
|
||||||
:-:|---|:-:
|
|
||||||
<img class='float-left rounded-1' src='https://avatars2.githubusercontent.com/u/10231489?v=4' width='36' height='36' alt='@myii'>|[@myii](https://github.com/myii)|43
|
|
||||||
<img class='float-left rounded-1' src='https://avatars1.githubusercontent.com/u/13322818?v=4' width='36' height='36' alt='@noelmcloughlin'>|[@noelmcloughlin](https://github.com/noelmcloughlin)|21
|
|
||||||
<img class='float-left rounded-1' src='https://avatars0.githubusercontent.com/u/1920805?v=4' width='36' height='36' alt='@alxwr'>|[@alxwr](https://github.com/alxwr)|17
|
|
||||||
<img class='float-left rounded-1' src='https://avatars0.githubusercontent.com/u/1800660?v=4' width='36' height='36' alt='@aboe76'>|[@aboe76](https://github.com/aboe76)|6
|
|
||||||
<img class='float-left rounded-1' src='https://avatars2.githubusercontent.com/u/6086064?v=4' width='36' height='36' alt='@mgomersbach'>|[@mgomersbach](https://github.com/mgomersbach)|1
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-12-22.
|
|
@ -1,12 +1,8 @@
|
|||||||
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
|
||||||
|
|
||||||
# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence
|
# SECTION: Owner(s) for everything in the repo, unless a later match takes precedence
|
||||||
# **************************************************************************
|
|
||||||
# *** NO GLOBAL OWNER(S) SPECIFIED ***
|
|
||||||
# *** Ideally this will be defined for a healthy, well-maintained repo ***
|
|
||||||
# **************************************************************************
|
|
||||||
# FILE PATTERN OWNER(S)
|
# FILE PATTERN OWNER(S)
|
||||||
* @NONE
|
* @alxwr @noelmcloughlin
|
||||||
|
|
||||||
# SECTION: Owner(s) for specific directories
|
# SECTION: Owner(s) for specific directories
|
||||||
# FILE PATTERN OWNER(S)
|
# FILE PATTERN OWNER(S)
|
||||||
|
10
FORMULA
10
FORMULA
@ -1,9 +1,9 @@
|
|||||||
name: prometheus
|
name: prometheus
|
||||||
os: FreeBSD
|
os: Debian, Ubuntu, Raspbian, RedHat, Fedora, CentOS, Amazon, Suse, openSUSE, Gentoo, Funtoo, Arch, Manjaro, Alpine, FreeBSD, OpenBSD, Solaris, SmartOS, Windows, MacOS
|
||||||
os_family: FreeBSD
|
os_family: Debian, RedHat, Suse, Gentoo, Arch, Alpine, FreeBSD, OpenBSD, Solaris, Windows, MacOS
|
||||||
version: 3.3.0
|
version: 3.3.0
|
||||||
release: 1
|
release: 1
|
||||||
minimum_version: 2016.11
|
minimum_version: 2019.2
|
||||||
summary: Prometheus formula
|
summary: prometheus formula
|
||||||
description: Formula to set up Prometheus
|
description: Formula to install prometheus and configure it
|
||||||
top_level_dir: prometheus
|
top_level_dir: prometheus
|
||||||
|
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2019 Salt Stack Formulas
|
Copyright (c) 2014 Salt Stack Formulas
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
.. role:: raw-html-m2r(raw)
|
|
||||||
:format: html
|
|
||||||
|
|
||||||
|
|
||||||
Authors
|
|
||||||
=======
|
|
||||||
|
|
||||||
This list is sorted by the number of commits per contributor in *descending* order.
|
|
||||||
|
|
||||||
.. list-table::
|
|
||||||
:header-rows: 1
|
|
||||||
|
|
||||||
* - Avatar
|
|
||||||
- Contributor
|
|
||||||
- Contributions
|
|
||||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars2.githubusercontent.com/u/10231489?v=4' width='36' height='36' alt='@myii'>`
|
|
||||||
- `@myii <https://github.com/myii>`_
|
|
||||||
- 43
|
|
||||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars1.githubusercontent.com/u/13322818?v=4' width='36' height='36' alt='@noelmcloughlin'>`
|
|
||||||
- `@noelmcloughlin <https://github.com/noelmcloughlin>`_
|
|
||||||
- 21
|
|
||||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars0.githubusercontent.com/u/1920805?v=4' width='36' height='36' alt='@alxwr'>`
|
|
||||||
- `@alxwr <https://github.com/alxwr>`_
|
|
||||||
- 17
|
|
||||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars0.githubusercontent.com/u/1800660?v=4' width='36' height='36' alt='@aboe76'>`
|
|
||||||
- `@aboe76 <https://github.com/aboe76>`_
|
|
||||||
- 6
|
|
||||||
* - :raw-html-m2r:`<img class='float-left rounded-1' src='https://avatars2.githubusercontent.com/u/6086064?v=4' width='36' height='36' alt='@mgomersbach'>`
|
|
||||||
- `@mgomersbach <https://github.com/mgomersbach>`_
|
|
||||||
- 1
|
|
||||||
|
|
||||||
|
|
||||||
----
|
|
||||||
|
|
||||||
Auto-generated by a `forked version <https://github.com/myii/maintainer>`_ of `gaocegege/maintainer <https://github.com/gaocegege/maintainer>`_ on 2019-12-22.
|
|
@ -1,235 +0,0 @@
|
|||||||
|
|
||||||
Changelog
|
|
||||||
=========
|
|
||||||
|
|
||||||
`3.3.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.2.0...v3.3.0>`_ (2019-12-22)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **pillar.example:** reset ``use_upstream_archive`` to get tests passing [skip ci] (\ `978ccc2 <https://github.com/saltstack-formulas/prometheus-formula/commit/978ccc208045136dddea44dc59754872f688a9cb>`_\ )
|
|
||||||
* test fix for bug 24 (\ `341fff3 <https://github.com/saltstack-formulas/prometheus-formula/commit/341fff36ead5fce94c25c0ba8011a15d76f26de6>`_\ )
|
|
||||||
* **release.config.js:** use full commit hash in commit link [skip ci] (\ `cab6e29 <https://github.com/saltstack-formulas/prometheus-formula/commit/cab6e29d8b29c700035694c35b20e8250ecb2ef1>`_\ )
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **gemfile:** restrict ``train`` gem version until upstream fix [skip ci] (\ `a51e532 <https://github.com/saltstack-formulas/prometheus-formula/commit/a51e532992b69571a1f5ffa486f98aed4ddf87e0>`_\ )
|
|
||||||
* **kitchen:** use ``debian-10-master-py3`` instead of ``develop`` [skip ci] (\ `6ee835c <https://github.com/saltstack-formulas/prometheus-formula/commit/6ee835cab4a1dca30c9b7888587c68368c53dee1>`_\ )
|
|
||||||
* **kitchen:** use ``develop`` image until ``master`` is ready (\ ``amazonlinux``\ ) [skip ci] (\ `42ee683 <https://github.com/saltstack-formulas/prometheus-formula/commit/42ee683c44d1bc7035b9ce325e8ad7d0c35b45da>`_\ )
|
|
||||||
* **kitchen+travis:** upgrade matrix after ``2019.2.2`` release [skip ci] (\ `044553e <https://github.com/saltstack-formulas/prometheus-formula/commit/044553ea8f51fc3af64fe3fd4b9fca8c3b58f2df>`_\ )
|
|
||||||
* **travis:** apply changes from build config validation [skip ci] (\ `bf4022e <https://github.com/saltstack-formulas/prometheus-formula/commit/bf4022ec1ac489dc875c02e84a547a7a6c245cb8>`_\ )
|
|
||||||
* **travis:** opt-in to ``dpl v2`` to complete build config validation [skip ci] (\ `0867508 <https://github.com/saltstack-formulas/prometheus-formula/commit/086750884d14bc07ae466dd8247b99c01dbc1766>`_\ )
|
|
||||||
* **travis:** quote pathspecs used with ``git ls-files`` [skip ci] (\ `d9c9386 <https://github.com/saltstack-formulas/prometheus-formula/commit/d9c93860385303ae89025431da7a83d48c5a6adf>`_\ )
|
|
||||||
* **travis:** run ``shellcheck`` during lint job [skip ci] (\ `7ea6967 <https://github.com/saltstack-formulas/prometheus-formula/commit/7ea6967ca7d6c41f99ef4831715b894d9c7c751d>`_\ )
|
|
||||||
* **travis:** update ``salt-lint`` config for ``v0.0.10`` [skip ci] (\ `1415c13 <https://github.com/saltstack-formulas/prometheus-formula/commit/1415c137854f19e34e4a79d74f1bb2b25770ee0c>`_\ )
|
|
||||||
* **travis:** use ``major.minor`` for ``semantic-release`` version [skip ci] (\ `9b4d5af <https://github.com/saltstack-formulas/prometheus-formula/commit/9b4d5aff64b0657303c7186c5f5a49d02039f35f>`_\ )
|
|
||||||
* **travis:** use build config validation (beta) [skip ci] (\ `0d0af0d <https://github.com/saltstack-formulas/prometheus-formula/commit/0d0af0df317c67924d0b8dc75d9dbf8e7a3a9535>`_\ )
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **osfamilymap.yaml:** add Gentoo support (\ `b87e8f4 <https://github.com/saltstack-formulas/prometheus-formula/commit/b87e8f437c51c81bb7543ad27b49dea48ff36203>`_\ )
|
|
||||||
|
|
||||||
Performance Improvements
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **travis:** improve ``salt-lint`` invocation [skip ci] (\ `36ccdc4 <https://github.com/saltstack-formulas/prometheus-formula/commit/36ccdc4416d58952865ef60e7b94d122f09c6cde>`_\ )
|
|
||||||
|
|
||||||
`3.2.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.1.2...v3.2.0>`_ (2019-10-17)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **args:** allow boolean arguments (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/39dacf0>`_\ )
|
|
||||||
* **examples:** fixed pillar.example (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/464a186>`_\ )
|
|
||||||
* **node_exporter:** allow standalone use of node_exporter (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/a0d8ad4>`_\ )
|
|
||||||
* **package:** use correct node exporter package name in Debian (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/a4fd589>`_\ )
|
|
||||||
* **readme:** removed already gone prometheus.exporters from README.rst (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/07d6209>`_\ )
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* merge travis matrix, add ``salt-lint`` & ``rubocop`` to ``lint`` job (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/9def915>`_\ )
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **contributing:** remove to use org-level file instead [skip ci] (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/fabcc4a>`_\ )
|
|
||||||
* **readme:** update link to ``CONTRIBUTING`` [skip ci] (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/da2a5aa>`_\ )
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **freebsd:** support for FreeBSD (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/871da35>`_\ )
|
|
||||||
* **textfile_collectors:** added IPMI textfile collector (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/d731309>`_\ )
|
|
||||||
* **textfile_collectors:** added smartmon textfile collector (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/7b2f5ce>`_\ )
|
|
||||||
* **textfile_collectors:** added support for textfile collectors (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/930552d>`_\ )
|
|
||||||
|
|
||||||
`3.1.2 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.1.1...v3.1.2>`_ (2019-10-10)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **clean.sls:** fix ``salt-lint`` errors (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/8056339>`_\ )
|
|
||||||
* **install.sls:** fix ``salt-lint`` errors (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/51f5485>`_\ )
|
|
||||||
* **install.sls:** fix ``salt-lint`` errors (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/173bc4f>`_\ )
|
|
||||||
* **install.sls:** fix ``salt-lint`` errors (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/85c7fce>`_\ )
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* merge travis matrix, add ``salt-lint`` & ``rubocop`` to ``lint`` job (\ ` <https://github.com/saltstack-formulas/prometheus-formula/commit/569328b>`_\ )
|
|
||||||
|
|
||||||
`3.1.1 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.1.0...v3.1.1>`_ (2019-10-07)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **config:** cope with aberrant service names (\ `0a33842 <https://github.com/saltstack-formulas/prometheus-formula/commit/0a33842>`_\ )
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* use ``dist: bionic`` & apply ``opensuse-leap-15`` SCP error workaround (\ `3dc6e12 <https://github.com/saltstack-formulas/prometheus-formula/commit/3dc6e12>`_\ )
|
|
||||||
* **kitchen:** change ``log_level`` to ``debug`` instead of ``info`` (\ `af666db <https://github.com/saltstack-formulas/prometheus-formula/commit/af666db>`_\ )
|
|
||||||
* **kitchen:** install required packages to bootstrapped ``opensuse`` [skip ci] (\ `3332493 <https://github.com/saltstack-formulas/prometheus-formula/commit/3332493>`_\ )
|
|
||||||
* **kitchen:** use bootstrapped ``opensuse`` images until ``2019.2.2`` [skip ci] (\ `a624dd8 <https://github.com/saltstack-formulas/prometheus-formula/commit/a624dd8>`_\ )
|
|
||||||
* **kitchen+travis:** replace EOL pre-salted images (\ `0895d81 <https://github.com/saltstack-formulas/prometheus-formula/commit/0895d81>`_\ )
|
|
||||||
* **platform:** add ``arch-base-latest`` (commented out for now) [skip ci] (\ `6221888 <https://github.com/saltstack-formulas/prometheus-formula/commit/6221888>`_\ )
|
|
||||||
* **yamllint:** add rule ``empty-values`` & use new ``yaml-files`` setting (\ `1784b34 <https://github.com/saltstack-formulas/prometheus-formula/commit/1784b34>`_\ )
|
|
||||||
|
|
||||||
`3.1.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.0.1...v3.1.0>`_ (2019-08-17)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **kitchen+travis:** modify matrix to include ``develop`` platform (\ `fc0f5b6 <https://github.com/saltstack-formulas/prometheus-formula/commit/fc0f5b6>`_\ )
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **yamllint:** include for this repo and apply rules throughout (\ `07dbfc8 <https://github.com/saltstack-formulas/prometheus-formula/commit/07dbfc8>`_\ )
|
|
||||||
|
|
||||||
`3.0.1 <https://github.com/saltstack-formulas/prometheus-formula/compare/v3.0.0...v3.0.1>`_ (2019-06-28)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **alternatives:** fix requisite (\ `8c410d7 <https://github.com/saltstack-formulas/prometheus-formula/commit/8c410d7>`_\ )
|
|
||||||
|
|
||||||
`3.0.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v2.0.0...v3.0.0>`_ (2019-06-23)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **example:** fix pillar.example formatting (\ `a13dd03 <https://github.com/saltstack-formulas/prometheus-formula/commit/a13dd03>`_\ )
|
|
||||||
* **repo:** use_upstream_repo corrections; separate users state (\ `eda47f7 <https://github.com/saltstack-formulas/prometheus-formula/commit/eda47f7>`_\ )
|
|
||||||
* **service:** ensure service file is removed on clean (\ `c735a6d <https://github.com/saltstack-formulas/prometheus-formula/commit/c735a6d>`_\ )
|
|
||||||
* **suse:** bypass salt alternatives.install errors (\ `1a890e5 <https://github.com/saltstack-formulas/prometheus-formula/commit/1a890e5>`_\ )
|
|
||||||
* **systemd:** ensure systemd detects new service (\ `149dd81 <https://github.com/saltstack-formulas/prometheus-formula/commit/149dd81>`_\ )
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **archives:** support for archives file format (\ `1f86f4a <https://github.com/saltstack-formulas/prometheus-formula/commit/1f86f4a>`_\ )
|
|
||||||
* **archives:** support for various prometheus archives (\ `3ec910e <https://github.com/saltstack-formulas/prometheus-formula/commit/3ec910e>`_\ )
|
|
||||||
* **archives:** user managementX (\ `d43033a <https://github.com/saltstack-formulas/prometheus-formula/commit/d43033a>`_\ )
|
|
||||||
* **linux:** alternatives support & updated unit tests (\ `36b3e62 <https://github.com/saltstack-formulas/prometheus-formula/commit/36b3e62>`_\ )
|
|
||||||
|
|
||||||
Tests
|
|
||||||
^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **centos:** verified on CentosOS (\ `731198d <https://github.com/saltstack-formulas/prometheus-formula/commit/731198d>`_\ )
|
|
||||||
* **inspec:** expand unittests for archive format (\ `b074bd3 <https://github.com/saltstack-formulas/prometheus-formula/commit/b074bd3>`_\ )
|
|
||||||
* **inspec:** fix tests (\ `4092fb4 <https://github.com/saltstack-formulas/prometheus-formula/commit/4092fb4>`_\ )
|
|
||||||
|
|
||||||
BREAKING CHANGES
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **repo:** The formula has been refactored to accomodate multiple packages,
|
|
||||||
archives, users, and repos. Update your pillars and top states
|
|
||||||
* **archives:** the parameter ``pkg`` is now a dictionary. References
|
|
||||||
to ``prometheus.pkg`` should be changed to ``prometheus.pkg.name``.
|
|
||||||
|
|
||||||
`2.0.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v1.2.0...v2.0.0>`_ (2019-06-22)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **repository:** add support for pkgrepo.managed (\ `907f9a6 <https://github.com/saltstack-formulas/prometheus-formula/commit/907f9a6>`_\ )
|
|
||||||
|
|
||||||
BREAKING CHANGES
|
|
||||||
^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **repository:** the variable 'pkg' was renamed 'pkg.name',
|
|
||||||
update your pillars
|
|
||||||
|
|
||||||
`1.2.0 <https://github.com/saltstack-formulas/prometheus-formula/compare/v1.1.0...v1.2.0>`_ (2019-06-05)
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **macos:** basic package and group handling (\ `e6a8b0c <https://github.com/saltstack-formulas/prometheus-formula/commit/e6a8b0c>`_\ )
|
|
||||||
|
|
||||||
`1.1.0 <https://github.com/alxwr/prometheus-formula/compare/v1.0.0...v1.1.0>`_ (2019-04-30)
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Bug Fixes
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **FreeBSD:** elegantly prevent service hang (\ `a7fad98 <https://github.com/alxwr/prometheus-formula/commit/a7fad98>`_\ ), closes `/github.com/saltstack/salt/issues/44848#issuecomment-487016414 <https://github.com//github.com/saltstack/salt/issues/44848/issues/issuecomment-487016414>`_
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **args:** handle service arguments the same way (\ `94078fe <https://github.com/alxwr/prometheus-formula/commit/94078fe>`_\ )
|
|
||||||
* **exporters:** added node_exporter (\ `34ada49 <https://github.com/alxwr/prometheus-formula/commit/34ada49>`_\ )
|
|
||||||
|
|
||||||
1.0.0 (2019-04-25)
|
|
||||||
------------------
|
|
||||||
|
|
||||||
Continuous Integration
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **travis:** use structure of template-formula (\ `88d3f3e <https://github.com/alxwr/prometheus-formula/commit/88d3f3e>`_\ )
|
|
||||||
|
|
||||||
Features
|
|
||||||
^^^^^^^^
|
|
||||||
|
|
||||||
|
|
||||||
* **prometheus:** basic setup based on template-formula (\ `b9b7cc0 <https://github.com/alxwr/prometheus-formula/commit/b9b7cc0>`_\ )
|
|
132
docs/README.rst
132
docs/README.rst
@ -1,7 +1,9 @@
|
|||||||
.. _readme:
|
.. _readme:
|
||||||
|
|
||||||
prometheus-formula
|
prometheus-formula
|
||||||
================
|
==================
|
||||||
|
|
||||||
|
Formula to manage Prometheus on GNU/Linux and MacOS.
|
||||||
|
|
||||||
|img_travis| |img_sr|
|
|img_travis| |img_sr|
|
||||||
|
|
||||||
@ -13,30 +15,32 @@ prometheus-formula
|
|||||||
:alt: Semantic Release
|
:alt: Semantic Release
|
||||||
:scale: 100%
|
:scale: 100%
|
||||||
:target: https://github.com/semantic-release/semantic-release
|
:target: https://github.com/semantic-release/semantic-release
|
||||||
Manage Prometheus on MacOS, GNU/Linux and FreeBSD.
|
|
||||||
|
|
||||||
.. contents:: **Table of Contents**
|
.. contents:: **Table of Contents**
|
||||||
|
:depth: 1
|
||||||
|
|
||||||
General notes
|
General notes
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
See the full `SaltStack Formulas installation and usage instructions
|
See the full `SaltStack Formulas installation and usage instructions
|
||||||
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.
|
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_. If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
|
||||||
|
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas>`_. If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``, which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_. See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.
|
||||||
|
|
||||||
If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``,
|
Special notes
|
||||||
which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_.
|
-------------
|
||||||
|
|
||||||
See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.
|
None.
|
||||||
|
|
||||||
Contributing to this repo
|
Contributing to this repo
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
**Commit message formatting is significant!!**
|
**Commit message formatting is significant!!**
|
||||||
|
|
||||||
Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst>`_ for more details.
|
Please see :ref:`How to contribute <CONTRIBUTING>` for more details.
|
||||||
|
|
||||||
Available states
|
Available metastates
|
||||||
----------------
|
--------------------
|
||||||
|
|
||||||
.. contents::
|
.. contents::
|
||||||
:local:
|
:local:
|
||||||
@ -46,86 +50,112 @@ Available states
|
|||||||
|
|
||||||
*Meta-state (This is a state that includes other states)*.
|
*Meta-state (This is a state that includes other states)*.
|
||||||
|
|
||||||
This installs the prometheus package,
|
This installs from prometheus solution.
|
||||||
manages the prometheus configuration file and then
|
|
||||||
starts the associated prometheus service.
|
|
||||||
|
|
||||||
``prometheus.archive``
|
``prometheus.archive``
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will install the prometheus from archive file only.
|
This state will install prometheus components on MacOS and GNU/Linux from archive.
|
||||||
|
|
||||||
``prometheus.archive.alternatives``
|
``prometheus.clientlibs``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will install the prometheus linux alternatives for archives only.
|
This state will install prometheus client libraries on MacOS and GNU/Linux from archive.
|
||||||
|
|
||||||
``prometheus.package``
|
``prometheus.package``
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will install the prometheus package only.
|
This state will install prometheus component packages from GNU/Linux.
|
||||||
|
|
||||||
``prometheus.package.repo``
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This state will install the prometheus package only.
|
|
||||||
|
|
||||||
``prometheus.config``
|
``prometheus.config``
|
||||||
^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will configure the prometheus service and has a dependency on ``prometheus.install``
|
This state will apply prometheus service configuration (files).
|
||||||
via include list.
|
|
||||||
|
|
||||||
``prometheus.service``
|
``prometheus.service``
|
||||||
^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will start the prometheus service and has a dependency on ``prometheus.config``
|
This state will start prometheus component services.
|
||||||
via include list.
|
|
||||||
|
|
||||||
``prometheus.clean``
|
``prometheus.exporters``
|
||||||
^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
*Meta-state (This is a state that includes other states)*.
|
This state will apply prometheus exporters configuration.
|
||||||
|
|
||||||
this state will undo everything performed in the ``prometheus`` meta-state in reverse order, i.e.
|
``prometheus.exporters.clean``
|
||||||
stops the service,
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
removes the configuration file and
|
|
||||||
then uninstalls the package.
|
This state will remove prometheus exporters configuration.
|
||||||
|
|
||||||
``prometheus.service.clean``
|
``prometheus.service.clean``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will stop the prometheus service and disable it at boot time.
|
This state will stop prometheus component services.
|
||||||
|
|
||||||
``prometheus.config.clean``
|
``prometheus.config.clean``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will remove the configuration of the prometheus service and has a
|
This state will remove prometheus service configuration (files).
|
||||||
dependency on ``prometheus.service.clean`` via include list.
|
|
||||||
|
|
||||||
``prometheus.package.clean``
|
``prometheus.package.clean``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will remove the prometheus package and has a depency on
|
This state will uninstall prometheus component packages from GNU/Linux.
|
||||||
``prometheus.config.clean`` via include list.
|
|
||||||
|
|
||||||
``prometheus.package.archive.clean``
|
``prometheus.clientlibs.clean``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will uninstall the prometheus archive-extracted directory only.
|
This state will uninstall prometheus client libraries.
|
||||||
|
|
||||||
``prometheus.package.archive.alternatives.clean``
|
``prometheus.archive.clean``
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
This state will uninstall the prometheus linux alternatives for archives only.
|
This state will remove prometheus component archive (directories).
|
||||||
|
|
||||||
``prometheus.package.repo.clean``
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
This state will uninstall the prometheus upstream package repository only.
|
Testing
|
||||||
|
-------
|
||||||
|
|
||||||
``prometheus.config.node_exporter.textfile_collectors``
|
Linux testing is done with ``kitchen-salt``.
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
Requirements
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
* Ruby
|
||||||
|
* Docker
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ gem install bundler
|
||||||
|
$ bundle install
|
||||||
|
$ bin/kitchen test [platform]
|
||||||
|
|
||||||
|
Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
|
||||||
|
e.g. ``debian-9-2019-2-py3``.
|
||||||
|
|
||||||
|
``bin/kitchen converge``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Creates the docker instance and runs the ``prometheus`` main state, ready for testing.
|
||||||
|
|
||||||
|
``bin/kitchen verify``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Runs the ``inspec`` tests on the actual instance.
|
||||||
|
|
||||||
|
``bin/kitchen destroy``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Removes the docker instance.
|
||||||
|
|
||||||
|
``bin/kitchen test``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
|
||||||
|
|
||||||
|
``bin/kitchen login``
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Gives you SSH access to the instance for manual testing.
|
||||||
|
|
||||||
This state will manage the node exporter's textfile collectors
|
|
||||||
according to Pillar ``prometheus:exporters:node_exporter:textfile_collectors``.
|
|
||||||
|
21
docs/_static/css/custom.css
vendored
Normal file
21
docs/_static/css/custom.css
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Override styles for in-use Sphinx theme
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* The next two `.wy`-based rules are specifically needed for the dealing with */
|
||||||
|
/* the `sphinx_rtd_theme` bug where long lines do not wrap in tables */
|
||||||
|
|
||||||
|
/* override table width restrictions */
|
||||||
|
.wy-table-responsive table th
|
||||||
|
, .wy-table-responsive table td
|
||||||
|
{
|
||||||
|
/* !important prevents the common CSS stylesheets from
|
||||||
|
overriding this as on RTD they are loaded after this stylesheet */
|
||||||
|
white-space: normal !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wy-table-responsive
|
||||||
|
{
|
||||||
|
overflow: visible !important;
|
||||||
|
}
|
||||||
|
|
173
docs/conf.py
Normal file
173
docs/conf.py
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Configuration file for the Sphinx documentation builder.
|
||||||
|
|
||||||
|
This file does only contain a selection of the most common options. For a
|
||||||
|
full list see the documentation:
|
||||||
|
|
||||||
|
* http://www.sphinx-doc.org/en/stable/config
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import division, print_function, unicode_literals
|
||||||
|
|
||||||
|
# from datetime import datetime
|
||||||
|
|
||||||
|
from recommonmark.parser import CommonMarkParser
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
__author__ = 'Imran Iqbal' # noqa: E221
|
||||||
|
__copyright__ = 'Copyright (C) 2019, MYII' # noqa: E221
|
||||||
|
__license__ = 'Apache-2.0' # noqa: E221
|
||||||
|
__version__ = 'latest' # noqa: E221
|
||||||
|
__maintainer__ = 'Imran Iqbal' # noqa: E221
|
||||||
|
|
||||||
|
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
|
project = 'template-formula'
|
||||||
|
copyright = __copyright__.replace('Copyright (C) ', '') # noqa: A001
|
||||||
|
author = __author__
|
||||||
|
version = __version__
|
||||||
|
release = __version__
|
||||||
|
|
||||||
|
|
||||||
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#
|
||||||
|
# needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = []
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['templates', '_templates', '.templates']
|
||||||
|
|
||||||
|
# The suffix(es) of source filenames.
|
||||||
|
# You can specify multiple suffix as a list of string:
|
||||||
|
#
|
||||||
|
source_suffix = ['.rst', '.md']
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#
|
||||||
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
|
# Usually you set "language" from the command line for these cases.
|
||||||
|
language = None
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This pattern also affects html_static_path and html_extra_path .
|
||||||
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for the reStructuredText parser ---------------------------------
|
||||||
|
|
||||||
|
file_insertion_enabled = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#
|
||||||
|
# html_theme_options = {}
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# Custom sidebar templates, must be a dictionary that maps document names
|
||||||
|
# to template names.
|
||||||
|
#
|
||||||
|
# The default sidebars (for documents that don't match any pattern) are
|
||||||
|
# defined by theme itself. Builtin themes are using these templates by
|
||||||
|
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
|
||||||
|
# 'searchbox.html']``.
|
||||||
|
#
|
||||||
|
# html_sidebars = {}
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTMLHelp output ---------------------------------------------
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'template-formula'
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Markdown output ---------------------------------------------
|
||||||
|
|
||||||
|
source_parsers = {
|
||||||
|
'.md': CommonMarkParser,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ------------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#
|
||||||
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#
|
||||||
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#
|
||||||
|
# 'preamble': '',
|
||||||
|
|
||||||
|
# Latex figure (float) alignment
|
||||||
|
#
|
||||||
|
# 'figure_align': 'htbp',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title,
|
||||||
|
# author, documentclass [howto, manual, or own class]).
|
||||||
|
latex_documents = [
|
||||||
|
(
|
||||||
|
'index',
|
||||||
|
'template-formula.tex',
|
||||||
|
u'template-formula Documentation',
|
||||||
|
u'',
|
||||||
|
'manual',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# -- Functions: `setup`, docstring preprocessing, etc. -----------------------
|
||||||
|
|
||||||
|
def setup(app):
|
||||||
|
"""Prepare the Sphinx application object.
|
||||||
|
|
||||||
|
Used for providing a custom CSS file for override styles.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
app : object
|
||||||
|
The Sphinx application object.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
app : object
|
||||||
|
The Sphinx application object.
|
||||||
|
|
||||||
|
"""
|
||||||
|
app.add_stylesheet('css/custom.css')
|
||||||
|
return app
|
20
docs/index.rst
Normal file
20
docs/index.rst
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
.. _index:
|
||||||
|
|
||||||
|
.. ``template-formula`` documentation master file.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Welcome to template-formula's documentation!
|
||||||
|
============================================
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
:caption: Contents
|
||||||
|
:numbered:
|
||||||
|
:glob:
|
||||||
|
|
||||||
|
README <README>
|
||||||
|
CONTRIBUTING
|
||||||
|
TOFS_pattern
|
||||||
|
AUTHORS
|
||||||
|
CHANGELOG
|
20
kitchen.yml
20
kitchen.yml
@ -156,6 +156,7 @@ suites:
|
|||||||
state_top:
|
state_top:
|
||||||
base:
|
base:
|
||||||
'*':
|
'*':
|
||||||
|
# prometheus.clean
|
||||||
- prometheus
|
- prometheus
|
||||||
pillars:
|
pillars:
|
||||||
top.sls:
|
top.sls:
|
||||||
@ -163,7 +164,24 @@ suites:
|
|||||||
'*':
|
'*':
|
||||||
- prometheus
|
- prometheus
|
||||||
pillars_from_files:
|
pillars_from_files:
|
||||||
prometheus.sls: pillar.example
|
prometheus.sls: test/salt/pillar/default.sls
|
||||||
verifier:
|
verifier:
|
||||||
inspec_tests:
|
inspec_tests:
|
||||||
- path: test/integration/default
|
- path: test/integration/default
|
||||||
|
- name: repo
|
||||||
|
provisioner:
|
||||||
|
state_top:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
# prometheus.clean
|
||||||
|
- prometheus
|
||||||
|
pillars:
|
||||||
|
top.sls:
|
||||||
|
base:
|
||||||
|
'*':
|
||||||
|
- prometheus
|
||||||
|
pillars_from_files:
|
||||||
|
prometheus.sls: test/salt/pillar/repo.sls
|
||||||
|
verifier:
|
||||||
|
inspec_tests:
|
||||||
|
- path: test/integration/repo
|
||||||
|
321
pillar.example
321
pillar.example
@ -3,54 +3,183 @@
|
|||||||
---
|
---
|
||||||
prometheus:
|
prometheus:
|
||||||
wanted:
|
wanted:
|
||||||
- prometheus
|
clientlibs:
|
||||||
{%- if grains.os_family not in ('Debian',) %}
|
- golang
|
||||||
- alertmanager
|
- haskell
|
||||||
{%- endif %}
|
- rust
|
||||||
- node_exporter
|
component:
|
||||||
# no memcached_exporter in upstream repo - only archive
|
- prometheus
|
||||||
# memcached_exporter
|
- alertmanager # not in debian repo, only archive
|
||||||
|
- node_exporter
|
||||||
|
# - memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
use_upstream_archive: false
|
exporters:
|
||||||
{%- if grains.os_family in ('CentOS',) %}
|
|
||||||
use_upstream_repo: false
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
pkg:
|
|
||||||
prometheus:
|
|
||||||
archive_version: '2.10.0'
|
|
||||||
archive_hash: f4233783826f18606b79e5cef0686e4a9c2030146a3c7ce134f0add09f5adcb7
|
|
||||||
alertmanager:
|
|
||||||
archive_version: '0.17.0'
|
|
||||||
archive_hash: ec171b13976baceace193461f8a1e61021ab9657df5ba45157cd0095aee7d569
|
|
||||||
|
|
||||||
service:
|
|
||||||
prometheus:
|
|
||||||
args:
|
|
||||||
web.listen-address: 0.0.0.0:9090
|
|
||||||
# pushgateway:
|
|
||||||
# args:
|
|
||||||
# web.listen-address: ":9091"
|
|
||||||
# web.telemetry-path: "/metrics"
|
|
||||||
node_exporter:
|
node_exporter:
|
||||||
args:
|
textfile_collectors_dependencies: []
|
||||||
web.listen-address: ":9110"
|
textfile_collectors:
|
||||||
# collector.textfile.directory: /var/tmp/node_exporter
|
ipmitool:
|
||||||
|
enable: false
|
||||||
|
remove: false
|
||||||
|
pkg: ipmitool
|
||||||
|
smartmon:
|
||||||
|
enable: false
|
||||||
|
remove: false
|
||||||
|
pkg: smartmontools
|
||||||
|
bash_pkg: bash
|
||||||
|
smartctl: /usr/sbin/smartctl
|
||||||
|
pkg:
|
||||||
|
use_upstream_repo: false
|
||||||
|
use_upstream_archive: true
|
||||||
|
|
||||||
|
clientlibs:
|
||||||
|
# https://prometheus.io/docs/instrumenting/clientlibs
|
||||||
|
# no bash & perl client tarballs are available
|
||||||
|
golang:
|
||||||
|
version: v1.6.0
|
||||||
|
component:
|
||||||
|
alertmanager:
|
||||||
|
config:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
||||||
|
global:
|
||||||
|
smtp_smarthost: 'localhost:25'
|
||||||
|
smtp_from: 'alertmanager@example.org'
|
||||||
|
smtp_auth_username: 'alertmanager'
|
||||||
|
smtp_auth_password: "multiline\nmysecret"
|
||||||
|
smtp_hello: "host.example.org"
|
||||||
|
slack_api_url: "http://mysecret.example.com/"
|
||||||
|
http_config:
|
||||||
|
proxy_url: 'http://127.0.0.1:1025'
|
||||||
|
route:
|
||||||
|
group_by: ['alertname', 'cluster', 'service']
|
||||||
|
group_wait: 30s
|
||||||
|
group_interval: 5m
|
||||||
|
repeat_interval: 3h
|
||||||
|
receiver: team-X-mails
|
||||||
|
routes:
|
||||||
|
- match_re:
|
||||||
|
service: ^(foo1|foo2|baz)$
|
||||||
|
receiver: team-X-mails
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
severity: critical
|
||||||
|
receiver: team-X-mails
|
||||||
|
receivers:
|
||||||
|
- name: 'team-X-mails'
|
||||||
|
email_configs:
|
||||||
|
- to: 'team-X+alerts@example.org'
|
||||||
|
|
||||||
|
inhibit_rules:
|
||||||
|
- name: opsGenie-receiver
|
||||||
|
opsgenie_configs:
|
||||||
|
- api_key: mysecret
|
||||||
|
- name: slack-receiver
|
||||||
|
slack_configs:
|
||||||
|
- channel: '#my-channel'
|
||||||
|
image_url: 'http://some.img.com/img.png'
|
||||||
|
|
||||||
|
node_exporter:
|
||||||
|
version: v0.18.1
|
||||||
|
archive:
|
||||||
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
service:
|
||||||
|
name: prometheus-node-exporter
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9110"
|
||||||
|
# collector.textfile.directory: /var/tmp/node_exporter
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: 0.0.0.0:9090
|
||||||
|
config:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
||||||
|
# my global config
|
||||||
|
global:
|
||||||
|
# Set the scrape interval to every 15 seconds. Default is every 1 minute
|
||||||
|
scrape_interval: 15s
|
||||||
|
# Evaluate rules every 15 seconds. The default is every 1 minute
|
||||||
|
evaluation_interval: 15s
|
||||||
|
# scrape_timeout is set to the global default (10s)
|
||||||
|
|
||||||
|
# Alertmanager configuration
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- static_configs:
|
||||||
|
- targets:
|
||||||
|
- alertmanager1:9093
|
||||||
|
- alertmanager2:9093
|
||||||
|
- alertmanager3:9093
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global
|
||||||
|
# 'evaluation_interval'
|
||||||
|
rule_files:
|
||||||
|
- "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label `job=<job_name>` to any timeseries
|
||||||
|
# scraped from this config
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
# metrics_path defaults to '/metrics'
|
||||||
|
# scheme defaults to 'http'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
|
- job_name: pushgateway
|
||||||
|
scrape_interval: 5s
|
||||||
|
honor_labels: true
|
||||||
|
static_configs:
|
||||||
|
- targets: ['pushgateway:9091']
|
||||||
|
|
||||||
|
- job_name: 'blackbox'
|
||||||
|
# https://github.com/prometheus/blackbox_exporter#prometheus-configuration
|
||||||
|
metrics_path: /probe
|
||||||
|
params:
|
||||||
|
module: [http_2xx] # Look for a HTTP 200 response
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- http://prometheus.io # Target to probe with http
|
||||||
|
- https://prometheus.io # Target to probe with https
|
||||||
|
- http://example.com:8080 # Target to probe with http on port 8080
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: [__address__]
|
||||||
|
target_label: __param_target
|
||||||
|
- source_labels: [__param_target]
|
||||||
|
target_label: instance
|
||||||
|
- target_label: __address__
|
||||||
|
replacement: '127.0.0.1:9115' # real hostname and port
|
||||||
|
|
||||||
|
pushgateway:
|
||||||
|
version: v0.8.0
|
||||||
|
archive:
|
||||||
|
source_hash: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9091"
|
||||||
|
web.telemetry-path: "/metrics"
|
||||||
|
|
||||||
|
linux:
|
||||||
|
# 'Alternatives system' priority: zero disables (default)
|
||||||
|
# yamllint disable-line rule:braces
|
||||||
|
altpriority: {{ range(1, 9100000) | random }}
|
||||||
|
|
||||||
tofs:
|
tofs:
|
||||||
# The files_switch key serves as a selector for alternative
|
# The files_switch key serves as a selector for alternative
|
||||||
# directories under the formula files directory. See TOFS pattern
|
# directories under the formula files directory. See TOFS pattern
|
||||||
# doc for more info.
|
# doc for more info
|
||||||
# Note: Any value not evaluated by `config.get` will be used literally.
|
# Note: Any value not evaluated by `config.get` will be used literally
|
||||||
# This can be used to set custom paths, as many levels deep as required.
|
# This can be used to set custom paths, as many levels deep as required
|
||||||
files_switch:
|
files_switch:
|
||||||
- any/path/can/be/used/here
|
- any/path/can/be/used/here
|
||||||
- id
|
- id
|
||||||
- osfinger
|
- osfinger
|
||||||
- os
|
- os
|
||||||
- os_family
|
- os_family
|
||||||
# All aspects of path/file resolution are customisable using the options below.
|
# All aspects of path/file resolution are customisable using the options below
|
||||||
# This is unnecessary in most cases; there are sensible defaults.
|
# This is unnecessary in most cases; there are sensible defaults
|
||||||
# path_prefix: prometheus_alt
|
# path_prefix: prometheus_alt
|
||||||
# dirs:
|
# dirs:
|
||||||
# files: files_alt
|
# files: files_alt
|
||||||
@ -60,123 +189,3 @@ prometheus:
|
|||||||
- 'alt_config.yml.jinja'
|
- 'alt_config.yml.jinja'
|
||||||
prometheus-archive-install-managed-service:
|
prometheus-archive-install-managed-service:
|
||||||
- 'alt_systemd.ini.jinja'
|
- 'alt_systemd.ini.jinja'
|
||||||
|
|
||||||
# Pillar-based config
|
|
||||||
config:
|
|
||||||
prometheus:
|
|
||||||
# yamllint disable-line rule:line-length
|
|
||||||
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
|
||||||
# my global config
|
|
||||||
global:
|
|
||||||
# Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
|
||||||
scrape_interval: 15s
|
|
||||||
# Evaluate rules every 15 seconds. The default is every 1 minute.
|
|
||||||
evaluation_interval: 15s
|
|
||||||
# scrape_timeout is set to the global default (10s).
|
|
||||||
|
|
||||||
# Alertmanager configuration
|
|
||||||
alerting:
|
|
||||||
alertmanagers:
|
|
||||||
- static_configs:
|
|
||||||
- targets:
|
|
||||||
- alertmanager1:9093
|
|
||||||
- alertmanager2:9093
|
|
||||||
- alertmanager3:9093
|
|
||||||
|
|
||||||
# Load rules once and periodically evaluate them according to the global
|
|
||||||
# 'evaluation_interval'.
|
|
||||||
rule_files:
|
|
||||||
- "first_rules.yml"
|
|
||||||
# - "second_rules.yml"
|
|
||||||
|
|
||||||
# A scrape configuration containing exactly one endpoint to scrape:
|
|
||||||
scrape_configs:
|
|
||||||
# The job name is added as a label `job=<job_name>` to any timeseries
|
|
||||||
# scraped from this config.
|
|
||||||
- job_name: 'prometheus'
|
|
||||||
# metrics_path defaults to '/metrics'
|
|
||||||
# scheme defaults to 'http'.
|
|
||||||
static_configs:
|
|
||||||
- targets: ['localhost:9090']
|
|
||||||
|
|
||||||
- job_name: pushgateway
|
|
||||||
scrape_interval: 5s
|
|
||||||
honor_labels: true
|
|
||||||
static_configs:
|
|
||||||
- targets: ['pushgateway:9091']
|
|
||||||
|
|
||||||
- job_name: 'blackbox'
|
|
||||||
# ref https://github.com/prometheus/blackbox_exporter#prometheus-configuration
|
|
||||||
metrics_path: /probe
|
|
||||||
params:
|
|
||||||
module: [http_2xx] # Look for a HTTP 200 response.
|
|
||||||
static_configs:
|
|
||||||
- targets:
|
|
||||||
- http://prometheus.io # Target to probe with http.
|
|
||||||
- https://prometheus.io # Target to probe with https.
|
|
||||||
- http://example.com:8080 # Target to probe with http on port 8080.
|
|
||||||
relabel_configs:
|
|
||||||
- source_labels: [__address__]
|
|
||||||
target_label: __param_target
|
|
||||||
- source_labels: [__param_target]
|
|
||||||
target_label: instance
|
|
||||||
- target_label: __address__
|
|
||||||
replacement: 127.0.0.1:9115 # The blackbox exporter's real hostname:port.
|
|
||||||
|
|
||||||
alertmanager:
|
|
||||||
# yamllint disable-line rule:line-length
|
|
||||||
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
|
||||||
global:
|
|
||||||
smtp_smarthost: 'localhost:25'
|
|
||||||
smtp_from: 'alertmanager@example.org'
|
|
||||||
smtp_auth_username: 'alertmanager'
|
|
||||||
smtp_auth_password: "multiline\nmysecret"
|
|
||||||
smtp_hello: "host.example.org"
|
|
||||||
slack_api_url: "http://mysecret.example.com/"
|
|
||||||
http_config:
|
|
||||||
proxy_url: 'http://127.0.0.1:1025'
|
|
||||||
route:
|
|
||||||
group_by: ['alertname', 'cluster', 'service']
|
|
||||||
group_wait: 30s
|
|
||||||
group_interval: 5m
|
|
||||||
repeat_interval: 3h
|
|
||||||
receiver: team-X-mails
|
|
||||||
routes:
|
|
||||||
- match_re:
|
|
||||||
service: ^(foo1|foo2|baz)$
|
|
||||||
receiver: team-X-mails
|
|
||||||
routes:
|
|
||||||
- match:
|
|
||||||
severity: critical
|
|
||||||
receiver: team-X-mails
|
|
||||||
receivers:
|
|
||||||
- name: 'team-X-mails'
|
|
||||||
email_configs:
|
|
||||||
- to: 'team-X+alerts@example.org'
|
|
||||||
|
|
||||||
inhibit_rules:
|
|
||||||
- name: opsGenie-receiver
|
|
||||||
opsgenie_configs:
|
|
||||||
- api_key: mysecret
|
|
||||||
- name: slack-receiver
|
|
||||||
slack_configs:
|
|
||||||
- channel: '#my-channel'
|
|
||||||
image_url: 'http://some.img.com/img.png'
|
|
||||||
|
|
||||||
linux:
|
|
||||||
# 'Alternatives system' priority: zero disables (default)
|
|
||||||
# yamllint disable-line rule:braces
|
|
||||||
altpriority: {{ range(1, 9100000) | random }}
|
|
||||||
|
|
||||||
exporters:
|
|
||||||
node_exporter:
|
|
||||||
textfile_collectors:
|
|
||||||
ipmitool:
|
|
||||||
# You must enable individual collectors
|
|
||||||
enable: true
|
|
||||||
# pkg: ipmitool
|
|
||||||
smartmon:
|
|
||||||
enable: true
|
|
||||||
# pkg: smartmontools
|
|
||||||
# bash_pkg: bash
|
|
||||||
# smartctl: /usr/sbin/smartctl
|
|
||||||
|
@ -13,6 +13,9 @@ sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA
|
|||||||
# Install `m2r`
|
# Install `m2r`
|
||||||
sudo -H pip install m2r
|
sudo -H pip install m2r
|
||||||
|
|
||||||
|
# working directory
|
||||||
|
MYPWD=$( pwd )
|
||||||
|
|
||||||
# Copy and then convert the `.md` docs
|
# Copy and then convert the `.md` docs
|
||||||
cp ./*.md docs/
|
cp ./*.md docs/
|
||||||
cd docs/ || exit
|
cd docs/ || exit
|
||||||
@ -27,4 +30,4 @@ sed -i -e '1,4s/-/=/g' CHANGELOG.rst
|
|||||||
# cat CHANGELOG.rst
|
# cat CHANGELOG.rst
|
||||||
|
|
||||||
# Return back to the main directory
|
# Return back to the main directory
|
||||||
cd ..
|
cd "${MYPWD}" || exit
|
||||||
|
@ -1,29 +1,26 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 %}
|
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 and grains.os_family != 'Arch' %}
|
||||||
|
{%- if 'wanted' in p and p.wanted and 'component' in p.wanted and p.wanted.component %}
|
||||||
|
|
||||||
{%- for name in p.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %}
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
prometheus-archive-remove-{{ name }}-home-alternatives-remove:
|
prometheus-server-alternatives-clean-{{ name }}-{{ cmd }}:
|
||||||
alternatives.remove:
|
alternatives.remove:
|
||||||
- name: prometheus-{{ name }}-home
|
- unless: {{ p.pkg.use_upstream_repo }}
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}
|
- name: link-prometheus-{{ name }}-{{ cmd }}
|
||||||
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ name }}-home
|
- path: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
||||||
|
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ name }}-{{ cmd }}
|
||||||
|
|
||||||
{% for b in p.pkg[name]['binaries'] %}
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
prometheus-archive-remove-{{ name }}-alternatives-remove-{{ b }}:
|
{%- endif %}
|
||||||
alternatives.remove:
|
{%- endif %}
|
||||||
- name: prometheus-{{ name }}-{{ b }}
|
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
|
|
||||||
- onlyif: update-alternatives --get-selections |grep ^prometheus-{{ name }}-{{ b }}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif %}
|
|
||||||
|
@ -1,81 +1,58 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
{%- set sls_archive_install = tplroot ~ '.archive' %}
|
|
||||||
|
|
||||||
{%- if grains.kernel|lower in ('linux',) and p.linux.altpriority|int > 0 %}
|
{%- if grains.kernel|lower == 'linux' and p.linux.altpriority|int > 0 and grains.os_family != 'Arch' %}
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_archive_install }}
|
- {{ sls_archive_install }}
|
||||||
|
|
||||||
{%- for name in p.wanted %}
|
{%- if 'wanted' in p and p.wanted and 'component' in p.wanted and p.wanted.component %}
|
||||||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- if grains.os_family == 'Suse' %}
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
|
{%- set dir_symlink = p.dir.symlink ~ '/bin' %}
|
||||||
|
{%- if 'service' in p.pkg.component[name] %}
|
||||||
|
{%- set dir_symlink = p.dir.symlink ~ '/sbin' %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-home-cmd-run:
|
prometheus-server-alternatives-install-{{ name }}-{{ cmd }}:
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: |
|
- name: update-alternatives --install {{ dir_symlink }}/{{ cmd }} link-prometheus-{{ name }}-{{ cmd }} {{ p.pkg.component[name]['path'] }}/{{ cmd }} {{ p.linux.altpriority }} # noqa 204
|
||||||
update-alternatives --install {{ p.dir.basedir }}/{{ name }} \
|
- unless:
|
||||||
prometheus-{{ name }}-home {{ p.dir.basedir }}/{{ bundle }} \
|
- {{ grains.os_family not in ('Suse',) }}
|
||||||
{{ p.linux.altpriority }}
|
- {{ p.pkg.use_upstream_repo }}
|
||||||
- watch:
|
|
||||||
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
|
||||||
|
|
||||||
{%- else %}
|
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install:
|
|
||||||
alternatives.install:
|
|
||||||
- name: prometheus-{{ name }}-home
|
|
||||||
- link: {{ p.dir.basedir }}/{{ name }}
|
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}
|
|
||||||
- priority: {{ p.linux.altpriority }}
|
|
||||||
- order: 10
|
|
||||||
- watch:
|
|
||||||
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-home-alternatives-set:
|
|
||||||
alternatives.set:
|
|
||||||
- name: prometheus-{{ name }}-home
|
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}
|
|
||||||
- require:
|
- require:
|
||||||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
|
- sls: {{ sls_archive_install }}
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{% for b in p.pkg[name]['binaries'] %}
|
|
||||||
{%- if grains.os_family == 'Suse' %}
|
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-cmd-run-{{ b }}-alternative:
|
|
||||||
cmd.run:
|
|
||||||
- name: |
|
|
||||||
update-alternatives --install /usr/local/bin/{{ b }} \
|
|
||||||
prometheus-{{ name }}-{{ b }} {{ p.dir.basedir }}/{{ bundle }}/{{ b }} \
|
|
||||||
{{ p.linux.altpriority }}
|
|
||||||
- require:
|
|
||||||
- cmd: prometheus-archive-alternatives-install-{{ name }}-home-cmd-run
|
|
||||||
|
|
||||||
{%- else %}
|
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}:
|
|
||||||
alternatives.install:
|
alternatives.install:
|
||||||
- name: prometheus-{{ name }}-{{ b }}
|
- name: link-prometheus-{{ name }}-{{ cmd }}
|
||||||
- link: /usr/local/bin/{{ b }}
|
- link: {{ dir_symlink }}/{{ cmd }}
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
|
- path: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
||||||
- priority: {{ p.linux.altpriority }}
|
- priority: {{ p.linux.altpriority }}
|
||||||
- order: 10
|
- order: 10
|
||||||
- require:
|
- require:
|
||||||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-home-alternatives-install
|
- sls: {{ sls_archive_install }}
|
||||||
|
- unless:
|
||||||
|
- {{ grains.os_family in ('Suse',) }}
|
||||||
|
- {{ p.pkg.use_upstream_repo }}
|
||||||
|
|
||||||
prometheus-archive-alternatives-install-{{ name }}-alternatives-set-{{ b }}:
|
prometheus-server-alternatives-set-{{ name }}-{{ cmd }}:
|
||||||
alternatives.set:
|
alternatives.set:
|
||||||
- name: prometheus-{{ name }}-{{ b }}
|
- name: link-prometheus-{{ name }}-{{ cmd }}
|
||||||
- path: {{ p.dir.basedir }}/{{ bundle }}/{{ b }}
|
- path: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
||||||
- require:
|
- require:
|
||||||
- alternatives: prometheus-archive-alternatives-install-{{ name }}-alternatives-install-{{ b }}
|
- alternatives: prometheus-server-alternatives-install-{{ name }}-{{ cmd }}
|
||||||
|
- sls: {{ sls_archive_install }}
|
||||||
|
- unless:
|
||||||
|
- {{ grains.os_family in ('Suse',) }}
|
||||||
|
- {{ p.pkg.use_upstream_repo }}
|
||||||
|
|
||||||
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endfor %}
|
{%- endif %}
|
||||||
{%- endif %}
|
|
||||||
|
{%- endif %}
|
||||||
|
@ -1,35 +1,43 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
{%- set sls_alternatives_clean = tplroot ~ '.archive.alternatives.clean' %}
|
{%- set sls_alternatives_clean = tplroot ~ '.archive.alternatives.clean' %}
|
||||||
{%- set sls_users_clean = tplroot ~ '.config.users.clean' %}
|
|
||||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_users_clean }}
|
|
||||||
- {{ sls_service_clean }}
|
- {{ sls_service_clean }}
|
||||||
- {{ sls_alternatives_clean }}
|
- {{ sls_alternatives_clean }}
|
||||||
|
|
||||||
{%- for name in p.wanted %}
|
prometheus-archive-clean-prerequisites:
|
||||||
|
file.absent:
|
||||||
|
- name: {{ p.dir.var }}
|
||||||
|
|
||||||
prometheus-archive-clean-{{ name }}-file-absent:
|
{%- for name in p.wanted.component %}
|
||||||
|
|
||||||
|
prometheus-archive-clean-{{ name }}:
|
||||||
|
file.absent:
|
||||||
|
- name: {{ p.pkg.component[name]['path'] }}
|
||||||
|
|
||||||
|
{%- if p.linux.altpriority|int <= 0 or grains.os_family|lower in ('macos', 'arch') %}
|
||||||
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
|
prometheus-archive-clean-{{ name }}-file-symlink-{{ cmd }}:
|
||||||
file.absent:
|
file.absent:
|
||||||
- names:
|
- names:
|
||||||
- {{ p.dir.basedir }}/{{ name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) }}
|
- {{ p.dir.symlink }}/bin/{{ cmd }}
|
||||||
|
- {{ p.dir.symlink }}/sbin/{{ cmd }}
|
||||||
prometheus-archive-clean-{{ name }}-user-absent:
|
- {{ p.dir.var }}/{{ name }}
|
||||||
user.absent:
|
- {{ p.dir.service }}/{{ name }}.service
|
||||||
- name: {{ name }}
|
|
||||||
group.absent:
|
|
||||||
- name: {{ name }}
|
|
||||||
- require:
|
- require:
|
||||||
- user: prometheus-archive-clean-{{ name }}-user-absent
|
- sls: {{ sls_alternatives_clean }}
|
||||||
|
- sls: {{ sls_service_clean }}
|
||||||
|
- require_in:
|
||||||
|
- user: prometheus-archive-clean-{{ name }}-user-group
|
||||||
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
prometheus-archive-clean-basedir-file-directory:
|
{%- endif %}
|
||||||
file.absent:
|
{%- endfor %}
|
||||||
- name: {{ p.dir.basedir }}
|
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#.-*- coding: utf-8 -*-
|
#.-*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- if prometheus.use_upstream_archive %}
|
{%- if p.pkg.use_upstream_archive %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .install
|
- .install
|
||||||
|
@ -1,70 +1,99 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %}
|
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
|
||||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
{%- set sls_users_install = tplroot ~ '.config.users' %}
|
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_users_install }}
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
prometheus-config-file-basedir-file-directory:
|
prometheus-archive-install-prerequisites:
|
||||||
|
pkg.installed:
|
||||||
|
- names: {{ p.pkg.deps|json }}
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.dir.basedir }}
|
- name: {{ p.dir.var }}
|
||||||
- user: prometheus
|
- user: prometheus
|
||||||
- group: prometheus
|
- group: prometheus
|
||||||
- mode: 755
|
- mode: 755
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require:
|
- require:
|
||||||
- sls: '{{ sls_users_install }}.*'
|
- sls: {{ sls_config_users }}
|
||||||
|
|
||||||
{%- for name in p.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- if name in p.pkg %}
|
|
||||||
{%- set bundle = name + '-%s.%s-%s'|format(p.pkg[name]['archive_version'], p.kernel, p.arch) %}
|
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}-archive-extracted:
|
prometheus-archive-install-{{ name }}:
|
||||||
archive.extracted:
|
file.directory:
|
||||||
- name: {{ p.dir.basedir }}
|
- name: {{ p.pkg.component[name]['path'] }}
|
||||||
- source: {{ p.archive.uri }}/{{ name }}/releases/download/v{{ p.pkg[name]['archive_version']
|
- user: {{ p.identity.rootuser }}
|
||||||
+ '/' + bundle + '.' + p.archive.suffix }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
- source_hash: {{ p.pkg[name]['archive_hash'] }}
|
- mode: '0755'
|
||||||
- user: {{ name }}
|
- makedirs: True
|
||||||
- group: {{ name }}
|
- require:
|
||||||
{{- format_kwargs(p.archive.kwargs) }}
|
- file: prometheus-archive-install-prerequisites
|
||||||
|
- require_in:
|
||||||
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
- recurse:
|
- recurse:
|
||||||
- user
|
- user
|
||||||
- group
|
- group
|
||||||
|
- mode
|
||||||
|
archive.extracted:
|
||||||
|
{{- format_kwargs(p.pkg.component[name]['archive']) }}
|
||||||
|
- trim_output: true
|
||||||
|
- enforce_toplevel: false
|
||||||
|
- options: --strip-components=1
|
||||||
|
- retry: {{ p.retry_option|json }}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-config-file-basedir-file-directory
|
- file: prometheus-archive-install-{{ name }}
|
||||||
|
|
||||||
{%- if name in p.service %}
|
{%- if p.linux.altpriority|int <= 0 or grains.os_family|lower in ('macos', 'arch') %}
|
||||||
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
|
prometheus-archive-install-{{ name }}-file-symlink-{{ cmd }}:
|
||||||
|
file.symlink:
|
||||||
|
{%- if 'service' in p.pkg.component[name] %}
|
||||||
|
- name: {{ p.dir.symlink }}/sbin/{{ cmd }}
|
||||||
|
{%- else %}
|
||||||
|
- name: {{ p.dir.symlink }}/bin/{{ cmd }}
|
||||||
|
{% endif %}
|
||||||
|
- target: {{ p.pkg.component[name]['path'] }}/{{ cmd }}
|
||||||
|
- force: True
|
||||||
|
- require:
|
||||||
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] is mapping %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}-file-directory:
|
prometheus-archive-install-{{ name }}-file-directory:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.dir.var }}/{{ name }}
|
- name: {{ p.dir.var }}/{{ name }}
|
||||||
- user: {{ name }}
|
- user: {{ name }}
|
||||||
- group: {{ name }}
|
- group: {{ name }}
|
||||||
- mode: 755
|
- mode: '0755'
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require:
|
- require:
|
||||||
- archive: prometheus-archive-install-{{ name }}-archive-extracted
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
- file: prometheus-config-file-basedir-file-directory
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
|
||||||
{%- if grains.os_family not in ('MacOS', 'FreeBSD', 'Windows') %}
|
{%- if grains.kernel|lower == 'linux' and 'config_file' in p.pkg.component[name] %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}-managed-service:
|
prometheus-archive-install-{{ name }}-managed-service:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: {{ p.dir.service }}/{{ name }}.service
|
- name: {{ p.dir.service }}/{{ name }}.service
|
||||||
- source: {{ files_switch(['systemd.ini.jinja'],
|
- source: {{ files_switch(['systemd.ini.jinja'],
|
||||||
lookup='prometheus-archive-install-managed-service'
|
lookup='prometheus-archive-install-' ~ name ~ '-managed-service'
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
- mode: 644
|
- mode: '0644'
|
||||||
- user: root
|
- user: {{ p.identity.rootuser }}
|
||||||
- group: {{ p.rootgroup }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- template: jinja
|
- template: jinja
|
||||||
- context:
|
- context:
|
||||||
@ -73,17 +102,22 @@ prometheus-archive-install-{{ name }}-managed-service:
|
|||||||
user: {{ name }}
|
user: {{ name }}
|
||||||
group: {{ name }}
|
group: {{ name }}
|
||||||
workdir: {{ p.dir.var }}/{{ name }}
|
workdir: {{ p.dir.var }}/{{ name }}
|
||||||
start: {{ p.dir.basedir }}/{{ bundle }}/{{ name }} --config.file {{ p.dir.etc }}/{{ name }}.yml
|
stop: ''
|
||||||
stop: '' #not needed
|
{%- if name in ('node_exporter',) %}
|
||||||
|
start: {{ p.pkg.component[name]['path'] }}/{{ name }}
|
||||||
|
{%- else %}
|
||||||
|
start: {{ p.pkg.component[name]['path'] }}/{{ name }} --config.file {{ p.pkg.component[name]['config_file'] }} # noqa 204
|
||||||
|
{%- endif %}
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-{{ name }}-file-directory
|
- file: prometheus-archive-install-{{ name }}-file-directory
|
||||||
- file: prometheus-config-file-basedir-file-directory
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- name: systemctl daemon-reload
|
- name: systemctl daemon-reload
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-{{ name }}-managed-service
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endfor %}
|
||||||
{%- endfor %}
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
#.-*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .service.clean
|
- .service.clean
|
||||||
- .config.clean
|
- .config.clean
|
||||||
|
- .exporters.clean
|
||||||
|
- .clientlibs.clean
|
||||||
- .archive.clean
|
- .archive.clean
|
||||||
- .package.clean
|
- .package.clean
|
||||||
|
13
prometheus/clientlibs/clean.sls
Normal file
13
prometheus/clientlibs/clean.sls
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.clientlibs %}
|
||||||
|
|
||||||
|
prometheus-clientlibs-clean-{{ name }}:
|
||||||
|
file.absent:
|
||||||
|
- name: {{ p.pkg.clientlibs[name]['path'] }}
|
||||||
|
|
||||||
|
{%- endfor %}
|
38
prometheus/clientlibs/install.sls
Normal file
38
prometheus/clientlibs/install.sls
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.clientlibs %}
|
||||||
|
|
||||||
|
prometheus-clientlibs-install-{{ name }}:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ p.pkg.clientlibs[name]['path'] }}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
- mode: '0755'
|
||||||
|
- makedirs: True
|
||||||
|
- require_in:
|
||||||
|
- archive: prometheus-clientlibs-install-{{ name }}
|
||||||
|
- recurse:
|
||||||
|
- user
|
||||||
|
- group
|
||||||
|
- mode
|
||||||
|
archive.extracted:
|
||||||
|
{{- format_kwargs(p.pkg.clientlibs[name]['archive']) }}
|
||||||
|
- trim_output: true
|
||||||
|
- enforce_toplevel: false
|
||||||
|
- options: --strip-components=1
|
||||||
|
- retry: {{ p.retry_option|json }}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
|
||||||
|
{%- endfor %}
|
@ -1,71 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_service_clean }}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
{%- if name in prometheus.service %}
|
|
||||||
{%- set args = {} %}
|
|
||||||
{%- if 'args' in prometheus.service[name] %}
|
|
||||||
{%- set args = prometheus.service[name]['args'] or {} %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if args and 'storage.tsdb.path' in args.keys() %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-data-dir:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ args['storage.tsdb.path'] }}
|
|
||||||
- require:
|
|
||||||
- sls: '{{ sls_service_clean }}.*'
|
|
||||||
|
|
||||||
{%- if grains.os_family == 'FreeBSD' %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-{{ key }}:
|
|
||||||
sysrc.absent:
|
|
||||||
- name: {{ name }}_data_dir
|
|
||||||
- require:
|
|
||||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if args and grains.os_family == 'FreeBSD' %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-all:
|
|
||||||
sysrc.absent:
|
|
||||||
- names:
|
|
||||||
- {{ name }}_args
|
|
||||||
- {{ name }}_listen_address
|
|
||||||
- {{ name }}_textfile_dir
|
|
||||||
- require:
|
|
||||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
|
||||||
|
|
||||||
{%- elif grains.os_family != 'FreeBSD' %}
|
|
||||||
|
|
||||||
{%- set args_file = prometheus.pkg.get(name, {}).get('args_file', False) %}
|
|
||||||
{%- if not args_file %}
|
|
||||||
{%- set args_file = prometheus.dir.args | path_join(name) %}
|
|
||||||
{%- if not grains.os_family in ['Debian'] %}
|
|
||||||
{%- set args_file = "{}.sh".format(args_file) %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-file-absent:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ args_file }}
|
|
||||||
- require:
|
|
||||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
|
||||||
- require_in:
|
|
||||||
- file: prometheus-config-file-args-file-absent
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
|
||||||
|
|
||||||
prometheus-config-file-args-file-absent:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.dir.args }}
|
|
@ -1,122 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import concat_args %}
|
|
||||||
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
|
||||||
{%- set sls_archive_install = tplroot ~ '.archive' %}
|
|
||||||
{%- set sls_package_install = tplroot ~ '.package' %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_archive_install if prometheus.use_upstream_archive else sls_package_install }}
|
|
||||||
- {{ sls_config_users }}
|
|
||||||
|
|
||||||
{%- if prometheus.dir.args %}
|
|
||||||
prometheus-config-file-args-file-directory:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ prometheus.dir.args }}
|
|
||||||
- user: prometheus
|
|
||||||
- group: prometheus
|
|
||||||
- mode: 755
|
|
||||||
- makedirs: True
|
|
||||||
- require:
|
|
||||||
- sls: '{{ sls_archive_install if prometheus.use_upstream_archive else sls_package_install }}.*'
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
{%- if name in prometheus.config or name in prometheus.service %}
|
|
||||||
{%- set args = {} %}
|
|
||||||
{%- if 'args' in prometheus.service[name] %}
|
|
||||||
{%- set args = prometheus.service[name]['args'] or {} %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- if args and 'storage.tsdb.path' in args.keys() %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-data-dir:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ args['storage.tsdb.path'] }}
|
|
||||||
- owner: {{ name }}
|
|
||||||
- group: {{ name }}
|
|
||||||
- makedirs: True
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
{%- if prometheus.dir.args %}
|
|
||||||
- require:
|
|
||||||
- file: prometheus-config-file-args-file-directory
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- if args and grains.os_family == 'FreeBSD' %}
|
|
||||||
{%- if 'collector.textfile.directory' in args.keys() %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-collector-textfile-directory:
|
|
||||||
sysrc.managed:
|
|
||||||
- name: {{ name }}_textfile_dir
|
|
||||||
- value: {{ args.pop('collector.textfile.directory') }}
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- if 'storage.tsdb.path' in args.keys() %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-storage-tsdb-path:
|
|
||||||
sysrc.managed:
|
|
||||||
- name: {{ name }}_data_dir
|
|
||||||
- value: {{ args.pop('storage.tsdb.path') }}
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- if name in ['node_exporter'] and 'web.listen-address' in args.keys() %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-web-listen-address:
|
|
||||||
sysrc.managed:
|
|
||||||
- name: {{ name }}_listen_address
|
|
||||||
- value: {{ args.pop('web.listen-address') }}
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-config-file:
|
|
||||||
sysrc.managed:
|
|
||||||
- name: {{ name }}_config
|
|
||||||
- value: {{ prometheus.dir.etc }}/{{ name }}.yml
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-all:
|
|
||||||
sysrc.managed:
|
|
||||||
- name: {{ name }}_args
|
|
||||||
# service prometheus restart tended to hang on FreeBSD
|
|
||||||
# https://github.com/saltstack/salt/issues/44848#issuecomment-487016414
|
|
||||||
- value: "{{ concat_args(args) }} >/dev/null 2>&1"
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
|
|
||||||
{%- elif grains.os_family != 'FreeBSD' %}
|
|
||||||
|
|
||||||
{%- set args_file = prometheus.pkg.get(name, {}).get('args_file', False) %}
|
|
||||||
{%- if not args_file %}
|
|
||||||
{%- set args_file = prometheus.dir.args | path_join(name) %}
|
|
||||||
{%- if not grains.os_family in ['Debian'] %}
|
|
||||||
{%- set args_file = "{}.sh".format(args_file) %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
prometheus-config-args-{{ name }}-file-managed:
|
|
||||||
file.managed:
|
|
||||||
- name: {{ args_file }}
|
|
||||||
- contents: |
|
|
||||||
{{ prometheus.dir.args_setting }}="{{ concat_args(args) }}"
|
|
||||||
- watch_in:
|
|
||||||
- service: prometheus-service-running-{{ name }}-service-running
|
|
||||||
{%- if prometheus.dir.args %}
|
|
||||||
- require:
|
|
||||||
- file: prometheus-config-file-args-file-directory
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
|
@ -1,8 +1,31 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .file.clean
|
- {{ sls_service_clean }}
|
||||||
- .args.clean
|
|
||||||
- .users.clean
|
{%- for name in p.wanted.component %}
|
||||||
- .node_exporter.textfile_collectors.clean
|
|
||||||
|
prometheus-config-clean-{{ name }}:
|
||||||
|
- names:
|
||||||
|
- {{ p.dir.etc }}/{{ name }}.yml
|
||||||
|
- {{ p.pkg.component[name]['environ_file'] }}
|
||||||
|
{%- if grains.os_family|lower in ('freebsd',) %}
|
||||||
|
sysrc.absent:
|
||||||
|
- name: {{ name }}_environ
|
||||||
|
{%- endif %}
|
||||||
|
user.absent:
|
||||||
|
- name: {{ name }}
|
||||||
|
{%- if grains.os_family == 'MacOS' %}
|
||||||
|
- onlyif: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
||||||
|
{%- endif %}
|
||||||
|
group.absent:
|
||||||
|
- name: {{ name }}
|
||||||
|
- require:
|
||||||
|
- {{ sls_config_clean }}
|
||||||
|
|
||||||
|
{%- endfor %}
|
||||||
|
51
prometheus/config/environ.sls
Normal file
51
prometheus/config/environ.sls
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
{%- from tplroot ~ "/files/macros.jinja" import concat_environ %}
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.component %}
|
||||||
|
{%- if 'environ' in p.pkg.component[name] and p.pkg.component[name]['environ'] %}
|
||||||
|
{%- if 'environ_file' in p.pkg.component[name] and p.pkg.component[name]['environ_file'] %}
|
||||||
|
|
||||||
|
prometheus-config-install-{{ name }}-environ_file:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ p.pkg.component[name]['environ_file'] }}
|
||||||
|
- source: {{ files_switch(['environ.sh.jinja'],
|
||||||
|
lookup='prometheus-config-install-' ~ name ~ '-environ_file'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
- mode: 640
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
- makedirs: True
|
||||||
|
- template: jinja
|
||||||
|
- contents: |
|
||||||
|
command_args="{{ concat_environ(environ) }}"
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
|
{%- if grains.os_family == 'FreeBSD' %}
|
||||||
|
|
||||||
|
prometheus-config-environ-{{ name }}-all:
|
||||||
|
sysrc.managed:
|
||||||
|
- name: {{ name }}_environ
|
||||||
|
# service prometheus restart tends to hang on FreeBSD
|
||||||
|
# https://github.com/saltstack/salt/issues/44848#issuecomment-487016414
|
||||||
|
- value: "{{ concat_environ(p.pkg.component[name]['environ']) }} >/dev/null 2>&1"
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
51
prometheus/config/file.sls
Normal file
51
prometheus/config/file.sls
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||||
|
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
|
prometheus-config-file-etc-file-directory:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ p.dir.etc }}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
- mode: '0755'
|
||||||
|
- makedirs: True
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.component %}
|
||||||
|
{%- if 'config' in p.pkg.component[name] and p.pkg.component[name]['config'] %}
|
||||||
|
|
||||||
|
prometheus-config-file-{{ name }}-file-managed:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ p.dir.etc }}/{{ name }}.yml
|
||||||
|
- source: {{ files_switch(['config.yml.jinja'],
|
||||||
|
lookup='prometheus-config-file-' ~ name ~ '-file-managed'
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
- mode: 644
|
||||||
|
- user: {{ name }}
|
||||||
|
- group: {{ name }}
|
||||||
|
- makedirs: True
|
||||||
|
- template: jinja
|
||||||
|
- context:
|
||||||
|
config: {{ p.pkg.component[name]['config']|json }}
|
||||||
|
- require:
|
||||||
|
- file: prometheus-config-file-etc-file-directory
|
||||||
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_service_clean }}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
|
|
||||||
prometheus-config-file-{{ name }}-file-absent:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.dir.etc }}/{{ name }}.yml
|
|
||||||
- require_in:
|
|
||||||
- file: prometheus-config-file-etc-file-absent
|
|
||||||
|
|
||||||
{%- endfor %}
|
|
||||||
|
|
||||||
prometheus-config-file-etc-file-absent:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.dir.etc }}
|
|
||||||
- require:
|
|
||||||
- sls: {{ sls_service_clean }}
|
|
@ -1,5 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
include:
|
|
||||||
- .install
|
|
@ -1,48 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
|
||||||
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
|
||||||
{%- set sls_archive_install = tplroot ~ '.archive' %}
|
|
||||||
{%- set sls_package_install = tplroot ~ '.package' %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
- {{ sls_archive_install if prometheus.use_upstream_archive else sls_package_install }}
|
|
||||||
- {{ sls_config_users }}
|
|
||||||
|
|
||||||
prometheus-config-file-etc-file-directory:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ prometheus.dir.etc }}
|
|
||||||
- user: root
|
|
||||||
- group: {{ prometheus.rootgroup }}
|
|
||||||
- mode: 755
|
|
||||||
- makedirs: True
|
|
||||||
- require:
|
|
||||||
- sls: '{{ sls_archive_install if prometheus.use_upstream_archive else sls_package_install }}.*'
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
{%- if name in prometheus.config or name in prometheus.service %}
|
|
||||||
|
|
||||||
prometheus-config-file-{{ name }}-file-managed:
|
|
||||||
file.managed:
|
|
||||||
- name: {{ prometheus.dir.etc }}/{{ name }}.yml
|
|
||||||
- source: {{ files_switch(['config.yml.jinja'],
|
|
||||||
lookup='prometheus-config-file-file-managed'
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
- mode: 644
|
|
||||||
- user: {{ name }}
|
|
||||||
- group: {{ name }}
|
|
||||||
- makedirs: True
|
|
||||||
- template: jinja
|
|
||||||
- context:
|
|
||||||
config: {{ '' if name not in prometheus.config else prometheus.config[name]|json }}
|
|
||||||
- require:
|
|
||||||
- user: prometheus-config-user-install-{{ name }}-user-present
|
|
||||||
- file: prometheus-config-file-etc-file-directory
|
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
|
@ -1,14 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .users
|
|
||||||
- .args
|
|
||||||
- .file
|
- .file
|
||||||
{%- if 'node_exporter' in prometheus.wanted %}
|
- .environ
|
||||||
- .node_exporter.textfile_collectors
|
|
||||||
{%- endif %}
|
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
prometheus-node_exporter-textfile_collectors-dir:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.dir.textfile_collectors }}
|
|
||||||
|
|
||||||
prometheus-node_exporter-textfile-dir:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.service.node_exporter.args.get('collector.textfile.directory') }}
|
|
||||||
|
|
||||||
{%- for collector, config in prometheus.get('exporters', {}).get('node_exporter', {}).get('textfile_collectors', {}).items() %}
|
|
||||||
include:
|
|
||||||
- .{{ collector }}.clean
|
|
||||||
{%- endfor %}
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
prometheus-node_exporter-textfile_collectors-dir:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ prometheus.dir.textfile_collectors }}
|
|
||||||
- mode: 755
|
|
||||||
- user: node_exporter
|
|
||||||
- group: node_exporter
|
|
||||||
- makedirs: True
|
|
||||||
|
|
||||||
prometheus-node_exporter-textfile-dir:
|
|
||||||
file.directory:
|
|
||||||
- name: {{ prometheus.service.node_exporter.args.get('collector.textfile.directory') }}
|
|
||||||
- mode: 755
|
|
||||||
- user: node_exporter
|
|
||||||
- group: node_exporter
|
|
||||||
- makedirs: True
|
|
||||||
|
|
||||||
{%- set states = [] %}
|
|
||||||
{%- for collector, config in prometheus.get('exporters', {}).get('node_exporter', {}).get('textfile_collectors', {}).items() %}
|
|
||||||
{%- if config.get('enable', False) %}
|
|
||||||
{%- if config.get('remove', False) %}
|
|
||||||
{%- set state = ".{}.clean".format(collector) %}
|
|
||||||
{%- else %}
|
|
||||||
{%- set state = ".{}".format(collector) %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- do states.append(state) %}
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{%- if states|length > 0 %}
|
|
||||||
prometheus-node_exporter-textfile-dependencies:
|
|
||||||
pkg.installed:
|
|
||||||
- pkgs: {{ prometheus.exporters.node_exporter.textfile_collectors_dependencies }}
|
|
||||||
- require_in:
|
|
||||||
{%- for state in states %}
|
|
||||||
- sls: prometheus.config.node_exporter.textfile_collectors{{ state }}
|
|
||||||
{%- endfor %}
|
|
||||||
|
|
||||||
include:
|
|
||||||
{%- for state in states %}
|
|
||||||
- {{ state }}
|
|
||||||
{% endfor %}
|
|
||||||
{%- endif %}
|
|
@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
{%- set config = prometheus.exporters.node_exporter.textfile_collectors.ipmitool %}
|
|
||||||
{%- set dir = prometheus.service.node_exporter.args.get('collector.textfile.directory') %}
|
|
||||||
{%- set script = prometheus.dir.textfile_collectors ~ '/ipmitool' %}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-pkg:
|
|
||||||
pkg.removed:
|
|
||||||
- name: {{ config.pkg }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-script:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ script }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-output:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ dir }}/ipmitool.prom
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-cronjob:
|
|
||||||
cron.absent:
|
|
||||||
- identifier: prometheus-exporters-node-textfile_collectors-ipmitool-cronjob
|
|
@ -1,32 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
{%- set config = prometheus.exporters.node_exporter.textfile_collectors.ipmitool %}
|
|
||||||
{%- set dir = prometheus.service.node_exporter.args.get('collector.textfile.directory') %}
|
|
||||||
{%- set script = prometheus.dir.textfile_collectors ~ '/ipmitool' %}
|
|
||||||
{%- set cmd_prefix = 'awk -f ' if grains.os_family in ['FreeBSD'] else '' %}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-pkg:
|
|
||||||
pkg.installed:
|
|
||||||
- name: {{ config.pkg }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-script:
|
|
||||||
file.managed:
|
|
||||||
- name: {{ script }}
|
|
||||||
- source: salt://prometheus/config/node_exporter/textfile_collectors/files/ipmitool
|
|
||||||
- mode: 755
|
|
||||||
- require:
|
|
||||||
- file: prometheus-node_exporter-textfile_collectors-dir
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-ipmitool-cronjob:
|
|
||||||
cron.present:
|
|
||||||
- identifier: prometheus-exporters-node-textfile_collectors-ipmitool-cronjob
|
|
||||||
- name: cd {{ dir }} && LANG=C ipmitool sensor | {{ cmd_prefix }}{{ script }} > .ipmitool.prom$$; mv .ipmitool.prom$$ ipmitool.prom
|
|
||||||
- minute: "{{ config.get('minute', '*') }}"
|
|
||||||
- comment: Prometheus' node_exporter's ipmitool textfile collector
|
|
||||||
- require:
|
|
||||||
- file: prometheus-exporters-node-textfile_collectors-ipmitool-script
|
|
@ -1,26 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
{%- set config = prometheus.exporters.node_exporter.textfile_collectors.smartmon %}
|
|
||||||
{%- set dir = prometheus.service.node_exporter.args.get('collector.textfile.directory') %}
|
|
||||||
{%- set script = prometheus.dir.textfile_collectors ~ '/smartmon.sh' %}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-pkg:
|
|
||||||
pkg.removed:
|
|
||||||
- name: {{ config.pkg }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-script:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ script }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-output:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ dir }}/smartmon.prom
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-cronjob:
|
|
||||||
cron.absent:
|
|
||||||
- identifier: prometheus-exporters-node-textfile_collectors-smartmon-cronjob
|
|
@ -1,38 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
{%- set config = prometheus.exporters.node_exporter.textfile_collectors.smartmon %}
|
|
||||||
{%- set dir = prometheus.service.node_exporter.args.get('collector.textfile.directory') %}
|
|
||||||
{%- set script = prometheus.dir.textfile_collectors ~ '/smartmon.sh' %}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-pkg:
|
|
||||||
pkg.installed:
|
|
||||||
- name: {{ config.pkg }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-pkg-bash:
|
|
||||||
pkg.installed:
|
|
||||||
- name: {{ config.bash_pkg }}
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-script:
|
|
||||||
file.managed:
|
|
||||||
- name: {{ script }}
|
|
||||||
- source: salt://prometheus/config/node_exporter/textfile_collectors/files/smartmon.sh.jinja
|
|
||||||
- template: jinja
|
|
||||||
- context:
|
|
||||||
smartctl: {{ config.smartctl }}
|
|
||||||
- mode: 755
|
|
||||||
- require:
|
|
||||||
- file: prometheus-node_exporter-textfile_collectors-dir
|
|
||||||
|
|
||||||
prometheus-exporters-node-textfile_collectors-smartmon-cronjob:
|
|
||||||
cron.present:
|
|
||||||
- identifier: prometheus-exporters-node-textfile_collectors-smartmon-cronjob
|
|
||||||
- name: cd {{ dir }} && LANG=C {{ script }} > .smartmon.prom$$ && mv .smartmon.prom$$ smartmon.prom
|
|
||||||
- minute: "{{ config.get('minute', '*') }}"
|
|
||||||
- comment: Prometheus' node_exporter's smartmon textfile collector
|
|
||||||
- require:
|
|
||||||
- file: prometheus-exporters-node-textfile_collectors-smartmon-script
|
|
@ -1,11 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
|
|
||||||
prometheus-config-user-install-{{ name }}-user-present:
|
prometheus-config-user-install-{{ name }}-user-present:
|
||||||
group.present:
|
group.present:
|
||||||
@ -18,8 +17,8 @@ prometheus-config-user-install-{{ name }}-user-present:
|
|||||||
- createhome: false
|
- createhome: false
|
||||||
- groups:
|
- groups:
|
||||||
- {{ name }}
|
- {{ name }}
|
||||||
{%- if grains.os_family == 'MacOS' %}
|
{%- if grains.os_family == 'MacOS' %}
|
||||||
- unless: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
- unless: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
@ -1,21 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=sls
|
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
|
|
||||||
prometheus-config-user-clean-{{ name }}-user-absent:
|
|
||||||
user.absent:
|
|
||||||
- name: {{ name }}
|
|
||||||
{%- if grains.os_family == 'MacOS' %}
|
|
||||||
- onlyif: /usr/bin/dscl . list /Users | grep {{ name }} >/dev/null 2>&1
|
|
||||||
{%- endif %}
|
|
||||||
group.absent:
|
|
||||||
- name: {{ name }}
|
|
||||||
- require:
|
|
||||||
- user: prometheus-config-user-clean-{{ name }}-user-absent
|
|
||||||
|
|
||||||
{%- endfor %}
|
|
@ -2,135 +2,286 @@
|
|||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
prometheus:
|
prometheus:
|
||||||
rootgroup: root
|
|
||||||
# yamllint disable rule:braces
|
|
||||||
kernel: {{ grains.kernel | lower }}
|
|
||||||
arch: {{ grains.osarch }}
|
|
||||||
# yamllint enable rule:braces
|
|
||||||
use_upstream_repo: false
|
|
||||||
use_upstream_archive: false
|
|
||||||
|
|
||||||
wanted:
|
wanted:
|
||||||
- prometheus
|
clientlibs:
|
||||||
- alertmanager
|
- golang
|
||||||
- node_exporter
|
component:
|
||||||
|
- prometheus
|
||||||
|
- alertmanager
|
||||||
|
- node_exporter
|
||||||
|
# memcached_exporter # only available as archive
|
||||||
|
firewall: false # disabled for travis ci
|
||||||
dir:
|
dir:
|
||||||
basedir: /opt/prometheus
|
default: /etc/default
|
||||||
|
archive: /opt/prometheus
|
||||||
etc: /etc/prometheus
|
etc: /etc/prometheus
|
||||||
var: /var/lib/prometheus
|
|
||||||
args: /etc/default
|
|
||||||
args_setting: ARGS
|
|
||||||
service: /usr/lib/systemd/system
|
service: /usr/lib/systemd/system
|
||||||
textfile_collectors: /opt/prometheus/textfile_collectors
|
symlink: /usr/local
|
||||||
|
tmp: /tmp/prometheus
|
||||||
service:
|
var: /var/lib/prometheus
|
||||||
prometheus:
|
|
||||||
args:
|
|
||||||
web.listen-address: 0.0.0.0:9090
|
|
||||||
alertmanager: {}
|
|
||||||
node_exporter:
|
|
||||||
args:
|
|
||||||
collector.textfile.directory: /var/tmp/node_exporter
|
|
||||||
|
|
||||||
config:
|
|
||||||
prometheus: {}
|
|
||||||
alertmanager: {}
|
|
||||||
node_exporter: {}
|
|
||||||
|
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
|
||||||
archive_version: '2.10.0'
|
|
||||||
archive_hash: f4233783826f18606b79e5cef0686e4a9c2030146a3c7ce134f0add09f5adcb7
|
|
||||||
binaries:
|
|
||||||
- prometheus
|
|
||||||
- promtool
|
|
||||||
repo:
|
|
||||||
humanname: prometheus
|
|
||||||
name: prometheus
|
|
||||||
comments:
|
|
||||||
- installed by salt
|
|
||||||
enabled: 1
|
|
||||||
gpgcheck: 1
|
|
||||||
alertmanager:
|
|
||||||
archive_version: '0.17.0'
|
|
||||||
archive_hash: 7c8d2cfeb021c80881ae9904d959131091b8785b6fda9800f84ddef148fe0a4f
|
|
||||||
binaries:
|
|
||||||
- amtool
|
|
||||||
- alertmanager
|
|
||||||
blackbox_exporter:
|
|
||||||
archive_version: '0.14.0'
|
|
||||||
archive_hash: a2918a059023045cafb911272c88a9eb83cdac9a8a5e8e74844b5d6d27f19117
|
|
||||||
binaries:
|
|
||||||
- blackbox_exporter
|
|
||||||
consul_exporter:
|
|
||||||
archive_version: '0.4.0'
|
|
||||||
archive_hash: ff77c03de67cf381f67480b5be6699901785a34145c518c3484ae3e5b8440d08
|
|
||||||
binaries:
|
|
||||||
- consul_exporter
|
|
||||||
graphite_exporter:
|
|
||||||
archive_version: '0.6.2'
|
|
||||||
archive_hash: 9b962bd06406ece4a865ad6947a6e652e48a92a0d77e496a0351c04e9c2c5e9e
|
|
||||||
binaries:
|
|
||||||
- graphite_exporter
|
|
||||||
haproxy_exporter:
|
|
||||||
archive_version: '0.10.0'
|
|
||||||
archive_hash: 08150728e281f813a8fcfff4b336f16dbfe4268a1c7510212c8cff2579b10468
|
|
||||||
binaries:
|
|
||||||
- haproxy_exporter
|
|
||||||
memcached_exporter:
|
|
||||||
archive_version: '0.5.0'
|
|
||||||
archive_hash: bb07f496ceb63dad9793ad4295205547a4bd20b90628476d64fa96c9a25a020f
|
|
||||||
binaries:
|
|
||||||
- memcached_exporter
|
|
||||||
mysqld_exporter:
|
|
||||||
archive_version: '0.11.0'
|
|
||||||
archive_hash: b53ad48ff14aa891eb6a959730ffc626db98160d140d9a66377394714c563acf
|
|
||||||
binaries:
|
|
||||||
- mysqld_exporter
|
|
||||||
node_exporter:
|
|
||||||
archive_version: '0.18.1'
|
|
||||||
archive_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
|
||||||
binaries:
|
|
||||||
- node_exporter
|
|
||||||
pushgateway:
|
|
||||||
archive_version: '0.8.0'
|
|
||||||
archive_hash: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
|
||||||
binaries:
|
|
||||||
- pushgateway
|
|
||||||
statsd_exporter:
|
|
||||||
archive_version: '0.11.2'
|
|
||||||
archive_hash: 4632ad0c5552e271e84c376da3ffe3af8c265ec5c3035334b70e35756aca1906
|
|
||||||
binaries:
|
|
||||||
- statsd_exporter
|
|
||||||
|
|
||||||
archive:
|
|
||||||
uri: https://github.com/prometheus
|
uri: https://github.com/prometheus
|
||||||
suffix: tar.gz
|
use_upstream_repo: false
|
||||||
kwargs:
|
use_upstream_package: true
|
||||||
trim_output: true
|
use_upstream_archive: false
|
||||||
enforce_toplevel: true
|
deps:
|
||||||
archive_format: tar
|
- gzip
|
||||||
retry:
|
- tar
|
||||||
attempts: 3
|
repo:
|
||||||
until: true
|
humanname: prometheus
|
||||||
interval: 60
|
name: prometheus
|
||||||
splay: 10
|
comments:
|
||||||
|
- installed by salt
|
||||||
|
enabled: 1
|
||||||
|
gpgcheck: 1
|
||||||
|
|
||||||
|
component:
|
||||||
|
alertmanager:
|
||||||
|
version: v0.17.0
|
||||||
|
config_file: /etc/prometheus/alertmanager.yml
|
||||||
|
config: {}
|
||||||
|
environ_file: /etc/default/prometheus-alertmanager.sh
|
||||||
|
environ: {}
|
||||||
|
service:
|
||||||
|
name: alertmanager
|
||||||
|
args:
|
||||||
|
config.file: /etc/prometheus/alertmanager.yml
|
||||||
|
storage.path: /var/lib/alertmanager
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9093
|
||||||
|
# tcp/9094
|
||||||
|
archive:
|
||||||
|
source_hash: 7c8d2cfeb021c80881ae9904d959131091b8785b6fda9800f84ddef148fe0a4f
|
||||||
|
commands:
|
||||||
|
- amtool
|
||||||
|
- alertmanager
|
||||||
|
blackbox_exporter:
|
||||||
|
version: v0.14.0
|
||||||
|
config_file: /etc/prometheus/blackbox_exporter.yml
|
||||||
|
config: {}
|
||||||
|
archive:
|
||||||
|
source_hash: a2918a059023045cafb911272c88a9eb83cdac9a8a5e8e74844b5d6d27f19117
|
||||||
|
commands:
|
||||||
|
- blackbox_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9110
|
||||||
|
consul_exporter:
|
||||||
|
version: v0.4.0
|
||||||
|
archive:
|
||||||
|
source_hash: ff77c03de67cf381f67480b5be6699901785a34145c518c3484ae3e5b8440d08
|
||||||
|
commands:
|
||||||
|
- consul_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9107
|
||||||
|
graphite_exporter:
|
||||||
|
version: v0.6.2
|
||||||
|
archive:
|
||||||
|
source_hash: 9b962bd06406ece4a865ad6947a6e652e48a92a0d77e496a0351c04e9c2c5e9e
|
||||||
|
commands:
|
||||||
|
- graphite_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9108
|
||||||
|
haproxy_exporter:
|
||||||
|
version: v0.10.0
|
||||||
|
archive:
|
||||||
|
source_hash: 08150728e281f813a8fcfff4b336f16dbfe4268a1c7510212c8cff2579b10468
|
||||||
|
commands:
|
||||||
|
- haproxy_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9101
|
||||||
|
memcached_exporter:
|
||||||
|
version: v0.5.0
|
||||||
|
archive:
|
||||||
|
source_hash: bb07f496ceb63dad9793ad4295205547a4bd20b90628476d64fa96c9a25a020f
|
||||||
|
commands:
|
||||||
|
- memcached_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9150
|
||||||
|
mysqld_exporter:
|
||||||
|
version: v0.11.0
|
||||||
|
archive:
|
||||||
|
source_hash: b53ad48ff14aa891eb6a959730ffc626db98160d140d9a66377394714c563acf
|
||||||
|
commands:
|
||||||
|
- mysqld_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9207
|
||||||
|
node_exporter:
|
||||||
|
version: v0.18.1
|
||||||
|
environ_file: /etc/default/prometheus-node-exporter.sh
|
||||||
|
environ: {}
|
||||||
|
config_file: /etc/prometheus/node_exporter.yml
|
||||||
|
config: {}
|
||||||
|
service:
|
||||||
|
name: prometheus-node-exporter
|
||||||
|
args:
|
||||||
|
collector.textfile.directory: /var/tmp/node_exporter
|
||||||
|
archive:
|
||||||
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
commands:
|
||||||
|
- node_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9100
|
||||||
|
prometheus:
|
||||||
|
name: prometheus
|
||||||
|
version: v2.10.0
|
||||||
|
config_file: /etc/prometheus/prometheus.yml
|
||||||
|
config: {}
|
||||||
|
environ_file: /etc/default/prometheus.sh
|
||||||
|
environ: {}
|
||||||
|
service:
|
||||||
|
name: prometheus
|
||||||
|
args:
|
||||||
|
config.file: /etc/prometheus/prometheus.yml
|
||||||
|
storage.tsdb.path: /var/lib/prometheus/data
|
||||||
|
commands:
|
||||||
|
- prometheus
|
||||||
|
- promtool
|
||||||
|
archive:
|
||||||
|
source_hash: f4233783826f18606b79e5cef0686e4a9c2030146a3c7ce134f0add09f5adcb7
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9090
|
||||||
|
pushgateway:
|
||||||
|
version: v0.8.0
|
||||||
|
environ_file: /etc/default/prometheus-pushgateway.sh
|
||||||
|
environ: {}
|
||||||
|
config_file: /etc/prometheus/pushgateway.yml
|
||||||
|
config: {}
|
||||||
|
service: {}
|
||||||
|
archive:
|
||||||
|
source_hash: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
||||||
|
commands:
|
||||||
|
- pushgateway
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9091
|
||||||
|
statsd_exporter:
|
||||||
|
version: v0.11.2
|
||||||
|
archive:
|
||||||
|
source_hash: 4632ad0c5552e271e84c376da3ffe3af8c265ec5c3035334b70e35756aca1906
|
||||||
|
commands:
|
||||||
|
- statsd_exporter
|
||||||
|
firewall:
|
||||||
|
ports:
|
||||||
|
- tcp/9102
|
||||||
|
|
||||||
|
clientlibs:
|
||||||
|
# https://prometheus.io/docs/instrumenting/clientlibs
|
||||||
|
# no bash & perl client tarballs are available
|
||||||
|
golang:
|
||||||
|
version: v1.6.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/prometheus/client_golang/archive
|
||||||
|
skip_verify: true
|
||||||
|
java:
|
||||||
|
version: vparent-0.9.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/prometheus/client_java/archive
|
||||||
|
skip_verify: true
|
||||||
|
python:
|
||||||
|
version: v0.7.1
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/prometheus/client_python/archive
|
||||||
|
skip_verify: true
|
||||||
|
ruby:
|
||||||
|
version: v2.0.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/prometheus/client_ruby/archive
|
||||||
|
skip_verify: true
|
||||||
|
c:
|
||||||
|
version: v0.1.1
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/digitalocean/prometheus-client-c/archive
|
||||||
|
skip_verify: true
|
||||||
|
cpp:
|
||||||
|
version: v0.9.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/jupp0r/prometheus-cpp/archive
|
||||||
|
skip_verify: true
|
||||||
|
clisp:
|
||||||
|
version: v0.4.1
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/deadtrickster/prometheus.cl/archive
|
||||||
|
skip_verify: true
|
||||||
|
dart:
|
||||||
|
version: v0.4.0+4
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/tentaclelabs/prometheus_client/archive
|
||||||
|
skip_verify: true
|
||||||
|
elixir:
|
||||||
|
version: v2.0.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/deadtrickster/prometheus.ex/archive
|
||||||
|
skip_verify: true
|
||||||
|
erlang:
|
||||||
|
version: v4.4.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/deadtrickster/prometheus.erl/archive
|
||||||
|
skip_verify: true
|
||||||
|
haskell:
|
||||||
|
version: prometheus-proc-0.1.2.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/fimad/prometheus-haskell/archive
|
||||||
|
skip_verify: true
|
||||||
|
nginx-lua:
|
||||||
|
version: v0.20200420
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/knyar/nginx-lua-prometheus/archive
|
||||||
|
skip_verify: true
|
||||||
|
tarantool-lua:
|
||||||
|
version: v1.0.4
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/tarantool/prometheus/archive
|
||||||
|
skip_verify: true
|
||||||
|
net:
|
||||||
|
version: v3.5.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/prometheus-net/prometheus-net/archive
|
||||||
|
skip_verify: true
|
||||||
|
node:
|
||||||
|
version: v12.0.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/siimon/prom-client/archive
|
||||||
|
skip_verify: true
|
||||||
|
php:
|
||||||
|
version: v1.0.2
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/endclothing/prometheus_client_php/archive
|
||||||
|
skip_verify: true
|
||||||
|
r:
|
||||||
|
version: v1.0.1
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/cfmack/pRometheus/archive
|
||||||
|
skip_verify: true
|
||||||
|
rust:
|
||||||
|
version: v0.8.0
|
||||||
|
archive:
|
||||||
|
uri: https://github.com/tikv/rust-prometheus/archive
|
||||||
|
skip_verify: true
|
||||||
|
|
||||||
|
# Just here for testing
|
||||||
|
added_in_defaults: defaults_value
|
||||||
|
winner: defaults
|
||||||
|
|
||||||
|
identity:
|
||||||
|
rootuser: root
|
||||||
|
rootgroup: root
|
||||||
|
|
||||||
|
retry_option:
|
||||||
|
# https://docs.saltstack.com/en/latest/ref/states/requisites.html#retrying-states
|
||||||
|
attempts: 3
|
||||||
|
until: true
|
||||||
|
interval: 60
|
||||||
|
splay: 10
|
||||||
linux:
|
linux:
|
||||||
altpriority: 0 ## 'Alternatives system' priority: zero disables (default)
|
altpriority: 0
|
||||||
|
kernel: linux
|
||||||
exporters:
|
|
||||||
node_exporter:
|
|
||||||
textfile_collectors_dependencies: []
|
|
||||||
textfile_collectors:
|
|
||||||
ipmitool:
|
|
||||||
enable: false
|
|
||||||
remove: false
|
|
||||||
pkg: ipmitool
|
|
||||||
smartmon:
|
|
||||||
enable: false
|
|
||||||
remove: false
|
|
||||||
pkg: smartmontools
|
|
||||||
bash_pkg: bash
|
|
||||||
smartctl: /usr/sbin/smartctl
|
|
||||||
|
12
prometheus/exporters/clean.sls
Normal file
12
prometheus/exporters/clean.sls
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- if 'exporters' in p and p.exporters and 'node_exporter' in p.exporters %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- .node_exporter.clean
|
||||||
|
|
||||||
|
{%- endif %}
|
12
prometheus/exporters/init.sls
Normal file
12
prometheus/exporters/init.sls
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- if 'node_exporter' in p.wanted.component and 'exporters' in p and 'node_exporter' in p.exporters %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- .node_exporter
|
||||||
|
|
||||||
|
{%- endif %}
|
10
prometheus/exporters/node_exporter/clean.sls
Normal file
10
prometheus/exporters/node_exporter/clean.sls
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- if 'textfile_collectors' in p.exporters.node_exporter %}
|
||||||
|
include:
|
||||||
|
- .textfile_collectors.clean
|
||||||
|
{%- endif %}
|
10
prometheus/exporters/node_exporter/init.sls
Normal file
10
prometheus/exporters/node_exporter/init.sls
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- if 'textfile_collectors' in p.exporters.node_exporter %}
|
||||||
|
include:
|
||||||
|
- .textfile_collectors
|
||||||
|
{%- endif %}
|
@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
{%- if name in p.wanted.component and 'service' in p.pkg.component[name] %}
|
||||||
|
|
||||||
|
{%- if 'collector' in p.pkg.component[name]['service']['args'] %}
|
||||||
|
prometheus-exporters-{{ name }}-collector-textfile-dir-absent:
|
||||||
|
file.absent:
|
||||||
|
- names:
|
||||||
|
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
||||||
|
- {{ p.dir.textfile_collectors }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
{%- for k, v in p.get('exporters', {}).get(name, {}).get('textfile_collectors', {}).items() %}
|
||||||
|
- .{{ k }}.clean
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
|
@ -0,0 +1,54 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
|
{%- set states = [] %}
|
||||||
|
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
{%- if name in p.wanted.component and 'service' in p.pkg.component[name] %}
|
||||||
|
|
||||||
|
{%- if 'collector' in p.pkg.component[name]['service']['args'] %}
|
||||||
|
prometheus-exporters-{{ name }}-collector-textfile-dir:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
||||||
|
- mode: 755
|
||||||
|
- user: {{ name }}
|
||||||
|
- group: {{ name }}
|
||||||
|
- makedirs: True
|
||||||
|
- requre:
|
||||||
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- for k, v in p.get('exporters', {}).get(name, {}).get('textfile_collectors', {}).items() %}
|
||||||
|
{%- if v.get('enable', False) %}
|
||||||
|
{%- if v.get('remove', False) %}
|
||||||
|
{%- set state = ".{}.clean".format(k) %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set state = ".{}".format(k) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- do states.append(state) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- if states|length > 0 and p.exporters[name]['textfile_collectors_dependencies'] %}
|
||||||
|
prometheus-exporters-{{ name }}-textfile-dependencies:
|
||||||
|
pkg.installed:
|
||||||
|
- pkgs: {{ p.exporters[name]['textfile_collectors_dependencies'] }}
|
||||||
|
- require_in:
|
||||||
|
{%- for state in states %}
|
||||||
|
- sls: p.pkg.component[name]['config'][textfile_collectors{{ state }}
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
{%- for state in states %}
|
||||||
|
- {{ state }}
|
||||||
|
{% endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
|
||||||
|
prometheus-exporters-clean-{{ name }}-textfile_collectors-ipmitool:
|
||||||
|
pkg.removed:
|
||||||
|
- name: {{ p.exporters[name]['textfile_collectors']['ipmitool']['pkg'] }}
|
||||||
|
file.absent:
|
||||||
|
- names:
|
||||||
|
- {{ p.dir.archive ~ '/textfile_collectors/ipmitool' }}
|
||||||
|
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}/ipmitool.prom
|
||||||
|
cron.absent:
|
||||||
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-ipmitool-cronjob
|
@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
{%- set config = p.exporters[name]['textfile_collectors']['ipmitool'] %}
|
||||||
|
{%- set dir = {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
||||||
|
{%- set script = p.dir.archive ~ '/textfile_collectors/ipmitool' %}
|
||||||
|
{%- set cmd_prefix = 'awk -f ' if grains.os_family in ['FreeBSD'] else '' %}
|
||||||
|
|
||||||
|
prometheus-exporters-install-{{ name }}-textfile_collectors-ipmitool:
|
||||||
|
pkg.installed:
|
||||||
|
- name: {{ config.pkg }}
|
||||||
|
file.managed:
|
||||||
|
- name: {{ script }}
|
||||||
|
- source: salt://prometheus/exporters-install/{{ name }}/textfile_collectors/files/ipmitool
|
||||||
|
- mode: 755
|
||||||
|
cron.present:
|
||||||
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-ipmitool-cronjob
|
||||||
|
- name: cd {{ dir }} && LANG=C ipmitool sensor | {{ cmd_prefix }}{{ script }} > .ipmitool.prom$$; mv .ipmitool.prom$$ ipmitool.prom
|
||||||
|
- minute: "{{ config.get('minute', '*') }}"
|
||||||
|
- comment: Prometheus' {{ name }}'s ipmitool textfile collector
|
||||||
|
- require:
|
||||||
|
- file: prometheus-exporters-install-{{ name }}-textfile_collectors-ipmitool
|
@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
|
||||||
|
prometheus-exporters-clean-{{ name }}-textfile_collectors-smartmon:
|
||||||
|
pkg.removed:
|
||||||
|
- name: {{ p.exporters[name]['textfile_collectors']['smartmon']['pkg'] }}
|
||||||
|
file.absent:
|
||||||
|
- names:
|
||||||
|
- {{ p.dir.archive ~ '/textfile_collectors/smartmon.sh' }}
|
||||||
|
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}/smartmon.prom
|
||||||
|
cron.absent:
|
||||||
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-smartmon-cronjob
|
@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
||||||
|
|
||||||
|
{%- set name = 'node_exporter' %}
|
||||||
|
{%- set config = p.exporters[name]['textfile_collectors']['smartmon'] %}
|
||||||
|
{%- set dir = {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
||||||
|
{%- set script = p.dir.archive ~ '/textfile_collectors/smartmon.sh' %}
|
||||||
|
|
||||||
|
prometheus-exporters-install-{{ name }}-textfile_collectors-smartmon:
|
||||||
|
pkg.installed:
|
||||||
|
- names:
|
||||||
|
- {{ config.pkg }}
|
||||||
|
- {{ config.bash_pkg }}
|
||||||
|
file.managed:
|
||||||
|
- name: {{ script }}
|
||||||
|
- source: salt://prometheus/exporters/{{ name }}/textfile_collectors/files/smartmon.sh.jinja
|
||||||
|
- template: jinja
|
||||||
|
- context:
|
||||||
|
smartctl: {{ config.smartctl }}
|
||||||
|
- mode: 755
|
||||||
|
cron.present:
|
||||||
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-smartmon-cronjob
|
||||||
|
- name: cd {{ dir }} && LANG=C {{ script }} > .smartmon.prom$$ && mv .smartmon.prom$$ smartmon.prom
|
||||||
|
- minute: "{{ config.get('minute', '*') }}"
|
||||||
|
- comment: Prometheus' {{ name }}'s smartmon textfile collector
|
||||||
|
- require:
|
||||||
|
- file: prometheus-exporters-install-{{ name }}-textfile_collectors-smartmon
|
@ -3,8 +3,4 @@
|
|||||||
# Your changes may be overwritten.
|
# Your changes may be overwritten.
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
{%- if defaults %}
|
{{ config|yaml(False) }}
|
||||||
{%- for item in defaults %}
|
|
||||||
{{ item }}
|
|
||||||
{%- endfor %}
|
|
||||||
{%- endif %}
|
|
30
prometheus/files/macros.jinja
Normal file
30
prometheus/files/macros.jinja
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=jinja
|
||||||
|
#
|
||||||
|
# Collection of common macros
|
||||||
|
|
||||||
|
{%- macro format_kwargs(kwarg) -%}
|
||||||
|
|
||||||
|
{%- filter indent(4) %}
|
||||||
|
{%- for k, v in kwarg|dictsort() %}
|
||||||
|
- {{ k }}: {{ v }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endfilter %}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{%- macro concat_args(args) %}
|
||||||
|
{%- set args = args|dictsort %}
|
||||||
|
{%- if args|length > 0 %}
|
||||||
|
{%- for k,v in args -%}
|
||||||
|
{%- if not k or not v %}{% continue %}{% endif -%}
|
||||||
|
{%- if v == True -%}
|
||||||
|
--{{ k }}
|
||||||
|
{%- elif v == False -%}
|
||||||
|
--no-{{ k }}
|
||||||
|
{%- else -%}
|
||||||
|
--{{ k }}={{ v }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- if not loop.last %} {% endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endmacro %}
|
@ -1,11 +1,12 @@
|
|||||||
# -*- coding: utf-8 -*-
|
#.-*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ '.archive' if prometheus.use_upstream_archive else '.package' }}
|
- {{ '.archive' if p.pkg.use_upstream_archive else '.package' }}
|
||||||
- .config
|
- .config
|
||||||
- .service
|
- .service
|
||||||
|
- .exporters
|
||||||
|
- .clientlibs
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: ft=jinja
|
|
||||||
#
|
|
||||||
# Collection of common macros
|
|
||||||
|
|
||||||
{%- macro format_kwargs(kwarg) -%}
|
|
||||||
|
|
||||||
{%- filter indent(4) %}
|
|
||||||
{%- for k, v in kwarg|dictsort() %}
|
|
||||||
- {{ k }}: {{ v }}
|
|
||||||
{%- endfor %}
|
|
||||||
{%- endfilter %}
|
|
||||||
|
|
||||||
{%- endmacro %}
|
|
@ -1,48 +1,53 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=jinja
|
# vim: ft=jinja
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{#- Start imports as #}
|
|
||||||
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
|
{%- import_yaml tplroot ~ "/defaults.yaml" as default_settings %}
|
||||||
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
{%- import_yaml tplroot ~ "/osarchmap.yaml" as osarchmap %}
|
||||||
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
|
{%- import_yaml tplroot ~ "/osfamilymap.yaml" as osfamilymap %}
|
||||||
|
{%- set _config = salt['config.get'](tplroot, default={}) %}
|
||||||
|
|
||||||
{%- set defaults = salt['grains.filter_by'](default_settings,
|
{%- set defaults = salt['grains.filter_by'](
|
||||||
default='prometheus',
|
default_settings,
|
||||||
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
default=tplroot,
|
||||||
merge=salt['grains.filter_by'](osfamilymap, grain='os_family',
|
merge=salt['grains.filter_by']( osfamilymap, grain='os_family',
|
||||||
merge=salt['pillar.get']('prometheus:lookup', default={})
|
merge=salt['grains.filter_by']( osarchmap, grain='osarch',
|
||||||
|
merge=salt['grains.filter_by']( _config, default='lookup'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
) %}
|
%}
|
||||||
|
|
||||||
|
{%- set p = salt['grains.filter_by']( {'defaults': defaults}, default='defaults', merge=_config) %}
|
||||||
|
|
||||||
{#- Merge the prometheus pillar #}
|
{# ## components ## #}
|
||||||
{%- set prometheus = salt['pillar.get']('prometheus', default=defaults, merge=True) %}
|
{%- if 'component' in p.pkg and p.pkg.component is mapping %}
|
||||||
|
{%- for name,v in p.pkg.component.items() %}
|
||||||
{#- Post-processing for specific non-YAML customisations #}
|
{%- set url = None %}
|
||||||
{%- if grains.os == 'MacOS' %}
|
{%- set dir = name %}
|
||||||
{%- set macos_user = salt['cmd.run']("stat -f '%Su' /dev/console") %}
|
{%- if 'version' in v and v.version and 'archive' in v and v.archive and 'uri' in p.pkg %}
|
||||||
{%- set macos_group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
|
{%- set uri = '%s/%s/releases/download/%s/%s'|format(p.pkg.uri, name, v.version, name) %}
|
||||||
{%- do prometheus.update({'rootuser': macos_user}) %}
|
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}
|
||||||
{%- do prometheus.update({'rootgroup': macos_group}) %}
|
{%- set dir = '%s-%s'|format(name, v.version) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- do p.pkg.component[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
||||||
|
{%- do p.pkg.component[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
||||||
|
{%- endfor %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{#- Contactenate arguments #}
|
{# ## clientlibs ## #}
|
||||||
{%- macro concat_args(args) %}
|
{%- if 'clientlibs' in p.pkg and p.pkg.clientlibs is mapping %}
|
||||||
{%- set args = args|dictsort %}
|
{%- for name,v in p.pkg.clientlibs.items() %}
|
||||||
{%- if args|length > 0 %}
|
{%- set url = None %}
|
||||||
{%- for k,v in args -%}
|
{%- set dir = name %}
|
||||||
{%- if not k or not v %}{% continue %}{% endif -%}
|
{%- if 'version' in v and v.version and 'archive' in v and v.archive and 'uri' in v.archive %}
|
||||||
{%- if v == True -%}
|
{%- set url = v.archive.uri ~ '/' ~ v.version ~ '.tar.gz' %}
|
||||||
--{{ k }}
|
{%- set dir = name ~ '-' ~ v.version %}
|
||||||
{%- elif v == False -%}
|
{%- endif %}
|
||||||
--no-{{ k }}
|
{%- do p.pkg.clientlibs[name].update({'path': p.dir.archive ~ '/' + dir }) %}
|
||||||
{%- else -%}
|
{%- do p.pkg.clientlibs[name]['archive'].update({'name': p.dir.archive + '/' + dir, 'source': url}) %}
|
||||||
--{{ k }}={{ v }}
|
{%- endfor %}
|
||||||
{%- endif -%}
|
{%- endif %}
|
||||||
{%- if not loop.last %} {% endif -%}
|
|
||||||
{%- endfor -%}
|
{%- set prometheus = p %}
|
||||||
{%- endif -%}
|
|
||||||
{%- endmacro %}
|
|
||||||
|
@ -10,14 +10,29 @@
|
|||||||
# you will need to provide at least an empty dict in this file, e.g.
|
# you will need to provide at least an empty dict in this file, e.g.
|
||||||
# osfamilymap: {}
|
# osfamilymap: {}
|
||||||
---
|
---
|
||||||
|
{%- if grains.os == 'MacOS' %}
|
||||||
|
{%- set macos_rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %}
|
||||||
|
{%- set macos_rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
Arch: {}
|
||||||
|
|
||||||
|
Alpine: {}
|
||||||
|
|
||||||
Debian:
|
Debian:
|
||||||
pkg:
|
pkg:
|
||||||
node_exporter:
|
deps:
|
||||||
name: prometheus-node-exporter
|
- cron
|
||||||
args_file: /etc/default/prometheus-node-exporter
|
use_upstream_repo: true
|
||||||
service:
|
use_upstream_package: false
|
||||||
node_exporter:
|
use_upstream_archive: false
|
||||||
name: prometheus-node-exporter
|
repo:
|
||||||
|
humanname: prometheus repository
|
||||||
|
key_url: 'https://s3-eu-west-1.amazonaws.com/deb.robustperception.io/41EFC99D.gpg'
|
||||||
|
file: /etc/apt/sources.list.d/prometheus.list
|
||||||
|
component:
|
||||||
|
node_exporter:
|
||||||
|
args_file: /etc/default/prometheus-node-exporter
|
||||||
exporters:
|
exporters:
|
||||||
node_exporter:
|
node_exporter:
|
||||||
textfile_collectors_dependencies:
|
textfile_collectors_dependencies:
|
||||||
@ -25,75 +40,74 @@ Debian:
|
|||||||
|
|
||||||
RedHat:
|
RedHat:
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
use_upstream_repo: false # not working on cent8
|
||||||
repo:
|
use_upstream_archive: false
|
||||||
# yamllint disable rule:line-length
|
component:
|
||||||
baseurl: 'https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch'
|
prometheus:
|
||||||
gpgkey: 'https://packagecloud.io/prometheus-rpm/release/gpgkey gpgkey2=https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm'
|
name: prometheus2
|
||||||
# yamllint enable rule:line-length
|
repo:
|
||||||
metadata_expire: 300
|
# https://akai-tsuki.hatenablog.com/entry/2017/12/03/000000
|
||||||
|
# yamllint disable rule:line-length
|
||||||
|
baseurl: 'https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch'
|
||||||
|
gpgkey: 'https://packagecloud.io/prometheus-rpm/release/gpgkey gpgkey2=https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm'
|
||||||
|
# yamllint enable rule:line-length
|
||||||
|
sslverify: 1
|
||||||
|
sslcacert: /etc/pki/tls/certs/ca-bundle.crt
|
||||||
|
metadata_expire: 300
|
||||||
|
|
||||||
Suse: {}
|
Suse: {}
|
||||||
|
|
||||||
Gentoo:
|
Gentoo:
|
||||||
dir:
|
|
||||||
args: false
|
|
||||||
args_setting: command_args
|
|
||||||
textfile_collectors: /var/lib/node_exporter/
|
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
component:
|
||||||
name: app-metrics/prometheus
|
alertmanager:
|
||||||
args_file: /etc/conf.d/prometheus
|
name: app-metrics/alertmanager
|
||||||
node_exporter:
|
args_file: /etc/conf.d/alertmanager
|
||||||
name: app-metrics/node_exporter
|
node_exporter:
|
||||||
args_file: /etc/conf.d/node_exporter
|
name: app-metrics/node_exporter
|
||||||
alertmanager:
|
args_file: /etc/conf.d/node_exporter
|
||||||
name: app-metrics/alertmanager
|
prometheus:
|
||||||
args_file: /etc/conf.d/alertmanager
|
name: app-metrics/prometheus
|
||||||
service:
|
args_file: /etc/conf.d/prometheus
|
||||||
node_exporter:
|
|
||||||
args:
|
|
||||||
collector.textfile.directory: /var/lib/node_exporter
|
|
||||||
alertmanager:
|
|
||||||
args:
|
|
||||||
config.file: /etc/prometheus/alertmanager.yml
|
|
||||||
storage.path: /var/lib/alertmanager
|
|
||||||
prometheus:
|
|
||||||
args:
|
|
||||||
config.file: /etc/prometheus/prometheus.yml
|
|
||||||
storage.tsdb.path: /var/lib/prometheus/data
|
|
||||||
|
|
||||||
Arch: {}
|
|
||||||
|
|
||||||
Alpine: {}
|
|
||||||
|
|
||||||
FreeBSD:
|
FreeBSD:
|
||||||
rootgroup: wheel
|
identity:
|
||||||
|
rootgroup: wheel
|
||||||
dir:
|
dir:
|
||||||
args: false
|
|
||||||
etc: /usr/local/etc/prometheus
|
etc: /usr/local/etc/prometheus
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
component:
|
||||||
archive_hash: 94a63f14baeadab2f17b5ae0bbeda6688e6d06f964ef4e32c2954a0ecf3996a1
|
prometheus:
|
||||||
alertmanager:
|
archive:
|
||||||
archive_hash: ec171b13976baceace193461f8a1e61021ab9657df5ba45157cd0095aee7d569
|
source_hash: 94a63f14baeadab2f17b5ae0bbeda6688e6d06f964ef4e32c2954a0ecf3996a1
|
||||||
blackbox_exporter:
|
alertmanager:
|
||||||
archive_hash: 2b92752decf2cf1883ce4f72301e4f911dab79efbd87db4df23dc9771e53e4af
|
archive:
|
||||||
consul_exporter:
|
source_hash: ec171b13976baceace193461f8a1e61021ab9657df5ba45157cd0095aee7d569
|
||||||
archive_hash: 62e16c2f1acb9bf9411126478caccb5962da203cfb58d8c97f54b9c0add5171c
|
blackbox_exporter:
|
||||||
graphite_exporter:
|
archive:
|
||||||
archive_hash: ff424b923733d8247314353ba4d13a1c4b06450c35f005bfd6c3b6ff60b047fd
|
source_hash: 2b92752decf2cf1883ce4f72301e4f911dab79efbd87db4df23dc9771e53e4af
|
||||||
haproxy_exporter:
|
consul_exporter:
|
||||||
archive_hash: f32d158f9e3314828dc155a30a1f4c858876e1ea8ff543a4000afcbc7e923505
|
archive:
|
||||||
memcached_exporter:
|
source_hash: 62e16c2f1acb9bf9411126478caccb5962da203cfb58d8c97f54b9c0add5171c
|
||||||
archive_hash: 8fd53b9aede6b78e0530b159ccd0a437cf2f100da1ddc586681f389d804f5f19
|
graphite_exporter:
|
||||||
mysqld_exporter:
|
archive:
|
||||||
archive_hash: 9bcbbd8b3568818fd4c95d255c6f93c357ea25aed3364d7428f4ff9c89cd489a
|
source_hash: ff424b923733d8247314353ba4d13a1c4b06450c35f005bfd6c3b6ff60b047fd
|
||||||
node_exporter: {}
|
haproxy_exporter:
|
||||||
pushgateway:
|
archive:
|
||||||
archive_hash: ebcd21dc25e439eed64559e89cd7da9a94073d5ff321a8a3a4214ac2ebe04e34
|
source_hash: f32d158f9e3314828dc155a30a1f4c858876e1ea8ff543a4000afcbc7e923505
|
||||||
statsd_exporter:
|
memcached_exporter:
|
||||||
archive_hash: f345dff6311501f09bb5b6ba1128e925d504c6325ee97ad91a975f2be0d44da9
|
archive:
|
||||||
|
source_hash: 8fd53b9aede6b78e0530b159ccd0a437cf2f100da1ddc586681f389d804f5f19
|
||||||
|
mysqld_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 9bcbbd8b3568818fd4c95d255c6f93c357ea25aed3364d7428f4ff9c89cd489a
|
||||||
|
node_exporter: {}
|
||||||
|
pushgateway:
|
||||||
|
archive:
|
||||||
|
source_hash: ebcd21dc25e439eed64559e89cd7da9a94073d5ff321a8a3a4214ac2ebe04e34
|
||||||
|
statsd_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: f345dff6311501f09bb5b6ba1128e925d504c6325ee97ad91a975f2be0d44da9
|
||||||
exporters:
|
exporters:
|
||||||
node_exporter:
|
node_exporter:
|
||||||
textfile_collectors:
|
textfile_collectors:
|
||||||
@ -101,29 +115,41 @@ FreeBSD:
|
|||||||
smartctl: /usr/local/sbin/smartctl
|
smartctl: /usr/local/sbin/smartctl
|
||||||
|
|
||||||
OpenBSD:
|
OpenBSD:
|
||||||
rootgroup: wheel
|
identity:
|
||||||
|
rootgroup: wheel
|
||||||
kernel: openbsd
|
kernel: openbsd
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
component:
|
||||||
archive_hash: c3c69919b359f00a84ef12f7ed6a956111790d64a71bd94990572baaf63377ce
|
prometheus:
|
||||||
alertmanager:
|
archive:
|
||||||
archive_hash: 88ce1b3f11bb28f24b98235994277b2c31aa03b2b2609e0058c04efa0cc5596f
|
source_hash: c3c69919b359f00a84ef12f7ed6a956111790d64a71bd94990572baaf63377ce
|
||||||
blackbox_exporter:
|
alertmanager:
|
||||||
archive_hash: 0dee97d1204bac925bde919958ae890730d87386a816ed0b248c8038ee43794d
|
archive:
|
||||||
consul_exporter:
|
source_hash: 88ce1b3f11bb28f24b98235994277b2c31aa03b2b2609e0058c04efa0cc5596f
|
||||||
archive_hash: b53ee2bd0e670907eac894387e286b0dd11eb3149fcd4e19ed586006d3de741a
|
blackbox_exporter:
|
||||||
graphite_exporter:
|
archive:
|
||||||
archive_hash: 98cbd7176f1c61023892de64ad26edc3cd7895037e3cc282c4edec53dded7156
|
source_hash: 0dee97d1204bac925bde919958ae890730d87386a816ed0b248c8038ee43794d
|
||||||
haproxy_exporter:
|
consul_exporter:
|
||||||
archive_hash: bc2b222f6a08232ef643cd6dcda3264f3bd7388a5bee25365cef137c7dea17e8
|
archive:
|
||||||
memcached_exporter:
|
source_hash: b53ee2bd0e670907eac894387e286b0dd11eb3149fcd4e19ed586006d3de741a
|
||||||
archive_hash: 21db1bffc561d47b4490ccb2cde721244d00e95f504cdcfee618bc4bb877e731
|
graphite_exporter:
|
||||||
mysqld_exporter:
|
archive:
|
||||||
archive_hash: b37d6fe68e2c884540ea41c5efcfb16d0bc5da517fe3ba713144504df1ba635d
|
source_hash: 98cbd7176f1c61023892de64ad26edc3cd7895037e3cc282c4edec53dded7156
|
||||||
pushgateway:
|
haproxy_exporter:
|
||||||
archive_hash: 0bce168e4b19234df9e954393a2102c91e4d62336b2721ed882f2003a4445d51
|
archive:
|
||||||
statsd_exporter:
|
source_hash: bc2b222f6a08232ef643cd6dcda3264f3bd7388a5bee25365cef137c7dea17e8
|
||||||
archive_hash: c89acb365b75af03ce612873d8b20226e3882c0177752ea0ce17a9f5e41eb5b4
|
memcached_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 21db1bffc561d47b4490ccb2cde721244d00e95f504cdcfee618bc4bb877e731
|
||||||
|
mysqld_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: b37d6fe68e2c884540ea41c5efcfb16d0bc5da517fe3ba713144504df1ba635d
|
||||||
|
pushgateway:
|
||||||
|
archive:
|
||||||
|
source_hash: 0bce168e4b19234df9e954393a2102c91e4d62336b2721ed882f2003a4445d51
|
||||||
|
statsd_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: c89acb365b75af03ce612873d8b20226e3882c0177752ea0ce17a9f5e41eb5b4
|
||||||
|
|
||||||
Solaris: {}
|
Solaris: {}
|
||||||
|
|
||||||
@ -132,49 +158,77 @@ Windows:
|
|||||||
dir:
|
dir:
|
||||||
opt: C:\\Program Files
|
opt: C:\\Program Files
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
component:
|
||||||
archive_hash: eb138082a4d5e4d5b1e3ca838fa508f053474d46bca76e87ab0834f0d8b110db
|
prometheus:
|
||||||
alertmanager:
|
archive:
|
||||||
archive_hash: 512dbed02a3cc7e3f06d737f56179e458c462762b3427063b89c62a54d9645c6
|
source_hash: eb138082a4d5e4d5b1e3ca838fa508f053474d46bca76e87ab0834f0d8b110db
|
||||||
blackbox_exporter:
|
alertmanager:
|
||||||
archive_hash: 21ea148870631310002cbd48be54ca45e8d300da5a902b0aec052f1a64316d93
|
archive:
|
||||||
consul_exporter:
|
source_hash: 512dbed02a3cc7e3f06d737f56179e458c462762b3427063b89c62a54d9645c6
|
||||||
archive_hash: 54579bc5dfa6a238e310a1874b0a362027661dfa1754535e74610dc8ef6163b1
|
blackbox_exporter:
|
||||||
graphite_exporter:
|
archive:
|
||||||
archive_hash: f83fad71bad99ccac145d65f82bf9d17fa37168a5dcce6415c6350e79a84e638
|
source_hash: 21ea148870631310002cbd48be54ca45e8d300da5a902b0aec052f1a64316d93
|
||||||
haproxy_exporter:
|
consul_exporter:
|
||||||
archive_hash: 044118feb98b74eb921e27bd4b511732b553896c672c19bdd3418445dc030794
|
archive:
|
||||||
memcached_exporter:
|
source_hash: 54579bc5dfa6a238e310a1874b0a362027661dfa1754535e74610dc8ef6163b1
|
||||||
archive_hash: 9e83c00c9d249c942f65b6a48112e6bd6e28a3d15b8a1d35e935621657b3d837
|
graphite_exporter:
|
||||||
mysqld_exporter:
|
archive:
|
||||||
archive_hash: 38605ae648f8def07a0f412d81a30a6c48c0d20a6981468d25b91c8aa529e599
|
source_hash: f83fad71bad99ccac145d65f82bf9d17fa37168a5dcce6415c6350e79a84e638
|
||||||
pushgateway:
|
haproxy_exporter:
|
||||||
archive_hash: 506b555e7a13cabf3d85ec0dbe1bc6bc3a2444c0cc468baa8d31e7fc2fe18dd1
|
archive:
|
||||||
statsd_exporter:
|
source_hash: 044118feb98b74eb921e27bd4b511732b553896c672c19bdd3418445dc030794
|
||||||
archive_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
memcached_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 9e83c00c9d249c942f65b6a48112e6bd6e28a3d15b8a1d35e935621657b3d837
|
||||||
|
mysqld_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 38605ae648f8def07a0f412d81a30a6c48c0d20a6981468d25b91c8aa529e599
|
||||||
|
pushgateway:
|
||||||
|
archive:
|
||||||
|
source_hash: 506b555e7a13cabf3d85ec0dbe1bc6bc3a2444c0cc468baa8d31e7fc2fe18dd1
|
||||||
|
statsd_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
||||||
|
|
||||||
MacOS:
|
MacOS:
|
||||||
|
dir:
|
||||||
|
default: /etc/defaults
|
||||||
|
identity:
|
||||||
|
rootuser: {{ macos_rootuser | d('') }}
|
||||||
|
rootgroup: {{ macos_rootgroup | d('') }}
|
||||||
kernel: darwin
|
kernel: darwin
|
||||||
pkg:
|
pkg:
|
||||||
prometheus:
|
component:
|
||||||
archive_hash: 740e36bcacc0c5d4495f5341fcfa8b7e0dc623d12e8b07ac291052ea0a681325
|
prometheus:
|
||||||
alertmanager:
|
archive:
|
||||||
archive_hash: efeebaa8e51c521ecb3440345fb65962533cae022d71dff8b127911e893ded2a
|
source_hash: 740e36bcacc0c5d4495f5341fcfa8b7e0dc623d12e8b07ac291052ea0a681325
|
||||||
blackbox_exporter:
|
alertmanager:
|
||||||
archive_hash: a371d0496adb5d62368d6606928c5effd318d1387f6b9a9998f8d0333492645a
|
archive:
|
||||||
consul_exporter:
|
source_hash: efeebaa8e51c521ecb3440345fb65962533cae022d71dff8b127911e893ded2a
|
||||||
archive_hash: 75641783938967c11c18d6d340028ff2dce7ad0ae5e300fa631b813cc6ea9647
|
blackbox_exporter:
|
||||||
graphite_exporter:
|
archive:
|
||||||
archive_hash: f9c0aa745502c0ab01fdcca29181801810202e0aed512a9aa9a37bb4be88a919
|
source_hash: a371d0496adb5d62368d6606928c5effd318d1387f6b9a9998f8d0333492645a
|
||||||
haproxy_exporter:
|
consul_exporter:
|
||||||
archive_hash: 8fdb8bb182586c57e5892816a02846bae0998916765d22bb81b2c444a3565862
|
archive:
|
||||||
memcached_exporter:
|
source_hash: 75641783938967c11c18d6d340028ff2dce7ad0ae5e300fa631b813cc6ea9647
|
||||||
archive_hash: e10685cca5ffd8a3a7574b3dc096dc7418f34906abd399f881be06dd38be62cb
|
graphite_exporter:
|
||||||
mysqld_exporter:
|
archive:
|
||||||
archive_hash: 8e0a7d8847790d6dcdcf392e6dd227458a7bcaa1e0890cc6326fdf956421f2a7
|
source_hash: f9c0aa745502c0ab01fdcca29181801810202e0aed512a9aa9a37bb4be88a919
|
||||||
node_exporter:
|
haproxy_exporter:
|
||||||
archive_hash: 20fadb3108de0a9cc70a1333394e5be90416b4f91025f9fc66f5736335e94398
|
archive:
|
||||||
pushgateway:
|
source_hash: 8fdb8bb182586c57e5892816a02846bae0998916765d22bb81b2c444a3565862
|
||||||
archive_hash: 25399a4c6600c1931f9d9bd5294700c2b53f964188b1c6003f9d12a2e176aac1
|
memcached_exporter:
|
||||||
statsd_exporter:
|
archive:
|
||||||
archive_hash: 15132494523c2b6a89e09b2da63452c8fe587fb82fcc3fd21cc75a4aa2766644
|
source_hash: e10685cca5ffd8a3a7574b3dc096dc7418f34906abd399f881be06dd38be62cb
|
||||||
|
mysqld_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 8e0a7d8847790d6dcdcf392e6dd227458a7bcaa1e0890cc6326fdf956421f2a7
|
||||||
|
node_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 20fadb3108de0a9cc70a1333394e5be90416b4f91025f9fc66f5736335e94398
|
||||||
|
pushgateway:
|
||||||
|
archive:
|
||||||
|
source_hash: 25399a4c6600c1931f9d9bd5294700c2b53f964188b1c6003f9d12a2e176aac1
|
||||||
|
statsd_exporter:
|
||||||
|
archive:
|
||||||
|
source_hash: 15132494523c2b6a89e09b2da63452c8fe587fb82fcc3fd21cc75a4aa2766644
|
||||||
|
@ -1,27 +1,24 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
|
{%- set sls_config_clean = tplroot ~ '.config.clean' %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||||
|
{%- set sls_repo_clean = tplroot ~ '.package.repo.clean' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_config_clean }}
|
- {{ sls_config_clean }}
|
||||||
{%- if prometheus.use_upstream_repo %}
|
- {{ sls_service_clean }}
|
||||||
- .repo.clean
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- if name in prometheus.pkg %}
|
|
||||||
|
|
||||||
prometheus-package-clean-{{ name }}-removed:
|
prometheus-package-clean-{{ name }}-removed:
|
||||||
pkg.removed:
|
pkg.removed:
|
||||||
- name: {{ name }}
|
- name: {{ p.pkg.component[name].get('name', name) }}
|
||||||
{%- if name in prometheus.service %}
|
|
||||||
- require:
|
- require:
|
||||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
- sls: {{ sls_config_clean }}
|
||||||
{%- endif %}
|
- sls: {{ sls_service_clean }}
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -1,22 +1,25 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- if prometheus.use_upstream_repo %}
|
{%- set sls_service_running = tplroot ~ '.service.running' %}
|
||||||
|
{%- set sls_repo_install = tplroot ~ '.package.repo.install' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- .repo
|
- {{ sls_service_running }}
|
||||||
|
- {{ sls_repo_install }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- for name in prometheus.wanted %}
|
|
||||||
{%- if name in prometheus.pkg %}
|
|
||||||
|
|
||||||
prometheus-package-install-{{ name }}-installed:
|
prometheus-package-install-{{ name }}-installed:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- name: {{ prometheus.pkg.get(name, {}).get('name', name) }}
|
- name: {{ p.pkg.component[name].get('name', name) }}
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_repo_install }}
|
||||||
|
- require_in:
|
||||||
|
- sls: {{ sls_service_running }}
|
||||||
|
- reload_modules: true
|
||||||
|
|
||||||
{%- endif %}
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -1,16 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %}
|
||||||
{%- if name in prometheus.pkg and 'repo' in prometheus.pkg[name] and prometheus.pkg[name]['repo'] %}
|
|
||||||
|
|
||||||
prometheus-package-repo-clean-{{ name }}-pkgrepo-absent:
|
prometheus-package-repo-clean-pkgrepo-managed:
|
||||||
pkgrepo.absent:
|
pkgrepo.absent:
|
||||||
- name: {{ prometheus.pkg[name]['repo']['name'] }}
|
- name: {{ p.pkg['repo']['name'] }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
|
||||||
|
@ -1,26 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg %}
|
||||||
{%- if name in prometheus.pkg and 'repo' in prometheus.pkg[name] and prometheus.pkg[name]['repo'] %}
|
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
|
||||||
{%- from tplroot ~ "/jinja/macros.jinja" import format_kwargs with context %}
|
|
||||||
|
|
||||||
prometheus-package-repo-install-{{ name }}-pkgrepo-managed:
|
prometheus-package-repo-install-pkgrepo-managed:
|
||||||
pkgrepo.managed:
|
pkgrepo.managed:
|
||||||
{{- format_kwargs(prometheus.pkg[name]['repo']) }}
|
{{- format_kwargs(p.pkg['repo']) }}
|
||||||
|
|
||||||
prometheus-package-repo-install-{{ name }}-file-replace:
|
|
||||||
# redhat workaround for salt issue #51494
|
|
||||||
file.replace:
|
file.replace:
|
||||||
- name: /etc/yum.repos.d/{{ name }}.repo
|
# redhat workaround for salt issue #51494
|
||||||
|
- name: /etc/yum.repos.d/prometheus.repo
|
||||||
- pattern: ' gpgkey2='
|
- pattern: ' gpgkey2='
|
||||||
- repl: '\n '
|
- repl: '\n '
|
||||||
- ignore_if_missing: True
|
- ignore_if_missing: True
|
||||||
- onlyif: {{ grains.os_family == 'RedHat' }}
|
- onlyif: {{ grains.os_family == 'RedHat' }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
|
||||||
|
38
prometheus/service/args/clean.sls
Normal file
38
prometheus/service/args/clean.sls
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_service_clean }}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.component %}
|
||||||
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
||||||
|
|
||||||
|
prometheus-service-args-clean-{{ name }}:
|
||||||
|
file.absent:
|
||||||
|
- names:
|
||||||
|
- /tmp/dummy-{{ name }}-dummy
|
||||||
|
{%- if 'storage.tsdb.path' in p.pkg.component[name]['service']['args'] %}
|
||||||
|
- {{ p.pkg.component[name]['service']['args']['storage.tsdb.path'] }}
|
||||||
|
{%- endif %}
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_service_clean }}
|
||||||
|
|
||||||
|
{%- if grains.os_family == 'FreeBSD' %}
|
||||||
|
sysrc.absent:
|
||||||
|
- names:
|
||||||
|
- {{ name }}_args
|
||||||
|
- {{ name }}_listen_address
|
||||||
|
- {{ name }}_textfile_dir
|
||||||
|
- {{ name }}_data_dir
|
||||||
|
- {{ name }}_config
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_service_clean }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
75
prometheus/service/args/install.sls
Normal file
75
prometheus/service/args/install.sls
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=sls
|
||||||
|
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
|
||||||
|
{%- set sls_config_users = tplroot ~ '.config.users' %}
|
||||||
|
{%- set sls_archive_install = tplroot ~ '.archive.install' %}
|
||||||
|
{%- set sls_package_install = tplroot ~ '.package.install' %}
|
||||||
|
|
||||||
|
|
||||||
|
include:
|
||||||
|
- {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
|
{%- for name in p.wanted.component %}
|
||||||
|
{%- if 'service' in p.pkg.component[name] and 'args' in p.pkg.component[name]['service'] %}
|
||||||
|
{%- set args = p.pkg.component[name]['service']['args'] %}
|
||||||
|
{%- if 'storage.tsdb.path' in args.keys() %}
|
||||||
|
|
||||||
|
prometheus-service-args-{{ name }}-data-dir:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ args['storage.tsdb.path'] }}
|
||||||
|
- owner: {{ name }}
|
||||||
|
- group: {{ name }}
|
||||||
|
- makedirs: True
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
- require:
|
||||||
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- if grains.os_family == 'FreeBSD' %}
|
||||||
|
{%- if 'collector.textfile.directory' in args.keys() %}
|
||||||
|
|
||||||
|
prometheus-service-args-{{ name }}-collector-textfile-directory:
|
||||||
|
sysrc.managed:
|
||||||
|
- name: {{ name }}_textfile_dir
|
||||||
|
- value: {{ args.pop('collector.textfile.directory') }}
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- if 'storage.tsdb.path' in args.keys() %}
|
||||||
|
|
||||||
|
prometheus-service-args-{{ name }}-storage-tsdb-path:
|
||||||
|
sysrc.managed:
|
||||||
|
- name: {{ name }}_data_dir
|
||||||
|
- value: {{ args.pop('storage.tsdb.path') }}
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- if 'web.listen-address' in args.keys() %}
|
||||||
|
|
||||||
|
prometheus-service-args-{{ name }}-web-listen-address:
|
||||||
|
sysrc.managed:
|
||||||
|
- name: {{ name }}_listen_address
|
||||||
|
- value: {{ args.pop('web.listen-address') }}
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
prometheus-service-args-{{ name }}-install:
|
||||||
|
sysrc.managed:
|
||||||
|
- name: {{ name }}_config
|
||||||
|
- value: {{ p.dir.etc }}/{{ name }}.yml
|
||||||
|
- watch_in:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
@ -1,38 +1,36 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
{%- if name in prometheus.service %}
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
||||||
|
{%- set service_name = p.pkg.component[name]['service']['get'](name, {}).get('name', name) %}
|
||||||
|
|
||||||
{%- set service_name = prometheus.service.get(name, {}).get('name', False) %}
|
prometheus-service-clean-{{ name }}:
|
||||||
{%- if not service_name %}
|
|
||||||
{%- set service_name = name %}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
prometheus-service-clean-{{ name }}-service-dead:
|
|
||||||
service.dead:
|
service.dead:
|
||||||
- name: {{ name }}
|
- name: {{ service_name }}
|
||||||
- enable: False
|
- enable: False
|
||||||
{%- if grains.kernel|lower == 'linux' %}
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
file.absent:
|
file.absent:
|
||||||
- name: {{ prometheus.dir.service }}/{{ name }}.service
|
- name: {{ p.dir.service }}/{{ name }}.service
|
||||||
- require:
|
- require:
|
||||||
- service: prometheus-service-clean-{{ name }}-service-dead
|
- service: prometheus-service-clean-{{ name }}
|
||||||
cmd.run:
|
cmd.run:
|
||||||
- onlyif: {{ grains.kernel|lower == 'linux' }}
|
- onlyif: {{ grains.kernel|lower == 'linux' }}
|
||||||
- name: systemctl daemon-reload
|
- name: systemctl daemon-reload
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-service-clean-{{ name }}-service-dead
|
- file: prometheus-service-clean-{{ name }}
|
||||||
|
|
||||||
|
{%- if grains.os_family == 'FreeBSD' %}
|
||||||
|
sysrc.absent:
|
||||||
|
- name: {{ name }}_environ
|
||||||
|
- require:
|
||||||
|
- service: prometheus-service-clean-{{ name }}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
prometheus-config-file-var-file-absent:
|
|
||||||
file.absent:
|
|
||||||
- name: {{ prometheus.dir.var }}
|
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
include:
|
include:
|
||||||
|
- .args
|
||||||
- .running
|
- .running
|
||||||
|
@ -1,66 +1,60 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{#- Get the `tplroot` from `tpldir` #}
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
{%- set sls_config_args = tplroot ~ '.config.args' %}
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
{%- set sls_config_file = tplroot ~ '.config.file' %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
{%- set sls_config_environ = tplroot ~ '.config.environ' %}
|
||||||
|
{%- set sls_service_args = tplroot ~ '.service.args.install' %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- {{ sls_config_args }}
|
- {{ sls_service_args }}
|
||||||
- {{ sls_config_file }}
|
- {{ sls_config_file }}
|
||||||
|
- {{ sls_config_environ }}
|
||||||
|
|
||||||
{%- if 'prometheus' in prometheus.wanted %}
|
{%- for name in p.wanted.component %}
|
||||||
prometheus-config-file-var-file-directory:
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
||||||
file.directory:
|
{%- set service_name = p.pkg.component[name]['service']['get'](name, {}).get('name', name) %}
|
||||||
- name: {{ prometheus.dir.var }}
|
|
||||||
- user: prometheus
|
|
||||||
- group: prometheus
|
|
||||||
- mode: 755
|
|
||||||
- makedirs: True
|
|
||||||
- require:
|
|
||||||
- file: prometheus-config-file-etc-file-directory
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for name in prometheus.wanted %}
|
prometheus-service-running-{{ name }}-unmasked:
|
||||||
{%- if name in prometheus.service %}
|
|
||||||
|
|
||||||
{%- set service_name = prometheus.service.get(name, {}).get('name', False) %}
|
|
||||||
{%- if not service_name %}
|
|
||||||
{%- set service_name = name %}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- if grains.kernel|lower == 'linux' %}
|
|
||||||
|
|
||||||
prometheus-service-running-{{ name }}-service-unmasked:
|
|
||||||
service.unmasked:
|
service.unmasked:
|
||||||
- name: {{ service_name }}
|
- name: {{ service_name }}
|
||||||
{%- if 'prometheus' in prometheus.wanted %}
|
|
||||||
- require:
|
|
||||||
- file: prometheus-config-file-var-file-directory
|
|
||||||
{%- endif %}
|
|
||||||
- onlyif:
|
- onlyif:
|
||||||
- systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
- {{ grains.kernel|lower == 'linux' }}
|
||||||
{%- endif %}
|
- systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
||||||
|
- require_in:
|
||||||
prometheus-service-running-{{ name }}-service-running:
|
- service: prometheus-service-running-{{ name }}
|
||||||
service.running:
|
|
||||||
- name: {{ service_name }}
|
|
||||||
- enable: True
|
|
||||||
{%- if name in prometheus.config %}
|
|
||||||
- watch:
|
|
||||||
- file: prometheus-config-file-{{ name }}-file-managed
|
|
||||||
{%- endif %}
|
|
||||||
{%- if 'prometheus' in prometheus.wanted %}
|
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-config-file-var-file-directory
|
- sls: {{ sls_service_args }}
|
||||||
{%- endif %}
|
- sls: {{ sls_config_file }}
|
||||||
|
- file: prometheus-config-file-etc-file-directory
|
||||||
|
|
||||||
|
prometheus-service-running-{{ name }}:
|
||||||
|
pkg.installed:
|
||||||
|
- name: firewalld
|
||||||
|
- reload_modules: true
|
||||||
|
- onlyif: {{ grains.kernel|lower == 'linux' }}
|
||||||
|
service.running:
|
||||||
|
- names:
|
||||||
|
- {{ service_name }}
|
||||||
{%- if grains.kernel|lower == 'linux' %}
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
- service: prometheus-service-running-{{ name }}-service-unmasked
|
- firewalld
|
||||||
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
- onlyif: systemctl list-units | grep {{ service_name }} >/dev/null 2>&1
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
- enable: True
|
||||||
|
- require:
|
||||||
|
- sls: {{ sls_service_args }}
|
||||||
|
- sls: {{ sls_config_file }}
|
||||||
|
{%- if p.wanted.firewall %}
|
||||||
|
firewalld.present:
|
||||||
|
- name: public
|
||||||
|
- ports: {{ p.pkg.component[name]['firewall']['ports']|json }}
|
||||||
|
- onlyif:
|
||||||
|
- {{ p.wanted.firewall }}
|
||||||
|
- {{ grains.kernel|lower == 'linux' }}
|
||||||
|
- require:
|
||||||
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof commit.hash === `string`) {
|
if (typeof commit.hash === `string`) {
|
||||||
commit.shortHash = commit.hash.substring(0, 7)
|
commit.hash = commit.hash.substring(0, 7)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof commit.subject === `string`) {
|
if (typeof commit.subject === `string`) {
|
||||||
|
112
test/integration/default/controls/archive_spec.rb
Normal file
112
test/integration/default/controls/archive_spec.rb
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
control 'prometheus components' do
|
||||||
|
title 'should be installed'
|
||||||
|
|
||||||
|
# describe package('cron') do
|
||||||
|
# it { should be_installed } # not available on amazonlinux?
|
||||||
|
# end
|
||||||
|
describe group('prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe user('prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe group('alertmanager') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe user('alertmanager') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe group('node_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe user('node_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'prometheus' }
|
||||||
|
end
|
||||||
|
describe directory('/opt/prometheus/prometheus-v2.10.0') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/opt/prometheus/prometheus-v2.10.0/prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus/prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'prometheus' }
|
||||||
|
end
|
||||||
|
describe file('/usr/lib/systemd/system/prometheus.service') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
describe directory('/opt/prometheus/alertmanager-v0.17.0') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/opt/prometheus/alertmanager-v0.17.0/amtool') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus/alertmanager') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'alertmanager' }
|
||||||
|
end
|
||||||
|
describe file('/usr/lib/systemd/system/alertmanager.service') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
describe directory('/opt/prometheus/node_exporter-v0.18.1') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/opt/prometheus/node_exporter-v0.18.1/node_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe directory('/var/lib/prometheus/node_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'node_exporter' }
|
||||||
|
end
|
||||||
|
describe file('/usr/lib/systemd/system/node_exporter.service') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
describe file('/usr/local/sbin/alertmanager') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/usr/local/sbin/amtool') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/usr/local/sbin/node_exporter') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/usr/local/sbin/prometheus') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/usr/local/sbin/promtool') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'root' }
|
||||||
|
end
|
||||||
|
describe file('/etc/prometheus/prometheus.yml') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'prometheus' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
describe file('/etc/prometheus/alertmanager.yml') do
|
||||||
|
it { should exist }
|
||||||
|
its('group') { should eq 'alertmanager' }
|
||||||
|
its('mode') { should cmp '0644' }
|
||||||
|
end
|
||||||
|
end
|
@ -1,20 +0,0 @@
|
|||||||
control 'Prometheus configuration' do
|
|
||||||
title 'should match desired lines'
|
|
||||||
|
|
||||||
describe file('/etc/prometheus/prometheus.yml') do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'prometheus' }
|
|
||||||
it { should be_grouped_into 'prometheus' }
|
|
||||||
its('mode') { should cmp '0644' }
|
|
||||||
its('content') { should include 'File managed by Salt' }
|
|
||||||
its('content') { should include 'Your changes may be overwritten.' }
|
|
||||||
its('content') { should include 'global:' }
|
|
||||||
its('content') { should include 'alerting:' }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe file('/opt/prometheus/textfile_collectors/ipmitool') do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
its('mode') { should cmp '0755' }
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,18 +0,0 @@
|
|||||||
control 'prometheus configuration environment' do
|
|
||||||
title 'should match desired lines'
|
|
||||||
|
|
||||||
args_file = case os[:family]
|
|
||||||
when 'debian'
|
|
||||||
'/etc/default/prometheus'
|
|
||||||
else
|
|
||||||
'/etc/default/prometheus.sh'
|
|
||||||
end
|
|
||||||
|
|
||||||
describe file(args_file) do
|
|
||||||
it { should be_file }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
its('mode') { should cmp '0644' }
|
|
||||||
its('content') { should include '--web.listen-address=0.0.0.0:9090' }
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
control 'Prometheus package' do
|
|
||||||
title 'should be installed'
|
|
||||||
|
|
||||||
describe package('prometheus') do
|
|
||||||
it { should be_installed }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe package('prometheus-node-exporter') do
|
|
||||||
it { should be_installed }
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,10 +0,0 @@
|
|||||||
control 'Prometheus service' do
|
|
||||||
impact 0.5
|
|
||||||
title 'should be running and enabled'
|
|
||||||
|
|
||||||
describe service('prometheus') do
|
|
||||||
it { should be_enabled }
|
|
||||||
#it { should be_running } #some ubuntu 16.05 image issue
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,36 +0,0 @@
|
|||||||
title 'linux alternatives profile'
|
|
||||||
|
|
||||||
control 'prometheus linux alternatives' do
|
|
||||||
impact 1.0
|
|
||||||
title 'should be installed'
|
|
||||||
desc "Ensure prometheus linux alternatives are correct"
|
|
||||||
tag: package: "tarball archive"
|
|
||||||
|
|
||||||
describe file('/opt/prometheus') do # prometheus-home alternative
|
|
||||||
it { should be_symlink }
|
|
||||||
it { should_not be_file }
|
|
||||||
it { should_not be_directory }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
its('shallow_link_path') { should eq '/etc/alternatives/prometheus-home' }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe file('/usr/bin/prometheus') do # prometheus alternative
|
|
||||||
it { should be_symlink }
|
|
||||||
it { should_not be_file }
|
|
||||||
it { should_not be_directory }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
its('shallow_link_path') { should eq '/etc/alternatives/link-prometheus' }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe file('/usr/bin/promtool') do # promtool alternative
|
|
||||||
it { should be_symlink }
|
|
||||||
it { should_not be_file }
|
|
||||||
it { should_not be_directory }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
its('shallow_link_path') { should eq '/etc/alternatives/link-promtool' }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,28 +0,0 @@
|
|||||||
title 'prometheus archives profile'
|
|
||||||
|
|
||||||
control 'prometheus tarball archive' do
|
|
||||||
impact 1.0
|
|
||||||
title 'should be installed'
|
|
||||||
desc "Ensure prometheus tarball archive was extracted correctly"
|
|
||||||
|
|
||||||
describe file('/opt/prometheus-2.10.0.linux-amd64') do
|
|
||||||
it { should be_directory }
|
|
||||||
it { should be_owned_by 'root' }
|
|
||||||
it { should be_grouped_into 'root' }
|
|
||||||
its('mode') { should cmp '0755' }
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'digest'
|
|
||||||
binary = file('/opt/prometheus-2.10.0.linux-amd64/prometheus').content
|
|
||||||
sha256sum = Digest::SHA256.hexdigest(binary)
|
|
||||||
describe file('/opt/prometheus-2.10.0.linux-amd64/prometheus') do
|
|
||||||
its('sha256sum') { should eq '025a7bb0327e1b2b20efbd6e66b8ef81d9020c66f0d5d077b1388a48dec789f7' }
|
|
||||||
end
|
|
||||||
|
|
||||||
binary = file('/opt/prometheus-2.10.0.linux-amd64/promtool').content
|
|
||||||
sha256sum = Digest::SHA256.hexdigest(binary)
|
|
||||||
describe file('/opt/prometheus-2.10.0.linux-amd64/promtool') do
|
|
||||||
its('sha256sum') { should eq 'db004c3c0d6a863929a51da5e1fc4a958668e80256ea2a14c5e461fa13656def' }
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
50
test/integration/repo/README.md
Normal file
50
test/integration/repo/README.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# InSpec Profile: `repo`
|
||||||
|
|
||||||
|
This shows the implementation of the `repo` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
|
||||||
|
|
||||||
|
## Verify a profile
|
||||||
|
|
||||||
|
InSpec ships with built-in features to verify a profile structure.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec check repo
|
||||||
|
Summary
|
||||||
|
-------
|
||||||
|
Location: repo
|
||||||
|
Profile: profile
|
||||||
|
Controls: 4
|
||||||
|
Timestamp: 2019-06-24T23:09:01+00:00
|
||||||
|
Valid: true
|
||||||
|
|
||||||
|
Errors
|
||||||
|
------
|
||||||
|
|
||||||
|
Warnings
|
||||||
|
--------
|
||||||
|
```
|
||||||
|
|
||||||
|
## Execute a profile
|
||||||
|
|
||||||
|
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec exec repo
|
||||||
|
..
|
||||||
|
|
||||||
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||||
|
8 examples, 0 failures
|
||||||
|
```
|
||||||
|
|
||||||
|
## Execute a specific control from a profile
|
||||||
|
|
||||||
|
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec exec repo --controls package
|
||||||
|
.
|
||||||
|
|
||||||
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||||
|
1 examples, 0 failures
|
||||||
|
```
|
||||||
|
|
||||||
|
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).
|
9
test/integration/repo/controls/packages_spec.rb
Normal file
9
test/integration/repo/controls/packages_spec.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
control 'prometheus package' do
|
||||||
|
title 'should be installed'
|
||||||
|
|
||||||
|
describe package('prometheus2') do
|
||||||
|
it { should be_installed }
|
||||||
|
end
|
||||||
|
end
|
18
test/integration/repo/inspec.yml
Normal file
18
test/integration/repo/inspec.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
name: repo
|
||||||
|
title: prometheus formula
|
||||||
|
maintainer: SaltStack Formulas
|
||||||
|
license: Apache-2.0
|
||||||
|
summary: Verify that the prometheus formula is setup and configured correctly
|
||||||
|
supports:
|
||||||
|
- platform-name: debian
|
||||||
|
- platform-name: ubuntu
|
||||||
|
- platform-name: centos
|
||||||
|
- platform-name: fedora
|
||||||
|
- platform-name: opensuse
|
||||||
|
- platform-name: suse
|
||||||
|
- platform-name: freebsd
|
||||||
|
- platform-name: amazon
|
||||||
|
- platform-name: arch
|
1
test/salt/pillar/default.sls
Symbolic link
1
test/salt/pillar/default.sls
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../../pillar.example
|
193
test/salt/pillar/repo.sls
Normal file
193
test/salt/pillar/repo.sls
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
|
prometheus:
|
||||||
|
wanted:
|
||||||
|
clientlibs:
|
||||||
|
- golang
|
||||||
|
- haskell
|
||||||
|
- rust
|
||||||
|
component:
|
||||||
|
- prometheus
|
||||||
|
- alertmanager # not in debian repo, only archive
|
||||||
|
- node_exporter
|
||||||
|
# - memcached_exporter # not in upstream repo, only archive
|
||||||
|
|
||||||
|
exporters:
|
||||||
|
node_exporter:
|
||||||
|
textfile_collectors_dependencies: []
|
||||||
|
textfile_collectors:
|
||||||
|
ipmitool:
|
||||||
|
enable: false
|
||||||
|
remove: false
|
||||||
|
pkg: ipmitool
|
||||||
|
smartmon:
|
||||||
|
enable: false
|
||||||
|
remove: false
|
||||||
|
pkg: smartmontools
|
||||||
|
bash_pkg: bash
|
||||||
|
smartctl: /usr/sbin/smartctl
|
||||||
|
|
||||||
|
pkg:
|
||||||
|
use_upstream_repo: true
|
||||||
|
use_upstream_archive: false
|
||||||
|
|
||||||
|
clientlibs:
|
||||||
|
# https://prometheus.io/docs/instrumenting/clientlibs
|
||||||
|
# no bash & perl client tarballs are available
|
||||||
|
golang:
|
||||||
|
version: v1.6.0
|
||||||
|
|
||||||
|
component:
|
||||||
|
alertmanager:
|
||||||
|
config:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
# ref https://github.com/prometheus/alertmanager/blob/master/config/testdata/conf.good.yml
|
||||||
|
global:
|
||||||
|
smtp_smarthost: 'localhost:25'
|
||||||
|
smtp_from: 'alertmanager@example.org'
|
||||||
|
smtp_auth_username: 'alertmanager'
|
||||||
|
smtp_auth_password: "multiline\nmysecret"
|
||||||
|
smtp_hello: "host.example.org"
|
||||||
|
slack_api_url: "http://mysecret.example.com/"
|
||||||
|
http_config:
|
||||||
|
proxy_url: 'http://127.0.0.1:1025'
|
||||||
|
route:
|
||||||
|
group_by: ['alertname', 'cluster', 'service']
|
||||||
|
group_wait: 30s
|
||||||
|
group_interval: 5m
|
||||||
|
repeat_interval: 3h
|
||||||
|
receiver: team-X-mails
|
||||||
|
routes:
|
||||||
|
- match_re:
|
||||||
|
service: ^(foo1|foo2|baz)$
|
||||||
|
receiver: team-X-mails
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
severity: critical
|
||||||
|
receiver: team-X-mails
|
||||||
|
receivers:
|
||||||
|
- name: 'team-X-mails'
|
||||||
|
email_configs:
|
||||||
|
- to: 'team-X+alerts@example.org'
|
||||||
|
|
||||||
|
inhibit_rules:
|
||||||
|
- name: opsGenie-receiver
|
||||||
|
opsgenie_configs:
|
||||||
|
- api_key: mysecret
|
||||||
|
- name: slack-receiver
|
||||||
|
slack_configs:
|
||||||
|
- channel: '#my-channel'
|
||||||
|
image_url: 'http://some.img.com/img.png'
|
||||||
|
|
||||||
|
node_exporter:
|
||||||
|
version: v0.18.1
|
||||||
|
archive:
|
||||||
|
source_hash: b2503fd932f85f4e5baf161268854bf5d22001869b84f00fd2d1f57b51b72424
|
||||||
|
service:
|
||||||
|
name: prometheus-node-exporter
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9110"
|
||||||
|
# collector.textfile.directory: /var/tmp/node_exporter
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: 0.0.0.0:9090
|
||||||
|
config:
|
||||||
|
# yamllint disable-line rule:line-length
|
||||||
|
# ref https://raw.githubusercontent.com/prometheus/prometheus/release-2.10/config/testdata/conf.good.yml
|
||||||
|
# my global config
|
||||||
|
global:
|
||||||
|
# Set the scrape interval to every 15 seconds. Default is every 1 minute
|
||||||
|
scrape_interval: 15s
|
||||||
|
# Evaluate rules every 15 seconds. The default is every 1 minute
|
||||||
|
evaluation_interval: 15s
|
||||||
|
# scrape_timeout is set to the global default (10s)
|
||||||
|
|
||||||
|
# Alertmanager configuration
|
||||||
|
alerting:
|
||||||
|
alertmanagers:
|
||||||
|
- static_configs:
|
||||||
|
- targets:
|
||||||
|
- alertmanager1:9093
|
||||||
|
- alertmanager2:9093
|
||||||
|
- alertmanager3:9093
|
||||||
|
|
||||||
|
# Load rules once and periodically evaluate them according to the global
|
||||||
|
# 'evaluation_interval'
|
||||||
|
rule_files:
|
||||||
|
- "first_rules.yml"
|
||||||
|
# - "second_rules.yml"
|
||||||
|
|
||||||
|
# A scrape configuration containing exactly one endpoint to scrape:
|
||||||
|
scrape_configs:
|
||||||
|
# The job name is added as a label `job=<job_name>` to any timeseries
|
||||||
|
# scraped from this config
|
||||||
|
- job_name: 'prometheus'
|
||||||
|
# metrics_path defaults to '/metrics'
|
||||||
|
# scheme defaults to 'http'
|
||||||
|
static_configs:
|
||||||
|
- targets: ['localhost:9090']
|
||||||
|
|
||||||
|
- job_name: pushgateway
|
||||||
|
scrape_interval: 5s
|
||||||
|
honor_labels: true
|
||||||
|
static_configs:
|
||||||
|
- targets: ['pushgateway:9091']
|
||||||
|
|
||||||
|
- job_name: 'blackbox'
|
||||||
|
# https://github.com/prometheus/blackbox_exporter#prometheus-configuration
|
||||||
|
metrics_path: /probe
|
||||||
|
params:
|
||||||
|
module: [http_2xx] # Look for a HTTP 200 response
|
||||||
|
static_configs:
|
||||||
|
- targets:
|
||||||
|
- http://prometheus.io # Target to probe with http
|
||||||
|
- https://prometheus.io # Target to probe with https
|
||||||
|
- http://example.com:8080 # Target to probe with http on port 8080
|
||||||
|
relabel_configs:
|
||||||
|
- source_labels: [__address__]
|
||||||
|
target_label: __param_target
|
||||||
|
- source_labels: [__param_target]
|
||||||
|
target_label: instance
|
||||||
|
- target_label: __address__
|
||||||
|
replacement: '127.0.0.1:9115' # real hostname and port
|
||||||
|
|
||||||
|
pushgateway:
|
||||||
|
version: v0.8.0
|
||||||
|
archive:
|
||||||
|
source_hash: 6949866ba9ad0cb88d3faffd4281f17df79281398b4dbd0ec3aab300071681ca
|
||||||
|
service:
|
||||||
|
args:
|
||||||
|
web.listen-address: ":9091"
|
||||||
|
web.telemetry-path: "/metrics"
|
||||||
|
|
||||||
|
linux:
|
||||||
|
# 'Alternatives system' priority: zero disables (default)
|
||||||
|
# yamllint disable-line rule:braces
|
||||||
|
altpriority: {{ range(1, 9100000) | random }}
|
||||||
|
|
||||||
|
tofs:
|
||||||
|
# The files_switch key serves as a selector for alternative
|
||||||
|
# directories under the formula files directory. See TOFS pattern
|
||||||
|
# doc for more info
|
||||||
|
# Note: Any value not evaluated by `config.get` will be used literally
|
||||||
|
# This can be used to set custom paths, as many levels deep as required
|
||||||
|
files_switch:
|
||||||
|
- any/path/can/be/used/here
|
||||||
|
- id
|
||||||
|
- osfinger
|
||||||
|
- os
|
||||||
|
- os_family
|
||||||
|
# All aspects of path/file resolution are customisable using the options below
|
||||||
|
# This is unnecessary in most cases; there are sensible defaults
|
||||||
|
# path_prefix: prometheus_alt
|
||||||
|
# dirs:
|
||||||
|
# files: files_alt
|
||||||
|
# default: default_alt
|
||||||
|
source_files:
|
||||||
|
prometheus-config-file-file-managed:
|
||||||
|
- 'alt_config.yml.jinja'
|
||||||
|
prometheus-archive-install-managed-service:
|
||||||
|
- 'alt_systemd.ini.jinja'
|
Loading…
Reference in New Issue
Block a user