-
-
Save wallace57/69745b3a66c64f5af6bcf2e9cfd504e8 to your computer and use it in GitHub Desktop.
Revisions
-
danpawlik revised this gist
May 21, 2021 . 2 changed files with 179 additions and 186 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,186 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,179 @@ #!/bin/bash BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.19.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'} ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.12'} STATSD_EXPORTER_VERSION=${STATSD_EXPORTER_VERSION:-'0.15.0'} if id -u 'centos'; then USER='centos' elif id -u 'fedora'; then USER='fedora' elif id -u 'ubuntu'; then USER='ubuntu' elif id -u 'debian'; then USER='debian'else USER=$USER fi if command -v yum ; then sudo yum install -y curl elif command -v apt ; then sudo apt install -y curl fi curl -L https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -o /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz curl -L https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -o /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz curl -L https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -o /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz curl -L https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -o /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz curl -L https://github.com/prometheus/statsd_exporter/releases/download/v$STATSD_EXPORTER_VERSION/statsd_exporter-$STATSD_EXPORTER_VERSION.linux-amd64.tar.gz -o /tmp/statsd-exporter-$STATSD_EXPORTER_VERSION-linux.tar.gz sudo mkdir -p /opt/blackbox_exporter /opt/mysql_exporter /opt/apache_exporter /opt/zookeeper_exporter /opt/statsd_exporter sudo tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 sudo tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 sudo tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/apache_exporter --strip=1 sudo tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 sudo tar xvzf /tmp/statsd-exporter-$STATSD_EXPORTER_VERSION-linux.tar.gz -C /opt/statsd_exporter --strip=1 # blackbox sudo cp /opt/blackbox_exporter/blackbox.yml /etc/prometheus/blackbox.yml cat << EOF | sudo tee /etc/systemd/system/blackbox_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/blackbox_exporter ExecStart=/opt/blackbox_exporter/blackbox_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/blackbox_exporter OPTIONS="--config.file /etc/prometheus/blackbox.yml" EOF # Mysql cat << EOF | sudo tee /etc/systemd/system/mysql_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/mysql_exporter ExecStart=/opt/mysql_exporter/mysqld_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/mysql_exporter OPTIONS="" EOF # Apache cat << EOF | sudo tee /etc/systemd/system/apache_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/apache_exporter ExecStart=/opt/apache_exporter/apache_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/apache_exporter OPTIONS="" EOF # Zookeeper cat << EOF | sudo tee /etc/systemd/system/zookeeper_exportr.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/zookeeper_exporter ExecStart=/opt/zookeeper_exporter/zookeeper-exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/zookeeper_exporter OPTIONS="-listen 0.0.0.0:9141 -zk-list localhost:2181" EOF # statsd cat << EOF | sudo tee /etc/systemd/system/statsd_exporter.service [Unit] Description=Statsd exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/statsd_exporter ExecStart=/opt/statsd_exporter/statsd_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/statsd_exporter OPTIONS="--statsd.listen-udp=':9125' --statsd.listen-tcp=':9125' --statsd.mapping-config=/etc/prometheus/statsd-mapping-config" EOF cat << EOF | sudo tee /etc/prometheus/statsd-mapping-config mappings: - match: "test.dispatcher.*.*.*" name: "dispatcher_events_total" labels: processor: "$1" action: "$2" outcome: "$3" job: "test_dispatcher" - match: "*.signup.*.*" name: "signup_events_total" labels: provider: "$2" outcome: "$3" job: "${1}_server" EOF sudo systemctl daemon-reload for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_exporter statsd_exporter; do sudo mkdir -p /opt/$exporter sudo chown -R $USER:$USER /opt/$exporter sudo systemctl enable $exporter sudo systemctl start $exporter done echo -e "\n\n\nDO NOT FORGET TO ADD INTO /etc/prometheus/prometheus.yaml STATIC CONFIGS E.G.:" echo -e "... scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090', 'localhost:9100', 'localhost:9141', 'localhost:9115', 'localhost:9102']" cd /opt/blackbox_exporter ; sudo setcap cap_net_raw+ep blackbox_exporter -
danpawlik revised this gist
May 21, 2021 . 1 changed file with 116 additions and 119 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,19 @@ #!/bin/bash PROMETHEUS_VERSION=${PROMETHEUS_VERSION:-'2.27.1'} ALERTMANAGER_VERSION=${ALERTMANAGER_VERSION:-'0.21.0'} NODE_EXPORTER_VERSION=${NODE_EXPORTER_VERSION:-'1.1.2'} if command -v yum ; then sudo yum update -y sudo yum install -y wget fi if command -v apt ; then sudo apt update sudo DEBIAN_FRONTEND=noninteractive apt dist-upgrade -y sudo apt install -y wget fi if id -u 'centos'; then USER='centos' @@ -13,177 +22,165 @@ elif id -u 'fedora'; then elif id -u 'ubuntu'; then USER='ubuntu' elif id -u 'debian'; then USER='debian' else USER=$USER fi sudo mkdir -p /opt/prometheus /etc/prometheus /etc/prometheus/alerts /var/lib/prometheus/data sudo mkdir -p /opt/alertmanager /etc/alertmanager /etc/alertmanager/templates sudo mkdir -p /opt/node_exporter sudo chown -R $USER:$USER /opt/prometheus /opt/alertmanager /opt/node_exporter curl -L https://github.com/prometheus/alertmanager/releases/download/v$ALERTMANAGER_VERSION/alertmanager-$ALERTMANAGER_VERSION.linux-amd64.tar.gz -o /tmp/alertmanager-$ALERTMANAGER_VERSION.linux-amd64.tar.gz tar xvzf /tmp/alertmanager-$ALERTMANAGER_VERSION.linux-amd64.tar.gz -C /opt/alertmanager --strip=1 #sudo docker run -p 9090:9090 -v /home/ubuntu/prometheus:/etc/prometheus prom/prometheus curl -L https://github.com/prometheus/prometheus/releases/download/v$PROMETHEUS_VERSION/prometheus-$PROMETHEUS_VERSION.linux-amd64.tar.gz -o /tmp/prometheus-$PROMETHEUS_VERSION.linux-amd64.tar.gz tar xvzf /tmp/prometheus-$PROMETHEUS_VERSION.linux-amd64.tar.gz -C /opt/prometheus --strip=1 curl -L https://github.com/prometheus/node_exporter/releases/download/v$NODE_EXPORTER_VERSION/node_exporter-$NODE_EXPORTER_VERSION.linux-amd64.tar.gz -o /tmp/node_exporter-$NODE_EXPORTER_VERSION.tar.gz tar xvzf /tmp/node_exporter-$NODE_EXPORTER_VERSION.tar.gz -C /opt/node_exporter --strip=1 cat << EOF | sudo tee /etc/prometheus/prometheus.yml global: scrape_interval: 15s evaluation_interval: 15s # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: - localhost:9093 rule_files: - "alerts/*.yml" scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090', 'localhost:9100'] - job_name: 'test2' static_configs: - targets: ['test2-vm:9100'] EOF cat << EOF | sudo tee /etc/alertmanager/alertmanager.yml global: resolve_timeout: 1m smtp_from: '[email protected]' smtp_smarthost: 'poczta.test.com:587' smtp_auth_username: '[email protected]' smtp_auth_password: 'test' smtp_auth_secret: '[email protected]' route: group_by: ['alertname', 'priority'] group_wait: 10s group_interval: 10s repeat_interval: 1m receiver: 'some-email' receivers: - name: "some-email" email_configs: - to: '[email protected]' send_resolved: true inhibit_rules: - source_match: severity: 'critical' target_match: severity: 'warning' equal: ['alertname', 'dev', 'instance'] EOF cat << EOF | sudo tee /etc/prometheus/alerts/disk.yml groups: - name: diskUsage rules: - alert: diskusage expr: node_filesystem_free_bytes{mountpoint ="/"} / node_filesystem_size_bytes{mountpoint ="/"} * 100 > 50 for: 5m labels: severity: warning annotations: summary: "Disk is out of space" description: "There is less space than 50 percent on rootfs!" EOF cat << EOF | sudo tee /etc/alertmanager/templates/warning.tmpl warning! EOF cat << EOF | sudo tee /etc/systemd/system/prometheus.service [Unit] Description=Prometheus Server Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/prometheus ExecStart=/opt/prometheus/prometheus \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/systemd/system/alertmanager.service [Unit] Description=Alertmanager service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/alertmanager ExecStart=/opt/alertmanager/alertmanager \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/systemd/system/node_exporter.service [Unit] Description=Prometheus Node Exporter Wants=network-online.target After=network-online.target [Service] User=root Restart=on-failure ExecStart=/opt/node_exporter/node_exporter \$OPTIONS EnvironmentFile=/etc/sysconfig/node_exporter [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/prometheus OPTIONS="--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data" EOF cat << EOF | sudo tee /etc/sysconfig/alertmanager OPTIONS="--config.file=/etc/alertmanager/alertmanager.yml --storage.path=/var/lib/prometheus/alertmanager" EOF cat << EOF | sudo tee /etc/sysconfig/node_exporter OPTIONS="--collector.systemd" EOF sudo systemctl daemon-reload sudo systemctl enable prometheus sudo systemctl enable alertmanager sudo systemctl enable node_exporter sudo systemctl start prometheus sudo systemctl start alertmanager sudo systemctl start node_exporter -
danpawlik revised this gist
Apr 29, 2020 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -150,9 +150,25 @@ WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/statsd_exporter OPTIONS="--statsd.listen-udp=':9125' --statsd.listen-tcp=':9125' --statsd.mapping-config=/etc/prometheus/statsd-mapping-config" EOF cat << EOF | sudo tee /etc/prometheus/statsd-mapping-config mappings: - match: "test.dispatcher.*.*.*" name: "dispatcher_events_total" labels: processor: "$1" action: "$2" outcome: "$3" job: "test_dispatcher" - match: "*.signup.*.*" name: "signup_events_total" labels: provider: "$2" outcome: "$3" job: "${1}_server" EOF sudo systemctl daemon-reload -
danpawlik revised this gist
Apr 29, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -142,8 +142,8 @@ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/statsd_exporter ExecStart=/opt/statsd_exporter/statsd_exporter \$OPTIONS [Install] WantedBy=multi-user.target -
danpawlik revised this gist
Apr 29, 2020 . 1 changed file with 28 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'} ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} STATSD_EXPORTER_VERSION=${STATSD_EXPORTER_VERSION:-'0.15.0'} if id -u 'centos'; then USER='centos' @@ -28,6 +29,7 @@ wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBO wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz wget https://github.com/prometheus/statsd_exporter/releases/download/v$STATSD_EXPORTER_VERSION/statsd_exporter-$STATSD_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/statsd-exporter-$STATSD_EXPORTER_VERSION-linux.tar.gz sudo mkdir -p /opt/blackbox_exporter sudo tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 @@ -41,6 +43,9 @@ sudo tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz - sudo mkdir -p /opt/zookeeper_exporter sudo tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 sudo mkdir -p /opt/statsd_exporter sudo tar xvzf /tmp/statsd-exporter-$STATSD_EXPORTER_VERSION-linux.tar.gz -C /opt/statsd_exporter --strip=1 # blackbox sudo cp /opt/blackbox_exporter/blackbox.yml /etc/prometheus/blackbox.yml cat << EOF | sudo tee /etc/systemd/system/blackbox_exporter.service @@ -127,10 +132,31 @@ cat << EOF | sudo tee /etc/sysconfig/zookeeper_exporter OPTIONS="-listen 0.0.0.0:9141 -zk-list localhost:2181" EOF # statsd cat << EOF | sudo tee /etc/systemd/system/statsd_exporter.service [Unit] Description=Statsd exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/zookeeper_exporter ExecStart=/opt/ststsd_exporter/statsd-exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/statsd_exporter OPTIONS="" EOF sudo systemctl daemon-reload for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_exporter statsd_exporter; do sudo mkdir -p /opt/$exporter sudo chown -R $USER:$USER /opt/$exporter sudo systemctl enable $exporter @@ -142,6 +168,6 @@ echo -e "... scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090', 'localhost:9100', 'localhost:9141', 'localhost:9115', 'localhost:9102']" cd /opt/blackbox_exporter ; sudo setcap cap_net_raw+ep blackbox_exporter -
danpawlik revised this gist
Apr 29, 2020 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,6 +16,14 @@ elif id -u 'debian'; then USER=$USER fi if command -v yum ; then sudo yum install -y wget fi if command -v apt ; then sudo apt install -y wget fi wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -
danpawlik revised this gist
Apr 9, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -136,4 +136,4 @@ scrape_configs: static_configs: - targets: ['localhost:9090', 'localhost:9100', 'localhost:9141', 'localhost:9115']" cd /opt/blackbox_exporter ; sudo setcap cap_net_raw+ep blackbox_exporter -
danpawlik revised this gist
Apr 9, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -136,4 +136,4 @@ scrape_configs: static_configs: - targets: ['localhost:9090', 'localhost:9100', 'localhost:9141', 'localhost:9115']" setcap cap_net_raw+ep blackbox_exporter -
danpawlik revised this gist
Apr 9, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,7 +116,7 @@ WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/zookeeper_exporter OPTIONS="-listen 0.0.0.0:9141 -zk-list localhost:2181" EOF -
danpawlik revised this gist
Apr 9, 2020 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -116,7 +116,7 @@ WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/zookeeper_exporter OPTIONS="-listen 0.0.0.0:9141" EOF @@ -127,4 +127,13 @@ for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_expor sudo chown -R $USER:$USER /opt/$exporter sudo systemctl enable $exporter sudo systemctl start $exporter done echo -e "\n\n\nDO NOT FORGET TO ADD INTO /etc/prometheus/prometheus.yaml STATIC CONFIGS E.G.:" echo -e "... scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090', 'localhost:9100', 'localhost:9141', 'localhost:9115']" -
danpawlik revised this gist
Apr 9, 2020 . 1 changed file with 11 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,10 +21,17 @@ wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXP wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz sudo mkdir -p /opt/blackbox_exporter sudo tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 sudo mkdir -p /opt/mysql_exporter sudo tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 sudo mkdir -p /opt/apache_exporter sudo tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/apache_exporter --strip=1 sudo mkdir -p /opt/zookeeper_exporter sudo tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 # blackbox sudo cp /opt/blackbox_exporter/blackbox.yml /etc/prometheus/blackbox.yml -
danpawlik revised this gist
Apr 8, 2020 . 1 changed file with 4 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,13 +16,10 @@ elif id -u 'debian'; then USER=$USER fi wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 -
danpawlik revised this gist
Apr 8, 2020 . 1 changed file with 83 additions and 22 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,50 +16,111 @@ elif id -u 'debian'; then USER=$USER fi #wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz #wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz #wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz #wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/apache_exporter --strip=1 tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 # blackbox sudo cp /opt/blackbox_exporter/blackbox.yml /etc/prometheus/blackbox.yml cat << EOF | sudo tee /etc/systemd/system/blackbox_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/blackbox_exporter ExecStart=/opt/blackbox_exporter/blackbox_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/blackbox_exporter OPTIONS="--config.file /etc/prometheus/blackbox.yml" EOF # Mysql cat << EOF | sudo tee /etc/systemd/system/mysql_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/mysql_exporter ExecStart=/opt/mysql_exporter/mysqld_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/mysql_exporter OPTIONS="" EOF # Apache cat << EOF | sudo tee /etc/systemd/system/apache_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/apache_exporter ExecStart=/opt/apache_exporter/apache_exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/apache_exporter OPTIONS="" EOF # Zookeeper cat << EOF | sudo tee /etc/systemd/system/zookeeper_exporter.service [Unit] Description=Blackbox exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/zookeeper_exporter ExecStart=/opt/zookeeper_exporter/zookeeper-exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/zookeeper_exporter OPTIONS="" EOF sudo systemctl daemon-reload for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_exporter; do sudo mkdir -p /opt/$exporter sudo chown -R $USER:$USER /opt/$exporter sudo systemctl enable $exporter sudo systemctl start $exporter done -
danpawlik revised this gist
Apr 8, 2020 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,8 @@ BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'} ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} if id -u 'centos'; then USER='centos' -
danpawlik revised this gist
Apr 8, 2020 . 1 changed file with 4 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,28 +1,16 @@ #!/bin/bash BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'}ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} if id -u 'centos'; then USER='centos' elif id -u 'fedora'; then USER='fedora' elif id -u 'ubuntu'; then USER='ubuntu' elif id -u 'debian'; then USER='debian'else USER=$USER fi -
danpawlik revised this gist
Apr 8, 2020 . 1 changed file with 24 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,31 +4,41 @@ BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'} ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} if id -u 'centos'; then USER='centos' elif id -u 'fedora'; then USER='fedora'elif id -u 'ubuntu'; then USER='ubuntu' dpawlik@dpawlik-x1 ~/RH cd ✘ dpawlik@dpawlik-x1 ~/RH ssh 192.168.122.242 -l root Last login: Wed Apr 8 12:01:21 2020 from 192.168.122.1 [root@puppet ~]# ls anaconda-ks.cfg dump-dlrn-proc fix-fails.sql puppet-dlrn setup-exporters [root@puppet ~]# cat setup-exporters #!/bin/bash BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'}ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} if id -u 'centos'; then USER='centos'elif id -u 'fedora'; then USER='fedora' elif id -u 'ubuntu'; then USER='ubuntu'elif id -u 'debian'; then USER='debian'else USER=$USER fi wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_exporter; do sudo mkdir -p /opt/$exporter sudo chown -R $USER:USER /opt/$exporter cat << EOF | sudo tee /etc/systemd/system/$exporter.service [Unit] @@ -50,9 +60,16 @@ EOF OPTIONS="" EOF sudo systemctl enable $exporter done tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/apache_exporter --strip=1 tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 sudo systemctl daemon-reload sudo systemctl start blackbox_exporter sudo systemctl start mysql_exporter sudo systemctl start apache_exporter -
danpawlik renamed this gist
Apr 8, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
danpawlik created this gist
Apr 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ #!/bin/bash BLACKBOX_EXPORTER_VERSION=${BLACKBOX_EXPORTER_VERSION:-'0.16.0'} MYSQL_EXPORTER_VERSION=${MYSQL_EXPORTER_VERSION:-'0.12.1'} APACHE_EXPORTER_VERSION=${APACHE_EXPORTER_VERSION:-'0.8.0'} ZOOKEEPER_EXPORTER_VERSION=${ZOOKEEPER_EXPORTER_VERSION:-'v0.1.5'} if id -u 'centos'; then USER='centos' elif id -u 'fedora'; then USER='fedora'elif id -u 'ubuntu'; then USER='ubuntu' elif id -u 'debian'; then USER='debian'else USER=$USER fi wget https://github.com/prometheus/blackbox_exporter/releases/download/v$BLACKBOX_EXPORTER_VERSION/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz tar xvzf /tmp/blackbox_exporter-$BLACKBOX_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/blackbox_exporter --strip=1 wget https://github.com/prometheus/mysqld_exporter/releases/download/v$MYSQL_EXPORTER_VERSION/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz tar xvzf /tmp/mysqld_exporter-$MYSQL_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/mysql_exporter --strip=1 wget https://github.com/Lusitaniae/apache_exporter/releases/download/v$APACHE_EXPORTER_VERSION/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -O /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz tar xvzf /tmp/apache_exporter-$APACHE_EXPORTER_VERSION.linux-amd64.tar.gz -C /opt/apache_exporter --strip=1 wget https://github.com/dabealu/zookeeper-exporter/releases/download/$ZOOKEEPER_EXPORTER_VERSION/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -O /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz tar xvzf /tmp/zookeeper-exporter-$ZOOKEEPER_EXPORTER_VERSION-linux.tar.gz -C /opt/zookeeper_exporter --strip=1 for exporter in blackbox_exporter mysql_exporter apache_exporter zookeeper_exporter; do chown -R $USER:USER /opt/$exporter cat << EOF | sudo tee /etc/systemd/system/$exporter.service [Unit] Description=$exporter service for Prometheus Documentation=https://prometheus.io/docs/ After=network-online.target [Service] User=root Restart=on-failure EnvironmentFile=/etc/sysconfig/$exporter ExecStart=/opt/$exporter/$exporter \$OPTIONS [Install] WantedBy=multi-user.target EOF cat << EOF | sudo tee /etc/sysconfig/$exporter OPTIONS="" EOF done sudo systemctl daemon-reload sudo systemctl start blackbox_exporter sudo systemctl start mysql_exporter sudo systemctl start apache_exporter sudo systemctl start zookeeper_exporter