From dc34d23c63cd83a7cc7a79525445aad3293c7241 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 13 Jun 2023 18:32:53 -0400 Subject: [PATCH] prometheus related updates --- brc | 17 ++ brc2 | 59 +---- btrbk-run | 7 +- conflink | 5 +- distro-end | 10 +- filesystem/etc/apt/preferences.d/prometheus | 3 - filesystem/etc/default/prometheus | 88 +------ .../etc/default/prometheus-alertmanager | 72 +----- .../alertmanager_templates/iank.tmpl | 4 +- filesystem/etc/prometheus/file_sd/node.yml | 12 +- filesystem/etc/prometheus/prometheus.yml | 37 ++- generate-ui.sh | 46 ++++ .../etc/default/prometheus-node-exporter | 216 ------------------ subdir_files/.config/amtool/config.yml | 2 + 14 files changed, 134 insertions(+), 444 deletions(-) delete mode 100644 filesystem/etc/apt/preferences.d/prometheus create mode 100755 generate-ui.sh delete mode 100644 machine_specific/kd/filesystem/etc/default/prometheus-node-exporter create mode 100644 subdir_files/.config/amtool/config.yml diff --git a/brc b/brc index 99fc5b8..97f22e1 100644 --- a/brc +++ b/brc @@ -1635,6 +1635,15 @@ ccomp mkdir mkc mkct() { mkc $(mktemp -d) } +# mkdir the last arg, cp the rest into it +mkcp() { + mkdir -p "${@: -1}" + cp "${@:1:$#-1}" "${@: -1}" +} +mkmv() { + mkdir -p "${@: -1}" + mv "${@:1:$#-1}" "${@: -1}" +} mkt() { # mkdir and touch file local path="$1" @@ -2388,6 +2397,13 @@ pson() { fi } +# prometheus node curl +pnodecurl() { + local host + host=${1:-127.0.0.1} + s curl --cert-type PEM --cert /etc/prometheus/ssl/prometheus_cert.pem --key /etc/prometheus/ssl/prometheus_key.pem --cacert /etc/prometheus/ssl/prom_node_cert.pem --resolve prom_node:9100:$host -v https://prom_node:9100/metrics +} + tx() { # toggle set -x, and the prompt so it doesnt spam if [[ $- == *x* ]]; then set +x @@ -2564,6 +2580,7 @@ spark() _spark_echo } +pdfwc() { local f; for f; do echo "$f" $(pdfinfo "$f" | awk '/^Pages:/ {print $2}'); done } # * misc stuff diff --git a/brc2 b/brc2 index 6497acc..0211a64 100644 --- a/brc2 +++ b/brc2 @@ -417,7 +417,7 @@ _iki-convert() { fi case $input in http*) - path="$repo_dir/${input##https://$domain/wiki/}" + path="$repo_dir/${input##http*://$domain/wiki/}" if [[ $path == */ ]]; then path=${path%/}.mdwn fi @@ -425,52 +425,13 @@ _iki-convert() { ;; *) path=$(fp "$input") - url="https://$domain/wiki/${path#$repo_dir/}" + url="http*://$domain/wiki/${path#$repo_dir/}" url="${url%.mdwn}/" j echo "$url" ;; esac } -# Convert brains file path to url and vice versa. It copies the result to clipboard -# usage: brains [URL_OR_PATH] -brains() { - local url path input repo_dir err path - repo_dir=/a/f/brains - err=false - if ! type -p xclip &>/dev/null; then - echo "missing dependency for brains, please do: sudo apt install xclip" >&2 - err=true - fi - if ! type -p pee &>/dev/null; then - echo "missing dependency for brains, please do: sudo apt install moreutils" >&2 - err=true - fi - if $err; then - return 1 - fi - if [[ $1 ]]; then - input="$*" - else - read -r -p "enter path or url"$'\n' input - fi - case $input in - http*) - path="$repo_dir/${input##https://brains.fsf.org/wiki/}" - if [[ $path == */ ]]; then - path=${path%/}.mdwn - fi - printf "%s\n" "$path" |& pee "xclip -r -selection clipboard" cat - ;; - *) - path=$(realpath -s "$input") - url="https://brains.fsf.org/wiki/${path#$repo_dir/}" - url="${url%.mdwn}/" - echo "$url" |& pee "xclip -r -selection clipboard" cat - ;; - esac -} - # Generate beet smartplaylists for navidrome. # for going in the reverse direction, run @@ -1333,13 +1294,15 @@ btrbk-host-debug() { mkdir -p /tmp/b/s for host in $remote $alt; do - # this takes a while, we only want to do it on 1st run - if [[ -s /tmp/b/$host.log ]]; then continue; fi - ssh $host journalctl -u btrbk-run -u btrbk -u switch-mail-host -u btrbk-spread >/tmp/b/$host.log + h=$(ssh $host hostname) + rsync -a /var/log/btrbk $host:/var/log/btrbk /var/log/btrbk/$h + grr '\bsnapshot success' /var/log/btrbk/$h >/tmp/b/$h.log + + ## this takes a while, we only want to do it on 1st run + # if [[ -s /tmp/b/$host.log ]]; then continue; fi + # ssh $host journalctl -u btrbk-run -u btrbk -u switch-mail-host -u btrbk-spread >/tmp/b/$host.log done - if [[ ! -s /tmp/b/local.log ]]; then - jrbtrbk >/tmp/b/local.log - fi + gr '\bsnapshot success' /var/log/btrbk/*.log >/tmp/b/local.log cd /tmp/b for f in *.log; do gr '\bsnapshot success' $f >s/$f @@ -3509,7 +3472,7 @@ monero() { # rg my main files rgm() { - rg "$@" /p/pd.org /p/w.org /a/t.org /a/work.org /b + rg "$@" /p/w.org /a/t.org /a/work.org /b } reset-konsole() { diff --git a/btrbk-run b/btrbk-run index 014d85b..5388858 100644 --- a/btrbk-run +++ b/btrbk-run @@ -405,7 +405,7 @@ mkdir -p /var/log/btrbk # fine if they go back years. log_path=/var/log/btrbk/$(date +%F_%T%:::z).log echo copying output to $log_path -exec &> >(tee -a $log_path) +exec &> >(ts "%F %T" | tee -a $log_path) if $verbose; then @@ -718,8 +718,13 @@ fi if [[ $ret == 0 ]]; then for tg in ${targets[@]}; do + h=$(ssh root@$tg hostname) + rsync -a /var/log/btrbk $tg:/var/log/btrbk/$tg ssh root@$tg /usr/local/bin/mail-backup-clean done + if [[ $source ]]; then + rsync -a $source:/var/log/btrbk /var/log/btrbk/$source + fi fi mexit $ret diff --git a/conflink b/conflink index efc7dd7..e20da6e 100755 --- a/conflink +++ b/conflink @@ -231,10 +231,11 @@ case $user in fi if [[ -e /p/c/user-specific ]]; then if getent passwd prometheus &>/dev/null; then - s rsync -clpgoDiSAX --chmod=Dg-s --chown=root:prometheus /p/c/user-specific/prometheus/prometheus-pass /etc + v s rsync -clpgoDiSAX --chmod=Dg-s --chown=root:prometheus /p/c/user-specific/prometheus/prometheus-pass /etc + v s rsync -clpgoDiSAX --chmod=Dg-s --chown=root:prometheus /p/c/user-specific/prometheus/prometheus/ssl/* /etc/prometheus/ssl fi if getent passwd www-data &>/dev/null; then - s rsync -clpgoDiSAX --chmod=Dg-s --chown=root:www-data /p/c/user-specific/www-data/* /etc + v s rsync -clpgoDiSAX --chmod=Dg-s --chown=root:www-data /p/c/user-specific/www-data/* /etc fi fi diff --git a/distro-end b/distro-end index bc8b474..4452a3b 100755 --- a/distro-end +++ b/distro-end @@ -619,8 +619,7 @@ case $HOSTNAME in dnsb8 fi - pi prometheus-node-exporter - /a/bin/buildscripts/prom-node-exporter -l + s /c/roles/prom-export/files/simple/usr/local/bin/fsf-install-node-exporter -l # ex for exporter web-conf -p 9101 -f 9100 - apache2 ${HOSTNAME}ex.b8.nz <<'EOF' @@ -1982,12 +1981,11 @@ esac -pi prometheus-node-exporter-collectors case $HOSTNAME in kd) # Font awesome is needed for the alertmanager ui. pi prometheus-alertmanager prometheus fonts-font-awesome - /a/bin/buildscripts/prometheus + /c/roles/prom/files/simple/usr/local/bin/fsf-install-prometheus web-conf -p 9091 -f 9090 - apache2 i.b8.nz <<'EOF' AuthType Basic @@ -2023,7 +2021,7 @@ EOF ser restart prometheus-alertmanager fi - /a/bin/buildscripts/prom-node-exporter -l + s /c/roles/prom-export/files/simple/usr/local/bin/fsf-install-node-exporter -l for ser in prometheus-node-exporter prometheus-alertmanager prometheus; do sysd-prom-fail-install $ser @@ -2031,7 +2029,7 @@ EOF ;; *) - /a/bin/buildscripts/prom-node-exporter + s /c/roles/prom-export/files/simple/usr/local/bin/fsf-install-node-exporter ;; esac diff --git a/filesystem/etc/apt/preferences.d/prometheus b/filesystem/etc/apt/preferences.d/prometheus deleted file mode 100644 index 974f95b..0000000 --- a/filesystem/etc/apt/preferences.d/prometheus +++ /dev/null @@ -1,3 +0,0 @@ -Package: prometheus-alertmanager prometheus prometheus-node-exporter libjs-jquery -Pin: release n=bullseye,o=Debian -Pin-Priority: 500 diff --git a/filesystem/etc/default/prometheus b/filesystem/etc/default/prometheus index cd109eb..c4e807a 100644 --- a/filesystem/etc/default/prometheus +++ b/filesystem/etc/default/prometheus @@ -1,97 +1,15 @@ # iank: initial file from 2.24, added to empty ARGS. -# overlapping-blocks is for backfil of recording rules, -# https://jessicagreben.medium.com/prometheus-fill-in-data-for-new-recording-rules-30a14ccb8467 # config.file and tsdb.path are to configure the upstream version to use # the default locations of the debian package. -# Sets the command-line arguments to pass to the server. +# Sets the command-line arguments to pass to the server. to see all options, run prometheus --help ARGS="--web.listen-address=127.0.0.1:9090 --web.external-url=https://i.b8.nz:9091 --log.level=info ---storage.tsdb.allow-overlapping-blocks --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/metrics2/" - - -# --config.file="prometheus.yml" -# Prometheus configuration file path. -# --web.listen-address="0.0.0.0:9090" -# Address to listen on for UI, API, and telemetry. -# --web.config.file="" [EXPERIMENTAL] Path to configuration file that can enable TLS or authentication. -# --web.read-timeout=5m Maximum duration before timing out read of the request, and closing idle connections. -# --web.max-connections=512 Maximum number of simultaneous connections. -# --web.external-url= The URL under which Prometheus is externally reachable (for example, if Prometheus is served via a reverse proxy). Used for generating relative and absolute links back to -# Prometheus itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Prometheus. If omitted, relevant URL components will be derived -# automatically. -# --web.route-prefix= Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url. -# --web.user-assets= Path to static asset directory, available at /user. -# --web.enable-lifecycle Enable shutdown and reload via HTTP request. -# --web.enable-admin-api Enable API endpoints for admin control actions. -# --web.enable-remote-write-receiver -# Enable API endpoint accepting remote write requests. -# --web.console.templates="consoles" -# Path to the console template directory, available at /consoles. -# --web.console.libraries="console_libraries" -# Path to the console library directory. -# --web.page-title="Prometheus Time Series Collection and Processing Server" -# Document title of Prometheus instance. -# --web.cors.origin=".*" Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1|domain2)\.com' -# --storage.tsdb.path="data/" -# Base path for metrics storage. Use with server mode only. -# --storage.tsdb.retention=STORAGE.TSDB.RETENTION -# [DEPRECATED] How long to retain samples in storage. This flag has been deprecated, use "storage.tsdb.retention.time" instead. Use with server mode only. -# --storage.tsdb.retention.time=STORAGE.TSDB.RETENTION.TIME -# How long to retain samples in storage. When this flag is set it overrides "storage.tsdb.retention". If neither this flag nor "storage.tsdb.retention" nor -# "storage.tsdb.retention.size" is set, the retention time defaults to 15d. Units Supported: y, w, d, h, m, s, ms. Use with server mode only. -# --storage.tsdb.retention.size=STORAGE.TSDB.RETENTION.SIZE -# Maximum number of bytes that can be stored for blocks. A unit is required, supported units: B, KB, MB, GB, TB, PB, EB. Ex: "512MB". Based on powers-of-2, so 1KB is 1024B. Use -# with server mode only. -# --storage.tsdb.no-lockfile -# Do not create lockfile in data directory. Use with server mode only. -# --storage.tsdb.allow-overlapping-blocks -# Allow overlapping blocks, which in turn enables vertical compaction and vertical query merge. Use with server mode only. -# --storage.tsdb.head-chunks-write-queue-size=0 -# Size of the queue through which head chunks are written to the disk to be m-mapped, 0 disables the queue completely. Experimental. Use with server mode only. -# --storage.agent.path="data-agent/" -# Base path for metrics storage. Use with agent mode only. -# --storage.agent.wal-compression -# Compress the agent WAL. Use with agent mode only. -# --storage.agent.retention.min-time=STORAGE.AGENT.RETENTION.MIN-TIME -# Minimum age samples may be before being considered for deletion when the WAL is truncated Use with agent mode only. -# --storage.agent.retention.max-time=STORAGE.AGENT.RETENTION.MAX-TIME -# Maximum age samples may be before being forcibly deleted when the WAL is truncated Use with agent mode only. -# --storage.agent.no-lockfile -# Do not create lockfile in data directory. Use with agent mode only. -# --storage.remote.flush-deadline= -# How long to wait flushing sample on shutdown or config reload. -# --storage.remote.read-sample-limit=5e7 -# Maximum overall number of samples to return via the remote read interface, in a single query. 0 means no limit. This limit is ignored for streamed response types. Use with -# server mode only. -# --storage.remote.read-concurrent-limit=10 -# Maximum number of concurrent remote read calls. 0 means no limit. Use with server mode only. -# --storage.remote.read-max-bytes-in-frame=1048576 -# Maximum number of bytes in a single frame for streaming remote read response types before marshalling. Note that client might have limit on frame size as well. 1MB as -# recommended by protobuf by default. Use with server mode only. -# --rules.alert.for-outage-tolerance=1h -# Max time to tolerate prometheus outage for restoring "for" state of alert. Use with server mode only. -# --rules.alert.for-grace-period=10m -# Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. Use with server mode only. -# --rules.alert.resend-delay=1m -# Minimum amount of time to wait before resending an alert to Alertmanager. Use with server mode only. -# --alertmanager.notification-queue-capacity=10000 -# The capacity of the queue for pending Alertmanager notifications. Use with server mode only. -# --query.lookback-delta=5m The maximum lookback duration for retrieving metrics during expression evaluations and federation. Use with server mode only. -# --query.timeout=2m Maximum time a query may take before being aborted. Use with server mode only. -# --query.max-concurrency=20 -# Maximum number of queries executed concurrently. Use with server mode only. -# --query.max-samples=50000000 -# Maximum number of samples a single query can load into memory. Note that queries will fail if they try to load more samples than this into memory, so this also limits the -# number of samples a query can return. Use with server mode only. -# --enable-feature= ... Comma separated feature names to enable. Valid options: agent, exemplar-storage, expand-external-labels, memory-snapshot-on-shutdown, promql-at-modifier, -# promql-negative-offset, remote-write-receiver (DEPRECATED), extra-scrape-metrics, new-service-discovery-manager. See https://prometheus.io/docs/prometheus/latest/feature_flags/ -# for more details. -# --log.level=info Only log messages with the given severity or above. One of: [debug, info, warn, error] -# --log.format=logfmt Output format of log messages. One of: [logfmt, json] +# for testing +#--query.lookback-delta=15s" diff --git a/filesystem/etc/default/prometheus-alertmanager b/filesystem/etc/default/prometheus-alertmanager index 0c36d69..d54a59e 100644 --- a/filesystem/etc/default/prometheus-alertmanager +++ b/filesystem/etc/default/prometheus-alertmanager @@ -1,11 +1,8 @@ # Set the command-line arguments to pass to the server. -# default: -#ARGS="" # from its README: If running Alertmanager in high availability mode is not # desired, setting --cluster.listen-address= prevents Alertmanager from # listening to incoming peer requests. -# Why the fuck is that in the readme, not the docs below? # If you don't add that, it will fail to start on boot because # it doesn't wait for network.target, and gives this error message: # component=cluster err="couldn't deduce an advertise address: no private IP found, explicit advertise addr not provided" @@ -17,71 +14,4 @@ ARGS="--cluster.listen-address= --storage.path=/var/lib/prometheus/alertmanager/ --web.listen-address=127.0.0.1:9093" -# this file is from version 0.21 - -# The alert manager supports the following options: - - -# --config.file="alertmanager.yml" -# Alertmanager configuration file name. -# --storage.path="data/" Base path for data storage. -# --data.retention=120h How long to keep data for. -# --alerts.gc-interval=30m Interval between alert GC. -# --web.external-url=WEB.EXTERNAL-URL -# The URL under which Alertmanager is externally reachable (for -# example, if Alertmanager is served via a reverse proxy). Used -# for generating relative and absolute links back to -# Alertmanager itself. If the URL has a path portion, it will -# be used to prefix all HTTP endpoints served by Alertmanager. -# If omitted, relevant URL components will be derived -# automatically. -# --web.route-prefix=WEB.ROUTE-PREFIX -# Prefix for the internal routes of web endpoints. Defaults to -# path of --web.external-url. -# --web.listen-address=":9093" -# Address to listen on for the web interface and API. -# --web.get-concurrency=0 Maximum number of GET requests processed concurrently. If -# negative or zero, the limit is GOMAXPROC or 8, whichever is -# larger. -# --web.timeout=0 Timeout for HTTP requests. If negative or zero, no timeout is -# set. -# --cluster.listen-address="0.0.0.0:9094" -# Listen address for cluster. Set to empty string to disable HA -# mode. -# --cluster.advertise-address=CLUSTER.ADVERTISE-ADDRESS -# Explicit address to advertise in cluster. -# --cluster.peer=CLUSTER.PEER ... -# Initial peers (may be repeated). -# --cluster.peer-timeout=15s -# Time to wait between peers to send notifications. -# --cluster.gossip-interval=200ms -# Interval between sending gossip messages. By lowering this -# value (more frequent) gossip messages are propagated across -# the cluster more quickly at the expense of increased -# bandwidth. -# --cluster.pushpull-interval=1m0s -# Interval for gossip state syncs. Setting this interval lower -# (more frequent) will increase convergence speeds across -# larger clusters at the expense of increased bandwidth usage. -# --cluster.tcp-timeout=10s Timeout for establishing a stream connection with a remote -# node for a full state sync, and for stream read and write -# operations. -# --cluster.probe-timeout=500ms -# Timeout to wait for an ack from a probed node before assuming -# it is unhealthy. This should be set to 99-percentile of RTT -# (round-trip time) on your network. -# --cluster.probe-interval=1s -# Interval between random node probes. Setting this lower (more -# frequent) will cause the cluster to detect failed nodes more -# quickly at the expense of increased bandwidth usage. -# --cluster.settle-timeout=1m0s -# Maximum time to wait for cluster connections to settle before -# evaluating notifications. -# --cluster.reconnect-interval=10s -# Interval between attempting to reconnect to lost peers. -# --cluster.reconnect-timeout=6h0m0s -# Length of time to attempt to reconnect to a lost peer. -# --log.level=info Only log messages with the given severity or above. One of: -# [debug, info, warn, error] -# --log.format=logfmt Output format of log messages. One of: [logfmt, json] -# --version Show application version. +# run with --help or see README for more options diff --git a/filesystem/etc/prometheus/alertmanager_templates/iank.tmpl b/filesystem/etc/prometheus/alertmanager_templates/iank.tmpl index 69defe6..64a0a38 100644 --- a/filesystem/etc/prometheus/alertmanager_templates/iank.tmpl +++ b/filesystem/etc/prometheus/alertmanager_templates/iank.tmpl @@ -1,10 +1,10 @@ {{ define "iank.default.description" }} {{ if gt (len .Alerts.Firing) 0 -}} -Alerts Firing: +Firing: {{ template "__text_alert_list" .Alerts.Firing }} {{- end }} {{ if gt (len .Alerts.Resolved) 0 -}} -Alerts Resolved: +Resolved: {{ template "__text_alert_list" .Alerts.Resolved }} {{- end }} {{- end }} diff --git a/filesystem/etc/prometheus/file_sd/node.yml b/filesystem/etc/prometheus/file_sd/node.yml index 11e2cd8..a8c5500 100644 --- a/filesystem/etc/prometheus/file_sd/node.yml +++ b/filesystem/etc/prometheus/file_sd/node.yml @@ -1,7 +1,9 @@ -- targets: - - kdwg:9101 - - sywg:9101 - - kwwg:9101 - - x3wg:9101 +- + targets: + - localhost:9100 + - sywg:9100 + - x3wg:9100 + +# - kwwg:9100 # - x2wg:9101 # - frodo:9101 diff --git a/filesystem/etc/prometheus/prometheus.yml b/filesystem/etc/prometheus/prometheus.yml index fb1e537..51eb43b 100644 --- a/filesystem/etc/prometheus/prometheus.yml +++ b/filesystem/etc/prometheus/prometheus.yml @@ -7,7 +7,11 @@ global: ## for both. # scrape_interval: 5s # evaluation_interval: 5s - + # and also useful + # /etc/default/prometheus +# --query.lookback-delta=15s +# the default lookback is 5 minutes, there is a way to change +# it per query in the api with a QueryOpt option, but it isnt exposed in the web ui. # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). @@ -37,21 +41,44 @@ scrape_configs: static_configs: - targets: ['localhost:9090'] + labels: + instance: 'kd' - job_name: 'alertmanager' static_configs: - - targets: ['localhost:9093'] + - + targets: ['localhost:9093'] + labels: + instance: 'kd' + - job_name: simple_node file_sd_configs: - files: - /etc/prometheus/file_sd/simple_node.yml + - job_name: node - basic_auth: - username: prom - password_file: /etc/prometheus-pass + scheme: https + tls_config: + # Verifying remote identity + ca_file: /etc/prometheus/ssl/prom_node_cert.pem + server_name: prom_node + # Asserting our identity + cert_file: /etc/prometheus/ssl/prometheus_cert.pem + key_file: /etc/prometheus/ssl/prometheus_key.pem file_sd_configs: - files: - /etc/prometheus/file_sd/node.yml + relabel_configs: + - source_labels: [__address__] + regex: "localhost:9100" + replacement: kd + target_label: instance + - source_labels: [__address__] + regex: "(.*)wg:.*" + # this is the default: + #replacement: "${1}" + target_label: instance + - job_name: tlsnode scheme: https basic_auth: diff --git a/generate-ui.sh b/generate-ui.sh new file mode 100755 index 0000000..c16917f --- /dev/null +++ b/generate-ui.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# iank: fixed version of /usr/share/prometheus/alertmanager/generate-ui.sh, plus exit if already build +set -e + +if [[ -e /usr/share/prometheus/alertmanager/ui/index.html ]]; then + exit 0 +fi + + +ELMDISTURL=https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz +SRCDIR=/usr/share/gocode/src/github.com/prometheus/alertmanager/ui/app +DSTDIR=/usr/share/prometheus/alertmanager/ui + +echo "Installing dependencies..." >&2 +apt install libjs-bootstrap4 fonts-font-awesome curl uglifyjs \ + golang-github-prometheus-alertmanager-dev + +#/usr/share/fonts-font-awesome/ +TMPDIR=$(mktemp -d) + +echo "Downloading Elm tools..." >&2 +cd $TMPDIR +curl --location $ELMDISTURL | zcat >$TMPDIR/elm +chmod +x $TMPDIR/elm + +echo "Compiling source code..." >&2 +ln -s $SRCDIR/src $SRCDIR/elm.json $TMPDIR +(cd $TMPDIR; ./elm make src/Main.elm --optimize --output $TMPDIR/app.js) + +echo "Optimising source code..." >&2 +uglifyjs $TMPDIR/app.js \ + --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' \ + --mangle --output $TMPDIR/script.js + +echo "Installing in Alertmanager directory..." >&2 +mkdir -p $DSTDIR +mkdir -p $DSTDIR/lib +cp $TMPDIR/script.js $DSTDIR +cp $SRCDIR/index.html $SRCDIR/favicon.ico $DSTDIR +ln -s /usr/share/fonts-font-awesome $DSTDIR/lib/font-awesome +ln -s /usr/share/nodejs/bootstrap/dist $DSTDIR/lib/bootstrap4 + +rm -rf $TMPDIR + +echo "Finished! Please, restart prometheus-alertmanager to activate UI." >&2 diff --git a/machine_specific/kd/filesystem/etc/default/prometheus-node-exporter b/machine_specific/kd/filesystem/etc/default/prometheus-node-exporter deleted file mode 100644 index 1d6d906..0000000 --- a/machine_specific/kd/filesystem/etc/default/prometheus-node-exporter +++ /dev/null @@ -1,216 +0,0 @@ -# Set the command-line arguments to pass to the server. -# Due to shell scaping, to pass backslashes for regexes, you need to double -# them (\\d for \d). If running under systemd, you need to double them again -# (\\\\d to mean \d), and escape newlines too. -ARGS="--web.listen-address=127.0.0.1:9100" - -# prometheus-node-exporter supports the following options: -# -# --collector.arp -# Enable the arp collector (default: enabled). -# --collector.bcache -# Enable the bcache collector (default: enabled). -# --collector.bcache.priorityStats -# Expose expensive priority stats. -# --collector.bonding -# Enable the bonding collector (default: enabled). -# --collector.btrfs -# Enable the btrfs collector (default: enabled). -# --collector.buddyinfo -# Enable the buddyinfo collector (default: disabled). -# --collector.conntrack -# Enable the conntrack collector (default: enabled). -# --collector.cpu -# Enable the cpu collector (default: enabled). -# --collector.cpu.info -# Enables metric cpu_info. -# --collector.cpu.info.bugs-include=COLLECTOR.CPU.INFO.BUGS-INCLUDE -# Filter the `bugs` field in cpuInfo with a value that must be a regular -# expression. -# --collector.cpu.info.flags-include=COLLECTOR.CPU.INFO.FLAGS-INCLUDE -# Filter the `flags` field in cpuInfo with a value that must be a regular -# expression. -# --collector.cpufreq -# Enable the cpufreq collector (default: enabled). -# --collector.disable-defaults -# Set all collectors to disabled by default. -# --collector.diskstats -# Enable the diskstats collector (default: enabled). -# --collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$" -# Regexp of devices to ignore for diskstats. -# --collector.drbd -# Enable the drbd collector (default: disabled). -# --collector.edac -# Enable the edac collector (default: enabled). -# --collector.entropy -# Enable the entropy collector (default: enabled). -# --collector.fibrechannel -# Enable the fibrechannel collector (default: enabled). -# --collector.filefd -# Enable the filefd collector (default: enabled). -# --collector.filesystem -# Enable the filesystem collector (default: enabled). -# --collector.filesystem.ignored-fs-types="^(autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$" -# Regexp of filesystem types to ignore for filesystem collector. -# --collector.filesystem.ignored-mount-points="^/(dev|proc|run|sys|mnt|media|var/lib/docker/.+)($|/)" -# Regexp of mount points to ignore for filesystem collector. -# --collector.hwmon -# Enable the hwmon collector (default: enabled). -# --collector.infiniband -# Enable the infiniband collector (default: enabled). -# --collector.interrupts -# Enable the interrupts collector (default: disabled). -# --collector.ipvs -# Enable the ipvs collector (default: enabled). -# --collector.ipvs.backend-labels="local_address,local_port,remote_address,remote_port,proto,local_mark" -# Comma separated list for IPVS backend stats labels. -# --collector.ksmd -# Enable the ksmd collector (default: disabled). -# --collector.loadavg -# Enable the loadavg collector (default: enabled). -# --collector.logind -# Enable the logind collector (default: disabled). -# --collector.mdadm -# Enable the mdadm collector (default: enabled). -# --collector.meminfo -# Enable the meminfo collector (default: enabled). -# --collector.meminfo_numa -# Enable the meminfo_numa collector (default: disabled). -# --collector.mountstats -# Enable the mountstats collector (default: disabled). -# --collector.netclass -# Enable the netclass collector (default: enabled). -# --collector.netclass.ignored-devices="^$" -# Regexp of net devices to ignore for netclass collector. -# --collector.netdev -# Enable the netdev collector (default: enabled). -# --collector.netdev.device-exclude="^lo$" -# Regexp of net devices to exclude (mutually exclusive to device-include). -# --collector.netdev.device-include=COLLECTOR.NETDEV.DEVICE-INCLUDE -# Regexp of net devices to include (mutually exclusive to device-exclude). -# --collector.netstat -# Enable the netstat collector (default: enabled). -# --collector.netstat.fields="^(.*_(InErrors|InErrs)|Ip_Forwarding|Ip(6|Ext)_(InOctets|OutOctets)|Icmp6?_(InMsgs|OutMsgs)|TcpExt_(Listen.*|Syncookies.*|TCPSynRetrans)|Tcp_(ActiveOpens|InSegs|OutSegs|OutRsts|PassiveOpens|RetransSegs|CurrEstab)|Udp6?_(InDatagrams|OutDatagrams|NoPorts|RcvbufErrors|SndbufErrors))$" -# Regexp of fields to return for netstat collector. -# --collector.network_route -# Enable the network_route collector (default: disabled). -# --collector.nfs -# Enable the nfs collector (default: enabled). -# --collector.nfsd -# Enable the nfsd collector (default: enabled). -# --collector.ntp -# Enable the ntp collector (default: disabled). -# --collector.ntp.ip-ttl=1 -# IP TTL to use while sending NTP query. -# --collector.ntp.local-offset-tolerance=1ms -# Offset between local clock and local ntpd time to tolerate. -# --collector.ntp.max-distance=3.46608s -# Max accumulated distance to the root. -# --collector.ntp.protocol-version=4 -# NTP protocol version. -# --collector.ntp.server-is-local -# Certify that collector.ntp.server address is not a public ntp server. -# --collector.ntp.server="127.0.0.1" -# NTP server to use for ntp collector. -# --collector.perf -# Enable the perf collector (default: disabled). -# --collector.perf.cpus="" -# List of CPUs from which perf metrics should be collected. -# --collector.perf.tracepoint=COLLECTOR.PERF.TRACEPOINT... -# Perf tracepoint that should be collected. -# --collector.powersupply.ignored-supplies="^$" -# Regexp of power supplies to ignore for powersupplyclass collector. -# --collector.powersupplyclass -# Enable the powersupplyclass collector (default: enabled). -# --collector.pressure -# Enable the pressure collector (default: enabled). -# --collector.processes -# Enable the processes collector (default: disabled). -# --collector.qdisc -# Enable the qdisc collector (default: disabled). -# --collector.qdisc.fixtures="" -# Test fixtures to use for qdisc collector end-to-end testing. -# --collector.rapl -# Enable the rapl collector (default: enabled). -# --collector.runit -# Enable the runit collector (default: disabled). -# --collector.runit.servicedir="/etc/service" -# Path to runit service directory. -# --collector.schedstat -# Enable the schedstat collector (default: enabled). -# --collector.sockstat -# Enable the sockstat collector (default: enabled). -# --collector.softnet -# Enable the softnet collector (default: enabled). -# --collector.stat -# Enable the stat collector (default: enabled). -# --collector.supervisord -# Enable the supervisord collector (default: disabled). -# --collector.supervisord.url="http://localhost:9001/RPC2" -# XML RPC endpoint. -# --collector.systemd -# Enable the systemd collector (default: enabled). -# --collector.systemd.enable-restarts-metrics -# Enables service unit metric service_restart_total. -# --collector.systemd.enable-start-time-metrics -# Enables service unit metric unit_start_time_seconds. -# --collector.systemd.enable-task-metrics -# Enables service unit tasks metrics unit_tasks_current and unit_tasks_max. -# --collector.systemd.unit-exclude=".+\\.(automount|device|mount|scope|slice|target)" -# Regexp of systemd units to exclude. Units must both match include and not -# match exclude to be included. -# --collector.systemd.unit-include=".+" -# Regexp of systemd units to include. Units must both match include and not -# match exclude to be included. -# --collector.tcpstat -# Enable the tcpstat collector (default: disabled). -# --collector.textfile -# Enable the textfile collector (default: enabled). -# --collector.textfile.directory="/var/lib/prometheus/node-exporter" -# Directory to read text files with metrics from. -# --collector.thermal_zone -# Enable the thermal_zone collector (default: enabled). -# --collector.time -# Enable the time collector (default: enabled). -# --collector.timex -# Enable the timex collector (default: enabled). -# --collector.udp_queues -# Enable the udp_queues collector (default: enabled). -# --collector.uname -# Enable the uname collector (default: enabled). -# --collector.vmstat -# Enable the vmstat collector (default: enabled). -# --collector.vmstat.fields="^(oom_kill|pgpg|pswp|pg.*fault).*" -# Regexp of fields to return for vmstat collector. -# --collector.wifi -# Enable the wifi collector (default: disabled). -# --collector.wifi.fixtures="" -# Test fixtures to use for wifi collector metrics. -# --collector.xfs -# Enable the xfs collector (default: enabled). -# --collector.zfs -# Enable the zfs collector (default: enabled). -# --collector.zoneinfo -# Enable the zoneinfo collector (default: disabled). -# --log.format=logfmt -# Output format of log messages. One of: [logfmt, json]. -# --log.level=info -# Only log messages with the given severity or above. One of: [debug, info, -# warn, error]. -# --path.procfs="/proc" -# Procfs mountpoint. -# --path.rootfs="/" -# Rootfs mountpoint. -# --path.sysfs="/sys" -# Sysfs mountpoint. -# --web.config="" -# [EXPERIMENTAL] Path to config yaml file that can enable TLS or -# authentication. -# --web.disable-exporter-metrics -# Exclude metrics about the exporter itself (promhttp_*, process_*, go_*). -# --web.listen-address=":9100" -# Address on which to expose metrics and web interface. -# --web.max-requests=40 -# Maximum number of parallel scrape requests. Use 0 to disable. -# --web.telemetry-path="/metrics" -# Path under which to expose metrics. diff --git a/subdir_files/.config/amtool/config.yml b/subdir_files/.config/amtool/config.yml new file mode 100644 index 0000000..adfae9e --- /dev/null +++ b/subdir_files/.config/amtool/config.yml @@ -0,0 +1,2 @@ +alertmanager.url: "http://localhost:9093" +output: extended -- 2.30.2