mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +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:
|
# ## more about them here:
|
||||||
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
||||||
# data_format = "influx"
|
# data_format = "influx"
|
||||||
{% if salt['pillar.get']('healthcheck:enabled', 'False') %}
|
{%- if salt['pillar.get']('healthcheck:enabled', 'False') %}
|
||||||
[[inputs.file]]
|
[[inputs.file]]
|
||||||
files = ["/host/nsm/zeek/logs/zeek_restart.log"]
|
files = ["/host/nsm/zeek/logs/zeek_restart.log"]
|
||||||
data_format = "influx"
|
data_format = "influx"
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if grains.role in ['so-manager', 'so-managersearch', 'so-standalone', 'so-eval'] %}
|
|
||||||
[[inputs.file]]
|
[[inputs.file]]
|
||||||
files = ["/etc/telegraf/nodes_config.json"]
|
files = ["/etc/telegraf/node_config.json"]
|
||||||
name_override = "nodes_config"
|
name_override = "node_config"
|
||||||
data_format = "json"
|
data_format = "json"
|
||||||
interval = "5m"
|
interval = "5m"
|
||||||
{% endif %}
|
json_string_fields = ['manint', 'monint']
|
||||||
|
tag_keys = ['role']
|
||||||
|
|
||||||
# # Count files in a directory
|
# # Count files in a directory
|
||||||
# [[inputs.filecount]]
|
# [[inputs.filecount]]
|
||||||
|
|||||||
@@ -42,15 +42,13 @@ tgrafconf:
|
|||||||
- template: jinja
|
- template: jinja
|
||||||
- source: salt://telegraf/etc/telegraf.conf
|
- 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)
|
#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
|
# into influx so that grafan can build dashboards using queries
|
||||||
node_tab:
|
node_config:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /opt/so/conf/telegraf/nodes_config.json
|
- name: /opt/so/conf/telegraf/node_config.json
|
||||||
- source: salt://telegraf/nodes_config.json.jinja
|
- source: salt://telegraf/node_config.json.jinja
|
||||||
- template: jinja
|
- template: jinja
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
so-telegraf:
|
so-telegraf:
|
||||||
docker_container.running:
|
docker_container.running:
|
||||||
@@ -66,9 +64,7 @@ so-telegraf:
|
|||||||
- binds:
|
- binds:
|
||||||
- /opt/so/log/telegraf:/var/log/telegraf:rw
|
- /opt/so/log/telegraf:/var/log/telegraf:rw
|
||||||
- /opt/so/conf/telegraf/etc/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
- /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/node_config.json:/etc/telegraf/node_config.json:ro
|
||||||
- /opt/so/conf/telegraf/nodes_config.json:/etc/telegraf/nodes_config.json:ro
|
|
||||||
{% endif %}
|
|
||||||
- /var/run/utmp:/var/run/utmp:ro
|
- /var/run/utmp:/var/run/utmp:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
- /:/host/root:ro
|
- /:/host/root:ro
|
||||||
@@ -91,6 +87,7 @@ so-telegraf:
|
|||||||
- watch:
|
- watch:
|
||||||
- file: tgrafconf
|
- file: tgrafconf
|
||||||
- file: tgrafsyncscripts
|
- file: tgrafsyncscripts
|
||||||
|
- file: node_config
|
||||||
|
|
||||||
append_so-telegraf_so-status.conf:
|
append_so-telegraf_so-status.conf:
|
||||||
file.append:
|
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