Skip to content

Instantly share code, notes, and snippets.

@bergquist
Last active October 16, 2018 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergquist/37bbcb913e51a3fab4203b7c24112b88 to your computer and use it in GitHub Desktop.
Save bergquist/37bbcb913e51a3fab4203b7c24112b88 to your computer and use it in GitHub Desktop.
scripts and scripts and scripts
docker run --init --restart unless-stopped --net=host -d -e TZ='Europe/Stockholm' -v ~/unifi:/unifi --name unifi jacobalberty/unifi:stable
# my global config
global:
scrape_interval: 10s # By default, scrape targets every 15 seconds.
evaluation_interval: 10s # By default, scrape targets every 15 seconds.
# scrape_timeout is set to the global default (10s).
# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
# - "alert.rules"
# - "first.rules"
# - "second.rules"
#alerting:
#alertmanagers:
#- scheme: http
#static_configs:
#- targets:
#- "127.0.0.1:9093"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['127.0.0.1:9100']
- job_name: 'unifi'
static_configs:
- targets: ['192.168.1.206:9130']
- job_name: 'grafana'
static_configs:
- targets: ['127.0.0.1:3000']
#/bin/bash
#-v /home/torkel/dev/grafana-docker/data:/var/lib/grafana \
docker run -d --restart unless-stopped --net=host -v /home/carl/prometheus/conf:/etc/prometheus prom/prometheus:v2.3.1
#!/bin/bash
version="${VERSION:-0.14.0}"
arch="${ARCH:-linux-amd64}"
bin_dir="${BIN_DIR:-/usr/local/bin}"
wget "https://github.com/prometheus/node_exporter/releases/download/v$version/node_exporter-$version.$arch.tar.gz" \
-O /tmp/node_exporter.tar.gz
mkdir -p /tmp/node_exporter
cd /tmp || { echo "ERROR! No /tmp found.."; exit 1; }
tar xfz /tmp/node_exporter.tar.gz -C /tmp/node_exporter || { echo "ERROR! Extracting the node_exporter tar"; exit 1; }
cp "/tmp/node_exporter/node_exporter-$version.$arch/node_exporter" "$bin_dir"
chown root:staff "$bin_dir/node_exporter"
cat <<EOF > /etc/systemd/system/node_exporter.service
[Unit]
Description=Prometheus node exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target
[Service]
Type=simple
ExecStartPre=-/sbin/iptables -I INPUT 1 -p tcp --dport 9100 -s 127.0.0.1 -j ACCEPT
ExecStartPre=-/sbin/iptables -I INPUT 3 -p tcp --dport 9100 -j DROP
ExecStart=/usr/local/bin/node_exporter
[Install]
WantedBy=multi-user.target
EOF
systemctl enable node_exporter.service
systemctl start node_exporter.service
echo "SUCCESS! Installation succeeded!"
#!/bin/bash
docker run -d --restart unless-stopped --net=host -v /home/carl/unifi_exp/config.yaml:/config/config.yml b3vis/unifi_exporter
listen:
address: :9130
metricspath: /metrics
unifi:
address: https://unifi.mydomain.com:8443
username:
password:
site:
insecure: false
timeout: 5s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment