mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 18:22:47 +01:00
add ability to set title for dashboards, only create dashboards/dirs if that node type exists
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"description": "{{NODETYPE}}",
|
"description": "{{TITLE}}",
|
||||||
"editable": true,
|
"editable": true,
|
||||||
"gnetId": null,
|
"gnetId": null,
|
||||||
"graphTooltip": 0,
|
"graphTooltip": 0,
|
||||||
@@ -53,8 +53,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"timezone": "browser",
|
"timezone": "browser",
|
||||||
"title": "{{ NODETYPE }}",
|
"title": "{{ TITLE }}",
|
||||||
{% if NODETYPE | lower in 'overview' %}
|
{% if TITLE | lower == 'security onion grid overview' %}
|
||||||
"uid": "so_overview",
|
"uid": "so_overview",
|
||||||
{% endif %}
|
{% endif %}
|
||||||
"version": 1
|
"version": 1
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ grafana:
|
|||||||
# license_path: /opt/so/conf/grafana/etc/files/license.jwt
|
# license_path: /opt/so/conf/grafana/etc/files/license.jwt
|
||||||
dashboards:
|
dashboards:
|
||||||
overview:
|
overview:
|
||||||
|
title: 'Security Onion Grid Overview'
|
||||||
templating:
|
templating:
|
||||||
list:
|
list:
|
||||||
- role
|
- role
|
||||||
|
|||||||
@@ -10,15 +10,17 @@
|
|||||||
{% import_yaml 'grafana/defaults.yaml' as default_settings %}
|
{% import_yaml 'grafana/defaults.yaml' as default_settings %}
|
||||||
{% set GRAFANA_SETTINGS = salt['grains.filter_by'](default_settings, default='grafana', merge=salt['pillar.get']('grafana', {})) %}
|
{% set GRAFANA_SETTINGS = salt['grains.filter_by'](default_settings, default='grafana', merge=salt['pillar.get']('grafana', {})) %}
|
||||||
|
|
||||||
{% if grains.role == 'so-eval' %}
|
|
||||||
{% set nodeTypes = ['eval'] %}
|
|
||||||
{% else %}
|
|
||||||
{#% set nodeTypes = ['standalone', 'manager', 'managersearch', 'sensortab', 'searchnode'] %#}
|
|
||||||
{% set nodeTypes = ['overview', 'standalone', 'sensor', 'searchnode', 'manager', 'managersearch', 'heavynode', 'eval' ] %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if grains['role'] in ['so-manager', 'so-managersearch', 'so-standalone'] or (grains.role == 'so-eval' and GRAFANA == 1) %}
|
{% if grains['role'] in ['so-manager', 'so-managersearch', 'so-standalone'] or (grains.role == 'so-eval' and GRAFANA == 1) %}
|
||||||
|
|
||||||
|
{% set DASHBOARDS = ['overview' %}
|
||||||
|
{% if grains.role == 'so-eval' %}
|
||||||
|
{% do DASHBOARDS.append('eval') %}
|
||||||
|
{% else %}
|
||||||
|
{% for dashboard in salt['cmd.run']("ls /opt/so/saltstack/local/pillar/minions/|awk -F'_' {'print $2'}|awk -F'.' {'print $1'}|uniq") %}
|
||||||
|
{% do DASHBOARDS.append(dashboard) %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Grafana all the things
|
# Grafana all the things
|
||||||
grafanadir:
|
grafanadir:
|
||||||
file.directory:
|
file.directory:
|
||||||
@@ -79,18 +81,18 @@ grafana-config-files:
|
|||||||
- source: salt://grafana/etc/files
|
- source: salt://grafana/etc/files
|
||||||
- makedirs: True
|
- makedirs: True
|
||||||
|
|
||||||
{% for nodeType in nodeTypes %}
|
{% for dashboard in DASHBOARDS %}
|
||||||
{{nodeType}}-dashboard:
|
{{dashboard}}-dashboard:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: /opt/so/conf/grafana/grafana_dashboards/{{nodeType}}.json
|
- name: /opt/so/conf/grafana/grafana_dashboards/{{dashboard}}.json
|
||||||
- user: 939
|
- user: 939
|
||||||
- group: 939
|
- group: 939
|
||||||
- template: jinja
|
- template: jinja
|
||||||
- source: salt://grafana/dashboards/common_template.json.jinja
|
- source: salt://grafana/dashboards/common_template.json.jinja
|
||||||
- defaults:
|
- defaults:
|
||||||
PANELS: {{GRAFANA_SETTINGS.dashboards[nodeType].panels}}
|
PANELS: {{GRAFANA_SETTINGS.dashboards[dashboard].panels}}
|
||||||
TEMPLATES: {{GRAFANA_SETTINGS.dashboards[nodeType].templating.list}}
|
TEMPLATES: {{GRAFANA_SETTINGS.dashboards[dashboard].templating.list}}
|
||||||
NODETYPE: {{ nodeType | capitalize }}
|
TITLE: {{ GRAFANA_SETTINGS.dashboards[dashboard].get('title', dashboard| capitalize) }}
|
||||||
ID: {{ loop.index }}
|
ID: {{ loop.index }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user