#! /bin/bash # sudo apt update sudo apt install git vim python3 python3-pip chromium-browser sudo apt-get install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata sudo useradd -rm homeassistant sudo mkdir /srv/homeassistant sudo chown homeassistant:homeassistant /srv/homeassistant sudo su homeassistant -c " cd /srv/homeassistant && python3 -m venv . && source bin/activate && python3 -m pip install wheel && pip3 install homeassistant " cat < /etc/systemd/system/grafana-server.service.d/override.conf [Service] # Give the CAP_NET_BIND_SERVICE capability CapabilityBoundingSet=CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_BIND_SERVICE # A private user cannot have process capabilities on the host's user # namespace and thus CAP_NET_BIND_SERVICE has no effect. PrivateUsers=false EOF sudo systemctl daemon-reload sudo systemctl enable home-assistant@homeassistant.service sudo systemctl start home-assistant@homeassistant.service sudo systemctl status home-assistant@homeassistant.service sudo systemctl enable grafana-server sudo systemctl start grafana-server sudo systemctl status grafana-server echo " # create user in home ass # go to user profile in home ass # get long lived access token like eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJlM2ZkY2VmZjYyODQ0OWQ5OGY2OTRlNmU2YjUxYzUyYSIsImlhdCI6MTY1MTg0ODU0NiwiZXhwIjoxOTY3MjA4NTQ2fQ.R6_My5eBUMcgompY3L3SbTUCTEIffQaNMUHyUw8sro0 " read -p "Please provide your access token: " TOKEN cat << EOF | sudo tee /etc/grafana/grafana.ini metrics: wal_directory: /var/tmp/wal configs: - name: integrations scrape_configs: - job_name: integrations/hass metrics_path: /api/prometheus bearer_token: "$TOKEN" scheme: http static_configs: - targets: ['localhost:8123'] remote_write: - url: http://cortex:9009/api/prom/push EOF sudo systemctl reload grafana-server