create and manage metrics_link in a file for soc

This commit is contained in:
m0duspwnens
2023-02-28 14:47:44 -05:00
parent ff495cb20e
commit 052e0dea2e
3 changed files with 9 additions and 7 deletions

View File

@@ -117,6 +117,14 @@ influxdb-setup:
- file: influxdb_curl_config
- docker_container: so-influxdb
metrics_link_file:
file.managed:
- name: /opt/so/saltstack/local/salt/influxdb/metrics_link.txt
- contents: {{ salt['cmd.run']('so-influxdb-manage dashboardpath "Security Onion Performance"') }}
- require:
- docker_container: so-influxdb
- cmd: influxdb-setup
# Install cron job to determine size of influxdb for telegraf
get_influxdb_size:
cron.present:

View File

View File

@@ -2,13 +2,7 @@
{% from 'vars/globals.map.jinja' import GLOBALS %}
{% from 'docker/docker.map.jinja' import DOCKER -%}
{% set INFLUXDB_TOKEN = salt['pillar.get']('secrets:influx_token') %}
{% set METRICS_LINK = '' %}
{% if salt['docker.exists']('so-influxdb') %}
{% if salt['docker.pid']('so-influxdb') > 0 %}
{% set METRICS_LINK = salt['cmd.run']('so-influxdb-manage dashboardpath "Security Onion Performance"') %}
{% endif %}
{% endif %}
{% import_text 'influxdb/metrics_link.txt' as METRICS_LINK %}
{% for module, application_url in GLOBALS.application_urls.items() %}
{% do SOCDEFAULTS.soc.server.modules[module].update({'hostUrl': application_url}) %}