Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
InFluxDB
#10
Ich habe mir ein Skript geschrieben, das alte Monitor-Daten rotiert.

Code:
#!/bin/bash

BIN_MV="/bin/mv"
BIN_RM="/bin/rm"
BIN_ECHO="/bin/echo"
BIN_SERVICE="/usr/sbin/service"

MONITOR_KEEP="7"  # number of monitor dirs to keep

if [ "$(id -u)" -ne 0 ]; then
   ${BIN_ECHO} "you are not root"
   exit 1
fi

# stopping services
${BIN_ECHO} -n "stopping services ... "
${BIN_SERVICE} influxdb stop
${BIN_ECHO} "done"

${BIN_ECHO} -n "moving internal monitor files ... "
${BIN_MV} /var/lib/influxdb/wal/_internal/monitor /var/lib/influxdb/wal/_internal/monitor_$(date +%Y%m%d-%H%M%S)
${BIN_ECHO} "done"

${BIN_ECHO} -n "removing old monitor dirs ... "
for monitor in $(ls -dtr /var/lib/influxdb/wal/_internal/monitor_* | head -n -${MONITOR_KEEP}); do
   ${BIN_RM} -r ${monitor}
done
${BIN_ECHO} "done"

# starting services
${BIN_ECHO} -n "starting services ... "
${BIN_SERVICE} influxdb start
${BIN_ECHO} "done"
Reply


Messages In This Thread
InFluxDB - by Gelbeseiten - 11.08.2022, 14:54
RE: InFluxDB - by sysop - 31.08.2022, 09:15
RE: InFluxDB - by Olli-HB - 31.08.2022, 15:23
RE: InFluxDB - by Gelbeseiten - 31.08.2022, 16:04
RE: InFluxDB - by Gelbeseiten - 11.09.2022, 20:23
RE: InFluxDB - by sysop - 19.09.2022, 09:09
RE: InFluxDB - by Olli-HB - 14.12.2022, 10:44
RE: InFluxDB - by Andi - 09.01.2023, 09:08
RE: InFluxDB - by Olli-HB - 15.02.2023, 22:21
RE: InFluxDB - by daniel.pernold - 28.02.2023, 22:49

Forum Jump:


Users browsing this thread: 2 Guest(s)