X-Git-Url: https://iankelling.org/git/?p=buildscripts;a=blobdiff_plain;f=prometheus;fp=prometheus;h=e7e3233361b05e6b13338c7b42817d79f7e9e396;hp=0000000000000000000000000000000000000000;hb=6d5364acaf732814110b7ab98ef1d266276f64ee;hpb=f22fdf4a151ff0dcbbf1902977559eebe18613ea diff --git a/prometheus b/prometheus new file mode 100755 index 0000000..e7e3233 --- /dev/null +++ b/prometheus @@ -0,0 +1,45 @@ +#!/bin/bash + +# I initially was using these +# https://github.com/cloudalchemy/ansible-prometheus +# https://github.com/cloudalchemy/ansible-alertmanager +# https://github.com/cloudalchemy/ansible-node-exporter +# https://github.com/cloudalchemy/ansible-grafana + +# As of trisquel 11, get upstream prom because it has the react ui, +# which has localtime, and general better usability. alertmanager, +# changelog seems to show good changes and surely things will just work +# better with a matching prometheus. + +if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi + +#rsync --delete consoles console_libraries /etc/prometheus + + +while read -r prog tool; do + cd /a/opt/${prog}dl + url=$(curl -s https://api.github.com/repos/prometheus/$prog/releases/latest | jq -r '.assets[].browser_download_url | match(".*linux-amd64.tar.gz$").string') + f=${url##*/} + if [[ -e $f ]]; then + timestamp=$(stat -c %Y $f) + else + timestamp=0 + fi + m wget -nv -N $url + new_timestamp=$(stat -c %Y $f) + if [[ $timestamp != $new_timestamp || ! -e /usr/local/bin/$prog ]]; then + ngset + to_rm=( !($f) ) + ngreset + if (( ${#to_rm[@]} )); then + rm -rf ${to_rm[@]} + fi + m ex $f + dir=${f%.tar.gz} + m sudo install $dir/$prog $dir/$tool /usr/local/bin + m sudo systemctl restart $prog + fi +done <<'EOF' +prometheus promtool +alertmanager amtool +EOF