From a4a059abdbcb2df9f620dfc0ed9d0e76a6681cd6 Mon Sep 17 00:00:00 2001 From: IgorKha <2268209+IgorKha@users.noreply.github.com> Date: Wed, 13 Oct 2021 00:10:42 +0300 Subject: [PATCH] hotfix corrected change ip in prometheus.yml with sh script updated readme --- README.md | 2 ++ prometheus/prometheus.yml | 2 +- run.sh | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bd868cc..cb35fbd 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ ![visitors](https://visitor-badge.laobi.icu/badge?page_id=IgorKha.Grafana-Mikrotik) +[![Donate using Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/~1772367/donate) + Grafana dashboard for Mikrotik/routerOS. [prometheus/snmp_exporter](https://github.com/prometheus/snmp_exporter) | | ver. | diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index 99efb18..48426de 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -40,7 +40,7 @@ scrape_configs: - job_name: Mikrotik static_configs: - targets: - - 192.168.88.1 # SNMP device IP. + - 192.168.88.1 # mikrotik_ip metrics_path: /snmp params: module: [mikrotik] diff --git a/run.sh b/run.sh index d7b3750..6a939bf 100755 --- a/run.sh +++ b/run.sh @@ -112,11 +112,11 @@ router_ip() { if ask "Change target mikrotik IP address ?" Y; then read -rp 'Enter target mikrotik IP address: ' IP if [ -d "./${REPO}" ]; then - sed -i -e 's/192.168.88.1/'"${IP}"'/g' \ + sed -ri -e '/mikrotik_ip/s/([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)/'"${IP}"'/g' \ ${REPO}/prometheus/prometheus.yml sed -ri -e 's/^(MIKROTIK_IP=)(.*)$/\1'"$IP"'/g' "$ENV_FILE" else - sed -i -e 's/192.168.88.1/'"${IP}"'/g' \ + sed -ri -e '/mikrotik_ip/s/([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*)/'"${IP}"'/g' \ ./prometheus/prometheus.yml sed -ri -e 's/^(MIKROTIK_IP=)(.*)$/\1'"$IP"'/g' "$ENV_FILE" fi