icinga wip

This commit is contained in:
2025-05-05 01:07:57 -04:00
parent 393d52595f
commit 1726c412ce
2 changed files with 17 additions and 13 deletions

View File

@@ -1,35 +1,39 @@
# A deploy key must be added for this to work!
/usr/local/lib/nagios:
{% set git_dir = '/usr/local/lib/icinga' %}
{% set venv_dir = '%s/venv' | format(git_dir) %}
{{ git_dir }}:
git.cloned:
- name: {{ salt.pillar.get("icinga2:monitoring_plugins_git_url") | yaml_encode }}
- target: /usr/local/lib/nagios
- target: {{ git_dir }}
- branch: master
- user: root
/usr/local/lib/nagios/venv:
{{ venv_dir }}:
cmd.run:
{% if 'inmotionhosting' in grains.fqdn %}
- name: imh-python3 -m venv /usr/local/lib/nagios/venv
- name: imh-python3 -m venv {{ venv_dir }}
{% else %}
- name: python3 -m venv /usr/local/lib/nagios/venv
- name: python3 -m venv {{ venv_dir }}
{% endif %}
- creates: /usr/local/lib/nagios/venv
- creates: {{ venv_dir }}
- require:
- git: /usr/local/lib/nagios
- git: {{ git_dir }}
- pkg: monitoring_packages
venv-ensurepip:
cmd.run:
- name: /usr/local/lib/nagios/venv/bin/python3 -m ensurepip
- creates: /usr/local/lib/nagios/venv/bin/pip3
- name: {{ venv_dir }}/bin/python3 -m ensurepip
- creates: {{ venv_dir }}/bin/pip3
- require:
- cmd: /usr/local/lib/nagios/venv
- cmd: {{ venv_dir }}
{#
venv-psutil:
cmd.run:
- name: /usr/local/lib/nagios/venv/bin/pip3 install psutil
- unless: /usr/local/lib/nagios/venv/bin/pip3 freeze | grep -q '^psutil='
- name: {{ venv_dir }}/bin/pip3 install psutil
- unless: {{ venv_dir }}/bin/pip3 freeze | grep -q '^psutil='
- require:
- cmd: venv-ensurepip
#}