From 56472a5d1ffd53c1e9c552d05eea31ee5a6bae09 Mon Sep 17 00:00:00 2001 From: Michael Schlenstedt Date: Sat, 22 Oct 2022 17:01:43 +0200 Subject: [PATCH] Bugfix systemd files; exclude important system config files from restoring when updating; fix grafana version --- config/grafana/grafana.ini | 26 ++++++++++++----------- config/systemd/00-stats4lox-grafana.conf | 2 +- config/systemd/00-stats4lox-telegraf.conf | 2 +- plugin.cfg | 2 +- postroot.sh | 2 +- preroot.sh | 12 +++++++++-- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/config/grafana/grafana.ini b/config/grafana/grafana.ini index f1020c1..c1fee87 100644 --- a/config/grafana/grafana.ini +++ b/config/grafana/grafana.ini @@ -18,7 +18,8 @@ data = REPLACELBPDATADIR/grafana temp_data_lifetime = 24h # Directory where grafana can store logs -logs = REPLACELBPDATADIR/grafana +#logs = REPLACELBPDATADIR/grafana +logs = /var/log/grafana # Directory where grafana will automatically scan and look for plugins plugins = /var/lib/grafana/plugins @@ -540,7 +541,7 @@ org_role = Admin ;mode = console file # Either "debug", "info", "warn", "error", "critical", default is "info" -level = error +level = info # optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug ;filters = @@ -554,38 +555,39 @@ level = error # For "file" mode only [log.file] -;level = +level = info # log line format, valid options are text, console and json -;format = text +format = text # This enables automated log rotate(switch of following options), default is true -;log_rotate = true +log_rotate = true # Max line number of single file, default is 1000000 -;max_lines = 1000000 +max_lines = 1000000 # Max size shift of single file, default is 28 means 1 << 28, 256MB -;max_size_shift = 28 +# 22 means ~ 4 MB +max_size_shift = 22 # Segment log daily, default is true -;daily_rotate = true +daily_rotate = true # Expired days of log file(delete after max days), default is 7 -;max_days = 7 +max_days = 2 [log.syslog] -;level = +level = error # log line format, valid options are text, console and json -;format = text +format = text # Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used. ;network = ;address = # Syslog facility. user, daemon and local0 through local7 are valid. -;facility = +facility = daemon # Syslog tag. By default, the process' argv[0] is used. ;tag = diff --git a/config/systemd/00-stats4lox-grafana.conf b/config/systemd/00-stats4lox-grafana.conf index 8415488..2237328 100644 --- a/config/systemd/00-stats4lox-grafana.conf +++ b/config/systemd/00-stats4lox-grafana.conf @@ -1,3 +1,3 @@ [Service] StandardError=null -StandardOutput=null \ No newline at end of file +StandardOutput=null diff --git a/config/systemd/00-stats4lox-telegraf.conf b/config/systemd/00-stats4lox-telegraf.conf index 8415488..2237328 100644 --- a/config/systemd/00-stats4lox-telegraf.conf +++ b/config/systemd/00-stats4lox-telegraf.conf @@ -1,3 +1,3 @@ [Service] StandardError=null -StandardOutput=null \ No newline at end of file +StandardOutput=null diff --git a/plugin.cfg b/plugin.cfg index 40b2b2d..983d537 100644 --- a/plugin.cfg +++ b/plugin.cfg @@ -11,7 +11,7 @@ EMAIL=Michael@loxberry.de # The version of your plugin - important if you would like to write an # upgrade script. Use a correct syntax, which is supported by LoxBerry: # More info: http://www.loxwiki.eu/x/LYG3AQ -VERSION=0.9.7 +VERSION=0.9.8 # Short name and prefered subfolder of your Plugin (do not use blanks - they # will be filtered - and use lowercase only)! Used for script names in diff --git a/postroot.sh b/postroot.sh index 9cf95e7..350634d 100755 --- a/postroot.sh +++ b/postroot.sh @@ -100,7 +100,7 @@ if [ -d $LBHOMEDIR/data/plugins/$PTEMPDIR\_upgrade ]; then # Config if [ -n "$(ls -A "$LBHOMEDIR/data/plugins/${PTEMPDIR}_upgrade/config/" 2>/dev/null)" ]; then chown -R loxberry:loxberry $PCONFIG - rsync -Iav $LBHOMEDIR/data/plugins/${PTEMPDIR}_upgrade/config/* $PCONFIG/ + rsync -Iav --exclude "systemd/*" --exclude "sysctl.conf" $LBHOMEDIR/data/plugins/${PTEMPDIR}_upgrade/config/* $PCONFIG/ if [ $? -ne 0 ]; then echo " Restoring config files failed. Giving up." #pause 'Press [Enter] key to continue...' diff --git a/preroot.sh b/preroot.sh index c0d4b9a..5a22a36 100755 --- a/preroot.sh +++ b/preroot.sh @@ -41,11 +41,19 @@ wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add - 2>/dev/ source /etc/os-release echo "deb https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list -echo " Using Influx Version 1.8.9..." +echo " Using Influx Version 1.8.x..." rm -f /etc/apt/preferences.d/influxdb cat <> /etc/apt/preferences.d/influxdb Package: influxdb -Pin: version 1.* +Pin: version 1.8.* +Pin-Priority: 1000 +EOT + +echo " Using Grafana Version 9.2.x..." +rm -f /etc/apt/preferences.d/grafana +cat <> /etc/apt/preferences.d/grafana +Package: grafana +Pin: version 9.2.* Pin-Priority: 1000 EOT