Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias K <6317548+theCalcaholic@users.noreply.github.com>2022-03-29 02:34:46 +0300
committerTobias K <6317548+theCalcaholic@users.noreply.github.com>2022-03-29 02:36:29 +0300
commitc9009eb583882981a779a5b994622c6619c3e690 (patch)
tree40a16dbd9e1383390286dc0ced83acb58bf812d5
parent384a35779386ade636018dc12e446faf4f58326a (diff)
metrics.sh: Prevent installation in debian 10 dockerfeature/custom-prometheus-exporter
Signed-off-by: Tobias K <6317548+theCalcaholic@users.noreply.github.com>
-rw-r--r--bin/ncp/SYSTEM/metrics.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/bin/ncp/SYSTEM/metrics.sh b/bin/ncp/SYSTEM/metrics.sh
index 0cc1d53c..7674d01f 100644
--- a/bin/ncp/SYSTEM/metrics.sh
+++ b/bin/ncp/SYSTEM/metrics.sh
@@ -1,6 +1,13 @@
#!/bin/bash
+is_supported() {
+ [[ "$DOCKERBUILD" == 1 ]] && [[ "$(lsb_release -r)" =~ .*10 ]] && return 1
+ return 0
+}
+
is_active() {
+ is_supported || return 1
+
metrics_services status > /dev/null 2>&1 || return 1
# systemctl is-active -q prometheus-node-exporter || return 1
return 0
@@ -15,6 +22,8 @@ tmpl_metrics_enabled() {
}
reload_metrics_config() {
+ is_supported || return 0
+
install_template ncp-metrics.cfg.sh "/usr/local/etc/ncp-metrics.cfg" || {
echo "ERROR while generating ncp-metrics.conf!"
return 1
@@ -64,6 +73,12 @@ install() {
(
set -e
+
+ is_supported || {
+ echo -e "Metrics app is not supported in debian 10 docker containers. Installation will be skipped."
+ return 0
+ }
+
cat > /etc/default/prometheus-node-exporter <<'EOF'
ARGS="--collector.filesystem.ignored-mount-points=\"^/(dev|proc|run|sys|mnt|var/log|var/lib/docker)($|/)\""
EOF
@@ -192,6 +207,12 @@ configure() {
metrics_services stop
echo "done."
else
+
+ is_supported || {
+ echo -e "Metrics app is not supported in debian 10 docker containers. Terminating..."
+ return 0
+ }
+
[[ -n "$USER" ]] || {
echo -e "ERROR: User can not be empty!" >&2
return 1