both:

adduser tdobes
adduser tdobes adm
adduser tdobes adm

grafana:

aptitude install apt-transport-https
echo "deb https://packagecloud.io/grafana/stable/debian/ jessie main" > /etc/apt/sources.list.d/grafana.list
wget -O- "https://packagecloud.io/gpg.key" | apt-key add -
aptitude update
aptitude install grafana
systemctl enable grafana-server && systemctl start grafana-server

browser: http://grafana.mcp.lcl:3000/
username admin, password admin

grafana-cli plugins install briangann-gauge-panel
grafana-cli plugins install grafana-clock-panel
systemctl restart grafana-server

# for updates, do:
grafana-cli plugins upgrade-all
systemctl restart grafana-server

prometheus:

wget --no-check-certificate https://github.com/prometheus/prometheus/releases/download/v1.5.2/prometheus-1.5.2.linux-amd64.tar.gz
wget --no-check-certificate https://github.com/prometheus/pushgateway/releases/download/v0.3.1/pushgateway-0.3.1.linux-amd64.tar.gz
cd /opt
tar -xzf ~tdobes/prometheus-1.5.2.linux-amd64.tar.gz
tar -xzf ~tdobes/pushgateway-0.3.1.linux-amd64.tar.gz
ln -sf /opt/prometheus-1.5.2.linux-amd64/prometheus /usr/local/bin/
ln -sf /opt/prometheus-1.5.2.linux-amd64/promtool /usr/local/bin/
ln -sf /opt/pushgateway-0.3.1.linux-amd64/pushgateway /usr/local/bin/prometheus-pushgateway
adduser --system --home /nonexistent --shell /bin/false --no-create-home --disabled-login prometheus
echo '[Unit]' > /etc/systemd/system/prometheus.service
echo 'Description=Monitoring system and time series database' >> /etc/systemd/system/prometheus.service
echo 'Documentation=https://prometheus.io/docs/introduction/overview/' >> /etc/systemd/system/prometheus.service
echo >> /etc/systemd/system/prometheus.service
echo '[Service]' >> /etc/systemd/system/prometheus.service
echo 'Restart=always' >> /etc/systemd/system/prometheus.service
echo 'User=prometheus' >> /etc/systemd/system/prometheus.service
echo 'ExecStart=/usr/local/bin/prometheus' >> /etc/systemd/system/prometheus.service
echo 'ExecReload=/bin/kill -HUP $MAINPID' >> /etc/systemd/system/prometheus.service
echo 'TimeoutStopSec=20s' >> /etc/systemd/system/prometheus.service
echo 'SendSIGKILL=no' >> /etc/systemd/system/prometheus.service
echo >> /etc/systemd/system/prometheus.service
echo '[Install]' >> /etc/systemd/system/prometheus.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/prometheus.service
mkdir -p /opt/prometheus-1.5.2.linux-amd64/data
chown prometheus /opt/prometheus-1.5.2.linux-amd64/data
systemctl enable prometheus && systemctl start prometheus
echo '[Unit]' > /etc/systemd/system/prometheus-pushgateway.service
echo 'Description=Prometheus exporter for ephemereal jobs' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'Documentation=https://prometheus.io/docs/instrumenting/pushing/' >> /etc/systemd/system/prometheus-pushgateway.service
echo >> /etc/systemd/system/prometheus-pushgateway.service
echo '[Service]' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'Restart=always' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'User=prometheus' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'ExecStart=/usr/local/bin/prometheus-pushgateway -persistence.file=/opt/pushgateway-0.3.1.linux-amd64/data/pushgateway.data' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'ExecReload=/bin/kill -HUP $MAINPID' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'TimeoutStopSec=20s' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'SendSIGKILL=no' >> /etc/systemd/system/prometheus-pushgateway.service
echo >> /etc/systemd/system/prometheus-pushgateway.service
echo '[Install]' >> /etc/systemd/system/prometheus-pushgateway.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/prometheus-pushgateway.service
mkdir -p /opt/pushgateway-0.3.1.linux-amd64/data
chown prometheus /opt/pushgateway-0.3.1.linux-amd64/data
systemctl enable prometheus-pushgateway && systemctl start prometheus-pushgateway

prometheus: http://prometheus.mcp.lcl:9090/
prometheus-pushgateway: http://prometheus.mcp.lcl:9091/

cp -a /opt/prometheus-1.5.2.linux-amd64/prometheus.yml /opt/prometheus-1.5.2.linux-amd64/prometheus.yml.orig
echo >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
echo "  - job_name: 'pushgateway'" >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
echo '    scrape_interval: 1s' >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
echo '    honor_labels: true' >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
echo '    static_configs:' >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
echo "      - targets: ['localhost:9091']" >> /opt/prometheus-1.5.2.linux-amd64/prometheus.yml
systemctl restart prometheus

influxdb:

aptitude install apt-transport-https
wget -q -O - https://repos.influxdata.com/influxdb.key | apt-key add -
echo "deb https://repos.influxdata.com/debian jessie stable" > /etc/apt/sources.list.d/influxdb.list
aptitude update && aptitude forget-new
aptitude install influxdb
sed -i -e 's/^# reporting-disabled = false$/reporting-disabled = true/g' /etc/influxdb/influxdb.conf
systemctl start influxdb

weather-server:

aptitude install python-requests
wget -O weewx-prompush-v1.0.0.tar.gz https://github.com/sulrich/weewx-prompush/archive/v1.0.0.tar.gz
wee_extension --install weewx-prompush-v1.0.0.tar.gz
# edit /etc/weewx/weewx.conf:
## add blank line before [[PromPush]]
## change host to prometheus.mcp.lcl
## change port to 9091
## change job to weewx
## change instance to mcp
systemctl restart weewx

wget -O weewx-influx.tar.gz https://github.com/matthewwall/weewx-influx/archive/master.tar.gz
wee_extension --install weewx-influx.tar.gz
# edit /etc/weewx/weewx.conf:
## add blank line before [[Influx]]
## change host to prometheus.mcp.lcl
## change database to weewx
## add line: binding = loop
computer/prometheus_grafana_and_weewx_setup_notes.txt · Last modified: 2018/06/23 14:33 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS