mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
create node_config measurement for nodes to be used for grafana dashboard vars
This commit is contained in:
@@ -832,19 +832,18 @@
|
||||
# ## more about them here:
|
||||
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
||||
# data_format = "influx"
|
||||
{% if salt['pillar.get']('healthcheck:enabled', 'False') %}
|
||||
{%- if salt['pillar.get']('healthcheck:enabled', 'False') %}
|
||||
[[inputs.file]]
|
||||
files = ["/host/nsm/zeek/logs/zeek_restart.log"]
|
||||
data_format = "influx"
|
||||
{% endif %}
|
||||
{% if grains.role in ['so-manager', 'so-managersearch', 'so-standalone', 'so-eval'] %}
|
||||
{%- endif %}
|
||||
[[inputs.file]]
|
||||
files = ["/etc/telegraf/nodes_config.json"]
|
||||
name_override = "nodes_config"
|
||||
files = ["/etc/telegraf/node_config.json"]
|
||||
name_override = "node_config"
|
||||
data_format = "json"
|
||||
interval = "5m"
|
||||
{% endif %}
|
||||
|
||||
json_string_fields = ['manint', 'monint']
|
||||
tag_keys = ['role']
|
||||
|
||||
# # Count files in a directory
|
||||
# [[inputs.filecount]]
|
||||
|
||||
@@ -42,15 +42,13 @@ tgrafconf:
|
||||
- template: jinja
|
||||
- source: salt://telegraf/etc/telegraf.conf
|
||||
|
||||
{% if grains.role in ['so-manager', 'so-managersearch', 'so-standalone', 'so-eval'] %}
|
||||
#this file will be read by telegraf to send node details(management interface, monitor interface, etc)
|
||||
# into influx so that grafan can build dashboards using queries
|
||||
node_tab:
|
||||
node_config:
|
||||
file.managed:
|
||||
- name: /opt/so/conf/telegraf/nodes_config.json
|
||||
- source: salt://telegraf/nodes_config.json.jinja
|
||||
- name: /opt/so/conf/telegraf/node_config.json
|
||||
- source: salt://telegraf/node_config.json.jinja
|
||||
- template: jinja
|
||||
{% endif %}
|
||||
|
||||
so-telegraf:
|
||||
docker_container.running:
|
||||
@@ -66,9 +64,7 @@ so-telegraf:
|
||||
- binds:
|
||||
- /opt/so/log/telegraf:/var/log/telegraf:rw
|
||||
- /opt/so/conf/telegraf/etc/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
{% if grains.role in ['so-manager', 'so-managersearch', 'so-standalone', 'so-eval'] %}
|
||||
- /opt/so/conf/telegraf/nodes_config.json:/etc/telegraf/nodes_config.json:ro
|
||||
{% endif %}
|
||||
- /opt/so/conf/telegraf/node_config.json:/etc/telegraf/node_config.json:ro
|
||||
- /var/run/utmp:/var/run/utmp:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- /:/host/root:ro
|
||||
@@ -91,6 +87,7 @@ so-telegraf:
|
||||
- watch:
|
||||
- file: tgrafconf
|
||||
- file: tgrafsyncscripts
|
||||
- file: node_config
|
||||
|
||||
append_so-telegraf_so-status.conf:
|
||||
file.append:
|
||||
|
||||
7
salt/telegraf/node_config.json.jinja
Normal file
7
salt/telegraf/node_config.json.jinja
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"role": "{{ grains.id.split('_') | last }}",
|
||||
"manint": "{{ salt['pillar.get']('host:mainint', '') }}",
|
||||
{%- if grains.role in ['so-standalone', 'so-eval', 'so-sensor', 'so-heavynode', ] %}
|
||||
"monint": "{{ salt['pillar.get']('sensor:interface', '') }}"
|
||||
{% endif -%}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{% for tabtype in ['managertab', 'managersearchtab', 'standalonetab', 'sensorstab', 'nodestab', 'evaltab'] %}
|
||||
{% set node_type_data = salt['pillar.get'](tabtype, False) %}
|
||||
{% if node_type_data %}
|
||||
{{ node_type_data | json }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
Reference in New Issue
Block a user