Merge pull request #46 from noelmcloughlin/win
chore(windows): basic support
This commit is contained in:
commit
79db2125f7
@ -20,7 +20,7 @@ prometheus-archive-clean-{{ name }}:
|
|||||||
file.absent:
|
file.absent:
|
||||||
- name: {{ p.pkg.component[name]['path'] }}
|
- name: {{ p.pkg.component[name]['path'] }}
|
||||||
|
|
||||||
{%- if p.linux.altpriority|int <= 0 or grains.os_family|lower in ('macos', 'arch') %}
|
{%- if (grains.kernel|lower == 'linux' and 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 %}
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
{%- for cmd in p.pkg.component[name]['commands'] %}
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
|
@ -11,46 +11,55 @@ include:
|
|||||||
- {{ sls_config_users }}
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
prometheus-archive-install-prerequisites:
|
prometheus-archive-install-prerequisites:
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- names: {{ p.pkg.deps|json }}
|
- names: {{ p.pkg.deps|json }}
|
||||||
|
{%- endif %}
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.dir.var }}
|
- name: {{ p.dir.var }}
|
||||||
- user: {{ p.identity.rootuser }}
|
|
||||||
- group: {{ p.identity.rootgroup }}
|
|
||||||
- mode: 755
|
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_config_users }}
|
- sls: {{ sls_config_users }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- mode: 755
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- for name in p.wanted.component %}
|
{%- for name in p.wanted.component %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}:
|
prometheus-archive-install-{{ name }}:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.pkg.component[name]['path'] }}
|
- name: {{ p.pkg.component[name]['path'] }}
|
||||||
- user: {{ p.identity.rootuser }}
|
|
||||||
- group: {{ p.identity.rootgroup }}
|
|
||||||
- mode: '0755'
|
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-prerequisites
|
- file: prometheus-archive-install-prerequisites
|
||||||
- require_in:
|
- require_in:
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
- mode: '0755'
|
||||||
- recurse:
|
- recurse:
|
||||||
- user
|
- user
|
||||||
- group
|
- group
|
||||||
- mode
|
- mode
|
||||||
|
{%- endif %}
|
||||||
archive.extracted:
|
archive.extracted:
|
||||||
{{- format_kwargs(p.pkg.component[name]['archive']) }}
|
{{- format_kwargs(p.pkg.component[name]['archive']) }}
|
||||||
- trim_output: true
|
- trim_output: true
|
||||||
- enforce_toplevel: false
|
- enforce_toplevel: false
|
||||||
- options: --strip-components=1
|
- options: --strip-components=1
|
||||||
|
- force: {{ p.force }}
|
||||||
- retry: {{ p.retry_option|json }}
|
- retry: {{ p.retry_option|json }}
|
||||||
- user: {{ p.identity.rootuser }}
|
|
||||||
- group: {{ p.identity.rootgroup }}
|
|
||||||
- require:
|
- require:
|
||||||
- file: prometheus-archive-install-{{ name }}
|
- file: prometheus-archive-install-{{ name }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- user: {{ p.identity.rootuser }}
|
||||||
|
- group: {{ p.identity.rootgroup }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- if p.linux.altpriority|int <= 0 or grains.os_family|lower in ('macos', 'arch') %}
|
{%- if (grains.kernel|lower == 'linux' and 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 %}
|
{%- if 'commands' in p.pkg.component[name] and p.pkg.component[name]['commands'] is iterable %}
|
||||||
{%- for cmd in p.pkg.component[name]['commands'] %}
|
{%- for cmd in p.pkg.component[name]['commands'] %}
|
||||||
|
|
||||||
@ -73,15 +82,17 @@ prometheus-archive-install-{{ name }}-file-symlink-{{ cmd }}:
|
|||||||
|
|
||||||
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 }}{{ p.div }}{{ name }}
|
||||||
|
- makedirs: True
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
- user: {{ name }}
|
- user: {{ name }}
|
||||||
- group: {{ name }}
|
- group: {{ name }}
|
||||||
- mode: '0755'
|
- mode: '0755'
|
||||||
- makedirs: True
|
|
||||||
- require:
|
- require:
|
||||||
- user: prometheus-config-user-install-{{ name }}-user-present
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
- group: prometheus-config-user-install-{{ name }}-user-present
|
- group: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
{%- if grains.kernel|lower == 'linux' %}
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
|
|
||||||
prometheus-archive-install-{{ name }}-managed-service:
|
prometheus-archive-install-{{ name }}-managed-service:
|
||||||
@ -118,6 +129,6 @@ prometheus-archive-install-{{ name }}-managed-service:
|
|||||||
- require:
|
- require:
|
||||||
- archive: prometheus-archive-install-{{ name }}
|
- archive: prometheus-archive-install-{{ name }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}{# linux #}
|
||||||
{%- endif %}
|
{%- endif %}{# service #}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -30,6 +30,7 @@ prometheus-clientlibs-install-{{ name }}:
|
|||||||
{{- format_kwargs(p.pkg.clientlibs[name]['archive']) }}
|
{{- format_kwargs(p.pkg.clientlibs[name]['archive']) }}
|
||||||
- trim_output: true
|
- trim_output: true
|
||||||
- enforce_toplevel: false
|
- enforce_toplevel: false
|
||||||
|
- force: {{ p.force }}
|
||||||
- options: --strip-components=1
|
- options: --strip-components=1
|
||||||
- retry: {{ p.retry_option|json }}
|
- retry: {{ p.retry_option|json }}
|
||||||
- user: {{ p.identity.rootuser }}
|
- user: {{ p.identity.rootuser }}
|
||||||
|
@ -12,7 +12,7 @@ include:
|
|||||||
|
|
||||||
prometheus-config-clean-{{ name }}:
|
prometheus-config-clean-{{ name }}:
|
||||||
- names:
|
- names:
|
||||||
- {{ p.dir.etc }}/{{ name }}.yml
|
- {{ p.dir.etc }}{{ d.div }}{{ name }}.yml
|
||||||
- {{ p.pkg.component[name]['environ_file'] }}
|
- {{ p.pkg.component[name]['environ_file'] }}
|
||||||
{%- if grains.os_family|lower in ('freebsd',) %}
|
{%- if grains.os_family|lower in ('freebsd',) %}
|
||||||
sysrc.absent:
|
sysrc.absent:
|
||||||
|
@ -22,11 +22,13 @@ prometheus-config-install-{{ name }}-environ_file:
|
|||||||
lookup='prometheus-config-install-' ~ name ~ '-environ_file'
|
lookup='prometheus-config-install-' ~ name ~ '-environ_file'
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
- makedirs: True
|
||||||
|
- template: jinja
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
- mode: 640
|
- mode: 640
|
||||||
- user: {{ p.identity.rootuser }}
|
- user: {{ p.identity.rootuser }}
|
||||||
- group: {{ p.identity.rootgroup }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
- makedirs: True
|
{%- endif %}
|
||||||
- template: jinja
|
|
||||||
- contents: |
|
- contents: |
|
||||||
command_args="{{ concat_environ(environ) }}"
|
command_args="{{ concat_environ(environ) }}"
|
||||||
- watch_in:
|
- watch_in:
|
||||||
|
@ -16,10 +16,12 @@ include:
|
|||||||
prometheus-config-file-etc-file-directory:
|
prometheus-config-file-etc-file-directory:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.dir.etc }}
|
- name: {{ p.dir.etc }}
|
||||||
|
- makedirs: True
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- mode: '0755'
|
||||||
- user: {{ p.identity.rootuser }}
|
- user: {{ p.identity.rootuser }}
|
||||||
- group: {{ p.identity.rootgroup }}
|
- group: {{ p.identity.rootgroup }}
|
||||||
- mode: '0755'
|
{%- endif %}
|
||||||
- makedirs: True
|
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
- sls: {{ sls_archive_install if p.pkg.use_upstream_archive else sls_package_install }}
|
||||||
|
|
||||||
@ -28,16 +30,18 @@ prometheus-config-file-etc-file-directory:
|
|||||||
|
|
||||||
prometheus-config-file-{{ name }}-file-managed:
|
prometheus-config-file-{{ name }}-file-managed:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: {{ p.dir.etc }}/{{ name }}.yml
|
- name: {{ p.dir.etc }}{{ p.div }}{{ name }}.yml
|
||||||
- source: {{ files_switch(['config.yml.jinja'],
|
- source: {{ files_switch(['config.yml.jinja'],
|
||||||
lookup='prometheus-config-file-' ~ name ~ '-file-managed'
|
lookup='prometheus-config-file-' ~ name ~ '-file-managed'
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
- makedirs: True
|
||||||
|
- template: jinja
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
- mode: 644
|
- mode: 644
|
||||||
- user: {{ name }}
|
- user: {{ name }}
|
||||||
- group: {{ name }}
|
- group: {{ name }}
|
||||||
- makedirs: True
|
{%- endif %}
|
||||||
- template: jinja
|
|
||||||
- context:
|
- context:
|
||||||
config: {{ p.pkg.component[name]['config']|json }}
|
config: {{ p.pkg.component[name]['config']|json }}
|
||||||
- require:
|
- require:
|
||||||
|
@ -13,12 +13,14 @@ prometheus-config-user-install-{{ name }}-user-present:
|
|||||||
- user: prometheus-config-user-install-{{ name }}-user-present
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
user.present:
|
user.present:
|
||||||
- name: {{ name }}
|
- name: {{ name }}
|
||||||
- shell: /bin/false
|
|
||||||
- createhome: false
|
|
||||||
- groups:
|
- groups:
|
||||||
- {{ name }}
|
- {{ name }}
|
||||||
{%- if grains.os_family == 'MacOS' %}
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- shell: /bin/false
|
||||||
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
|
- createhome: false
|
||||||
|
{%- elif 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 %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# vim: ft=yaml
|
# vim: ft=yaml
|
||||||
---
|
---
|
||||||
prometheus:
|
prometheus:
|
||||||
|
div: '/'
|
||||||
|
force: false
|
||||||
|
overwrite: true
|
||||||
wanted:
|
wanted:
|
||||||
clientlibs: []
|
clientlibs: []
|
||||||
component:
|
component:
|
||||||
|
@ -9,7 +9,6 @@ include:
|
|||||||
- {{ sls_config_users }}
|
- {{ sls_config_users }}
|
||||||
|
|
||||||
{%- set states = [] %}
|
{%- set states = [] %}
|
||||||
|
|
||||||
{%- set name = 'node_exporter' %}
|
{%- set name = 'node_exporter' %}
|
||||||
{%- if name in p.wanted.component and 'service' in p.pkg.component[name] %}
|
{%- if name in p.wanted.component and 'service' in p.pkg.component[name] %}
|
||||||
|
|
||||||
@ -17,9 +16,11 @@ include:
|
|||||||
prometheus-exporters-{{ name }}-collector-textfile-dir:
|
prometheus-exporters-{{ name }}-collector-textfile-dir:
|
||||||
file.directory:
|
file.directory:
|
||||||
- name: {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
- name: {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
- mode: 755
|
- mode: 755
|
||||||
- user: {{ name }}
|
- user: {{ name }}
|
||||||
- group: {{ name }}
|
- group: {{ name }}
|
||||||
|
{%- endif %}
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
- requre:
|
- requre:
|
||||||
- user: prometheus-config-user-install-{{ name }}-user-present
|
- user: prometheus-config-user-install-{{ name }}-user-present
|
||||||
|
@ -10,7 +10,7 @@ prometheus-exporters-clean-{{ name }}-textfile_collectors-ipmitool:
|
|||||||
- name: {{ p.exporters[name]['textfile_collectors']['ipmitool']['pkg'] }}
|
- name: {{ p.exporters[name]['textfile_collectors']['ipmitool']['pkg'] }}
|
||||||
file.absent:
|
file.absent:
|
||||||
- names:
|
- names:
|
||||||
- {{ p.dir.archive ~ '/textfile_collectors/ipmitool' }}
|
- {{ p.dir.archive ~ p.div ~ 'textfile_collectors' ~ p.div ~ 'ipmitool' }}
|
||||||
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}/ipmitool.prom
|
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}{{ p.div }}ipmitool.prom
|
||||||
cron.absent:
|
cron.absent:
|
||||||
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-ipmitool-cronjob
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-ipmitool-cronjob
|
||||||
|
@ -1,26 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
include:
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
- .install
|
||||||
|
|
||||||
{%- 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,28 @@
|
|||||||
|
# -*- 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
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- mode: 755
|
||||||
|
{%- endif %}
|
||||||
|
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
|
@ -10,7 +10,7 @@ prometheus-exporters-clean-{{ name }}-textfile_collectors-smartmon:
|
|||||||
- name: {{ p.exporters[name]['textfile_collectors']['smartmon']['pkg'] }}
|
- name: {{ p.exporters[name]['textfile_collectors']['smartmon']['pkg'] }}
|
||||||
file.absent:
|
file.absent:
|
||||||
- names:
|
- names:
|
||||||
- {{ p.dir.archive ~ '/textfile_collectors/smartmon.sh' }}
|
- {{ p.dir.archive ~ p.div ~ 'textfile_collectors' ~ p.div ~ 'smartmon.sh' }}
|
||||||
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}/smartmon.prom
|
- {{ p.pkg.component[name]['service']['args']['collector.textfile.directory'] }}{{ p.div }}smartmon.prom
|
||||||
cron.absent:
|
cron.absent:
|
||||||
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-smartmon-cronjob
|
- identifier: prometheus-exporters-{{ name }}-textfile_collectors-smartmon-cronjob
|
||||||
|
@ -1,30 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
include:
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus with context %}
|
- .install
|
||||||
|
|
||||||
{%- 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
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
# -*- 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 }}
|
||||||
|
{%- if grains.os != 'Windows' %}
|
||||||
|
- mode: 755
|
||||||
|
{%- endif %}
|
||||||
|
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
|
@ -301,9 +301,14 @@ OpenBSD:
|
|||||||
Solaris: {}
|
Solaris: {}
|
||||||
|
|
||||||
Windows:
|
Windows:
|
||||||
|
div: '\\'
|
||||||
kernel: windows
|
kernel: windows
|
||||||
dir:
|
dir:
|
||||||
opt: C:\\Program Files
|
archive: C:\\prometheus
|
||||||
|
etc: C:\\prometheus\\etc
|
||||||
|
tmp: C:\\temp\\prometheus-salt-tmp
|
||||||
|
var: C:\\prometheus\var
|
||||||
|
|
||||||
pkg:
|
pkg:
|
||||||
component:
|
component:
|
||||||
prometheus:
|
prometheus:
|
||||||
@ -338,6 +343,7 @@ Windows:
|
|||||||
source_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
source_hash: 9362b7482e74792f111c4bb1a372b18a88f6354c78f24713bacfbcb050883556
|
||||||
|
|
||||||
MacOS:
|
MacOS:
|
||||||
|
div: '/'
|
||||||
dir:
|
dir:
|
||||||
default: /etc/defaults
|
default: /etc/defaults
|
||||||
identity:
|
identity:
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- if grains.os_family|lower == 'redhat' %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %}
|
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %}
|
||||||
|
|
||||||
@ -11,3 +12,4 @@ prometheus-package-repo-clean-pkgrepo-managed:
|
|||||||
- name: {{ p.pkg['repo']['name'] }}
|
- name: {{ p.pkg['repo']['name'] }}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- endif %}
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{%- if grains.os_family == 'RedHat' %}
|
{%- if grains.os_family == 'RedHat' %}
|
||||||
|
{%- set tplroot = tpldir.split('/')[0] %}
|
||||||
|
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
||||||
|
|
||||||
{%- set tplroot = tpldir.split('/')[0] %}
|
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %}
|
||||||
{%- from tplroot ~ "/map.jinja" import prometheus as p with context %}
|
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
|
||||||
|
|
||||||
{%- if p.pkg.use_upstream_repo and 'repo' in p.pkg and p.pkg.repo %}
|
|
||||||
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
|
|
||||||
|
|
||||||
prometheus-package-repo-install-pkgrepo-managed:
|
prometheus-package-repo-install-pkgrepo-managed:
|
||||||
pkgrepo.managed:
|
pkgrepo.managed:
|
||||||
@ -18,8 +17,8 @@ prometheus-package-repo-install-pkgrepo-managed:
|
|||||||
- pattern: ' gpgkey2='
|
- pattern: ' gpgkey2='
|
||||||
- repl: '\n '
|
- repl: '\n '
|
||||||
- ignore_if_missing: True
|
- ignore_if_missing: True
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
{%- else %}
|
{%- else %}
|
||||||
|
|
||||||
prometheus-package-repo-install-pkgrepo-managed:
|
prometheus-package-repo-install-pkgrepo-managed:
|
||||||
|
@ -16,7 +16,7 @@ prometheus-service-clean-{{ name }}:
|
|||||||
- 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: {{ p.dir.service }}/{{ name }}.service
|
- name: {{ p.dir.service }}{{ p.div }}{{ name }}.service
|
||||||
- require:
|
- require:
|
||||||
- service: prometheus-service-clean-{{ name }}
|
- service: prometheus-service-clean-{{ name }}
|
||||||
cmd.run:
|
cmd.run:
|
||||||
|
@ -14,39 +14,40 @@ include:
|
|||||||
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
{%- if 'service' in p.pkg.component[name] and p.pkg.component[name]['service'] %}
|
||||||
{%- set service_name = p.pkg.component[name]['service'].get('name', name) %}
|
{%- set service_name = p.pkg.component[name]['service'].get('name', name) %}
|
||||||
|
|
||||||
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
prometheus-service-running-{{ name }}-unmasked:
|
prometheus-service-running-{{ name }}-unmasked:
|
||||||
service.unmasked:
|
service.unmasked:
|
||||||
- name: {{ service_name }}
|
- name: {{ service_name }}
|
||||||
- onlyif:
|
- onlyif: systemctl list-unit-files | grep {{ service_name }} >/dev/null 2>&1
|
||||||
- {{ grains.kernel|lower == 'linux' }}
|
|
||||||
- systemctl list-unit-files | grep {{ service_name }} >/dev/null 2>&1
|
|
||||||
- require_in:
|
- require_in:
|
||||||
- service: prometheus-service-running-{{ name }}
|
- service: prometheus-service-running-{{ name }}
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_config_file }}
|
- sls: {{ sls_config_file }}
|
||||||
- file: prometheus-config-file-etc-file-directory
|
- file: prometheus-config-file-etc-file-directory
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
prometheus-service-running-{{ name }}:
|
prometheus-service-running-{{ name }}:
|
||||||
{%- if p.wanted.firewall and grains.kernel|lower == 'linux' %}
|
{%- if grains.kernel|lower == 'linux' and p.wanted.firewall %}
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- name: firewalld
|
- name: firewalld
|
||||||
- reload_modules: true
|
- reload_modules: true
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
service.running:
|
service.running:
|
||||||
- onlyif: systemctl list-unit-files | grep {{ service_name }} >/dev/null 2>&1
|
- names:
|
||||||
|
- {{ service_name }}
|
||||||
- enable: True
|
- enable: True
|
||||||
- require:
|
- require:
|
||||||
- sls: {{ sls_config_file }}
|
- sls: {{ sls_config_file }}
|
||||||
- names:
|
{%- if grains.kernel|lower == 'linux' %}
|
||||||
- {{ service_name }}
|
- onlyif: systemctl list-unit-files | grep {{ service_name }} >/dev/null 2>&1
|
||||||
{%- if p.wanted.firewall and grains.kernel|lower == 'linux' %}
|
{%- if p.wanted.firewall %}
|
||||||
- firewalld
|
- firewalld
|
||||||
firewalld.present:
|
firewalld.present:
|
||||||
- name: public
|
- name: public
|
||||||
- ports: {{ p.pkg.component[name]['firewall']['ports']|json }}
|
- ports: {{ p.pkg.component[name]['firewall']['ports']|json }}
|
||||||
- require:
|
- require:
|
||||||
- service: prometheus-service-running-{{ name }}
|
- service: prometheus-service-running-{{ name }}
|
||||||
|
{%- endif %}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user