mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
upgrade influx
This commit is contained in:
20
salt/common/tools/sbin/so-grafana-dashboard-folder-delete
Normal file
20
salt/common/tools/sbin/so-grafana-dashboard-folder-delete
Normal file
@@ -0,0 +1,20 @@
|
||||
# this script is used to delete the default Grafana dashboard folders that existed prior to Grafana dashboard and Salt management changes in 2.3.70
|
||||
|
||||
# Exit if an error occurs. The next highstate will retry.
|
||||
set -e
|
||||
|
||||
folders=$(curl -X GET http://admin:{{salt['pillar.get']('secrets:grafana_admin')}}@localhost:3000/api/folders | jq -r '.[] | @base64')
|
||||
delfolder=("Manager" "Manager Search" "Sensor Nodes" "Search Nodes" "Standalone" "Eval Mode")
|
||||
|
||||
for row in $folders; do
|
||||
title=$(echo ${row} | base64 --decode | jq -r '.title')
|
||||
uid=$(echo ${row} | base64 --decode | jq -r '.uid')
|
||||
|
||||
if [[ " ${delfolder[@]} " =~ " ${title} " ]]; then
|
||||
curl -X DELETE http://admin:{{salt['pillar.get']('secrets:grafana_admin')}}@localhost:3000/api/folders/$uid
|
||||
fi
|
||||
done
|
||||
|
||||
echo "so-grafana-dashboard-folder-delete has been run to delete default Grafana dashboard folders that existed prior to 2.3.70" > /opt/so/state/so-grafana-dashboard-folder-delete-complete
|
||||
|
||||
exit 0
|
||||
12
salt/common/tools/sbin/so-grafana-restart
Normal file
12
salt/common/tools/sbin/so-grafana-restart
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
||||
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
||||
# https://securityonion.net/license; you may not use this file except in compliance with the
|
||||
# Elastic License 2.0.
|
||||
|
||||
|
||||
|
||||
. /usr/sbin/so-common
|
||||
|
||||
/usr/sbin/so-restart grafana $1
|
||||
12
salt/common/tools/sbin/so-grafana-start
Normal file
12
salt/common/tools/sbin/so-grafana-start
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
||||
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
||||
# https://securityonion.net/license; you may not use this file except in compliance with the
|
||||
# Elastic License 2.0.
|
||||
|
||||
|
||||
|
||||
. /usr/sbin/so-common
|
||||
|
||||
/usr/sbin/so-start grafana $1
|
||||
12
salt/common/tools/sbin/so-grafana-stop
Normal file
12
salt/common/tools/sbin/so-grafana-stop
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
||||
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
||||
# https://securityonion.net/license; you may not use this file except in compliance with the
|
||||
# Elastic License 2.0.
|
||||
|
||||
|
||||
|
||||
. /usr/sbin/so-common
|
||||
|
||||
/usr/sbin/so-stop grafana $1
|
||||
9
salt/influxdb/map.jinja
Normal file
9
salt/influxdb/map.jinja
Normal file
@@ -0,0 +1,9 @@
|
||||
{% import_yaml 'influxdb/defaults.yaml' as INFLUXDB %}
|
||||
{% set measurements = salt['cmd.shell']('docker exec -t so-influxdb influx -format json -ssl -unsafeSsl -database telegraf -execute "show measurements" 2> /root/measurement_query.log | jq -r .results[0].series[0].values[]?[0] 2>> /root/measurement_query.log', shell='/bin/bash') %}
|
||||
|
||||
{% if measurements|length > 0 %}
|
||||
{% do INFLUXDB.influxdb.downsample.so_long_term.update('measurements': [])%}
|
||||
{% for measurement in measurements.splitlines() %}
|
||||
{% do INFLUXDB.influxdb.downsample.so_long_term.measurements.append(measurement)%}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user