├── .github ├── actions │ └── check-ghcr │ │ └── action.yml ├── renovate.json └── workflows │ ├── main.yml │ └── prometheus_node_exporter.yml ├── .mdlrc ├── README.md ├── prometheus_node_exporter ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dockerfile ├── README.md ├── build.json ├── config.json ├── icon.png ├── logo.png ├── rootfs │ ├── etc │ │ ├── cont-init.d │ │ │ └── node_exporter.sh │ │ └── services.d │ │ │ └── node_exporter │ │ │ └── run │ └── run.sh └── translations │ └── en.yaml └── repository.yml /.github/actions/check-ghcr/action.yml: -------------------------------------------------------------------------------- 1 | name: "GHCR Checker" 2 | description: "check ghcr for existing container version" 3 | inputs: 4 | configpath: 5 | description: "path of the addon config to determine current version" 6 | required: true 7 | image: 8 | description: "image to check (without ghcr.io/ prefix)" 9 | required: true 10 | token: 11 | description: "token to use" 12 | required: true 13 | outputs: 14 | status: 15 | description: "status code for image manifest" 16 | value: ${{ steps.check.outputs.status }} 17 | runs: 18 | using: "composite" 19 | steps: 20 | - shell: bash 21 | id: version 22 | run: | 23 | echo "version=$(grep version ${{ inputs.configpath }}| awk -F: '{print $2}' | grep -Eo '[v0-9\.-]+')" >> "$GITHUB_OUTPUT" 24 | - shell: bash 25 | id: check 26 | run: | 27 | GHCR_TOKEN=$(echo ${{ inputs.token }} | base64) 28 | STATUS=$(curl -H "Authorization: Bearer ${GHCR_TOKEN}" https://ghcr.io/v2/${{ inputs.image }}/manifests/${{ steps.version.outputs.version }} -o /dev/null -w "%{http_code}" -s) 29 | echo "status=${STATUS}" >> "$GITHUB_OUTPUT" 30 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:recommended", 5 | "schedule:nonOfficeHours" 6 | ], 7 | "dependencyDashboard": true, 8 | "dependencyDashboardTitle": "Renovate Dashboard", 9 | "labels": [ 10 | "renovatebot" 11 | ], 12 | "customManagers": [ 13 | { 14 | "customType": "regex", 15 | "fileMatch": [ 16 | "(^|/|\\.)build.json" 17 | ], 18 | "matchStringsStrategy": "any", 19 | "matchStrings": [ 20 | "\"amd64\": \"(?.*?):(?.*?)\"", 21 | "\"aarch64\": \"(?.*?):(?.*?)\"", 22 | "\"armv7\": \"(?.*?):(?.*?)\"" 23 | ], 24 | "datasourceTemplate": "docker" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CI 3 | 4 | # yamllint disable-line rule:truthy 5 | on: 6 | push: 7 | pull_request: 8 | types: 9 | - opened 10 | - reopened 11 | - synchronize 12 | workflow_dispatch: 13 | 14 | jobs: 15 | find: 16 | name: Find add-ons 17 | 18 | runs-on: ubuntu-latest 19 | 20 | outputs: 21 | addons: ${{ steps.addons.outputs.addons_list }} 22 | 23 | steps: 24 | - name: Check out the codebase 25 | uses: actions/checkout@v4 26 | 27 | - name: Find add-on directories 28 | id: addons 29 | uses: home-assistant/actions/helpers/find-addons@master 30 | 31 | lint: 32 | name: Lint add-on ${{ matrix.path }} 33 | 34 | needs: find 35 | runs-on: ubuntu-latest 36 | 37 | strategy: 38 | matrix: 39 | path: ${{ fromJson(needs.find.outputs.addons) }} 40 | 41 | steps: 42 | - name: Check out the codebase 43 | uses: actions/checkout@v4 44 | 45 | - name: Run Home Assistant Add-on Lint 46 | uses: frenck/action-addon-linter@v2 47 | with: 48 | path: "./${{ matrix.path }}" 49 | community: false 50 | -------------------------------------------------------------------------------- /.github/workflows/prometheus_node_exporter.yml: -------------------------------------------------------------------------------- 1 | name: "Publish Prometheus Node Exporter" 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | 7 | jobs: 8 | publish: 9 | name: Publish Prometheus Node Exporter Image 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout the repository 13 | uses: actions/checkout@v4 14 | - name: Login to GitHub Container Registry 15 | uses: docker/login-action@v3 16 | with: 17 | registry: ghcr.io 18 | username: ${{ github.repository_owner }} 19 | password: ${{ secrets.GITHUB_TOKEN }} 20 | - name: Check Version 21 | id: check 22 | uses: ./.github/actions/check-ghcr 23 | with: 24 | token: ${{ secrets.GITHUB_TOKEN }} 25 | image: loganmarchione/hassos-addons/prometheusnodeexporter-aarch64 26 | configpath: prometheus_node_exporter/config.json 27 | - name: Publish 28 | if: ${{ steps.check.outputs.status == '404' }} 29 | uses: home-assistant/builder@master 30 | with: 31 | args: | 32 | --aarch64 --amd64 --armv7 \ 33 | --target prometheus_node_exporter \ 34 | --docker-hub ghcr.io/loganmarchione/hassos-addons \ 35 | --image prometheusnodeexporter-{arch} 36 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hassos-addons 2 | 3 | Logan Marchione Home Assistant Add-Ons 4 | 5 | ## Installation 6 | 7 | ### Automatic 8 | 9 | 1. Add the repository. 10 | 11 | [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Floganmarchione%2Fhassos-addons) 12 | 13 | ### Manual 14 | 15 | 1. Open the Add-ons panel in Home Assistant by going to `Settings-->Add-ons-->Add-on Store`. 16 | 1. Click the menu icon in the top-right, then click "Repositories". 17 | 1. Add this URL `https://github.com/loganmarchione/hassos-addons` 18 | -------------------------------------------------------------------------------- /prometheus_node_exporter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.0.4] - 2025-03-02 4 | 5 | - Upgraded Node Exporter to `1.9.0` 6 | - Upgraded base image from `ghcr.io/hassio-addons/base/:17.1.0` to `17.2.1` 7 | 8 | ## [1.0.3] - 2025-01-20 9 | 10 | - Upgraded base image from `ghcr.io/hassio-addons/base/:16.3.5` to `17.1.0` 11 | 12 | ## [1.0.2] - 2024-11-10 13 | 14 | - Upgraded Node Exporter to `1.8.2` 15 | - Upgraded base image from `ghcr.io/hassio-addons/base/:16.3.0` to `16.3.5` 16 | 17 | ## [1.0.1] - 2024-09-11 18 | 19 | - Upgraded base image from `ghcr.io/hassio-addons/base/:16.1.2` to `16.3.0` 20 | 21 | ## [1.0.0] - 2024-07-01 22 | 23 | ⚠️ BREAKING CHANGES ⚠️ 24 | 25 | - Upgraded Node Exporter to `1.8.1` 26 | - Upgraded base image from `ghcr.io/hassio-addons/base/:15.0.8` to `16.1.2` 27 | - Removes the default username/password 28 | - Now requires a plaintext password instead of a bcrypt string (the container will bcrypt the password for you) 29 | - If you're upgrading from `0.9.1` or any earlier version, you will **NEED** to go to the "Configuration" tab and enter the plaintext version of your password (if you leave the bcrypt hash in the password field, the container will try to hash your already-hashed password) 30 | 31 | ## [0.9.1] - 2024-05-14 32 | 33 | - Upgraded base image from `ghcr.io/hassio-addons/base/:15.0.4` to `15.0.8` 34 | - Added [CONTRIBUTING.md](https://github.com/loganmarchione/hassos-addons/blob/main/prometheus_node_exporter/CONTRIBUTING.md) 35 | 36 | ## [0.9.0] - 2024-05-13 37 | 38 | - Upgraded Node Exporter to `1.8.0` thanks to [@b-reich](https://github.com/b-reich) in https://github.com/loganmarchione/hassos-addons/pull/49 39 | 40 | ## [0.8.2] - 2024-01-16 41 | 42 | - Upgraded base image from `ghcr.io/hassio-addons/base/:15.0.1` to `15.0.4` 43 | 44 | ## [0.8.1] - 2024-01-11 45 | 46 | - Published pre-built image to GHCR thanks to [@wozz](https://github.com/wozz) in https://github.com/loganmarchione/hassos-addons/pull/47 47 | 48 | ## [0.8.0] - 2023-12-13 49 | 50 | - Upgraded Node Exporter to `1.7.0` 51 | - Upgraded base image from `ghcr.io/hassio-addons/base/:14.1.0` to `15.0.1` 52 | 53 | ## [0.7.0] - 2023-08-18 54 | 55 | - Upgraded Node Exporter to `1.6.1` 56 | - Upgraded base image from `ghcr.io/hassio-addons/base/:14.0.0` to `14.1.0` 57 | 58 | ## [0.6.0] - 2023-05-18 59 | 60 | - Upgraded base image from `ghcr.io/hassio-addons/base/:13.1.3` to `14.0.0` 61 | - Added support for Prometheus Node Exporter command-line arguments thanks to [@falzm](https://github.com/falzm) in https://github.com/loganmarchione/hassos-addons/pull/34 62 | 63 | ## [0.5.0] - 2023-03-16 64 | 65 | - Upgraded Node Exporter to `1.5.0` 66 | - Upgraded base image from `ghcr.io/hassio-addons/base/:12.2.4` to `13.1.3` 67 | 68 | ## [0.4.0] - 2022-10-20 69 | 70 | - Upgraded base image from `ghcr.io/hassio-addons/base/:12.2.0` to `12.2.4` 71 | 72 | ## [0.3.0] - 2022-09-26 73 | 74 | - Upgraded Node Exporter to `1.4.0` 75 | 76 | ## [0.2.1] - 2022-08-05 77 | 78 | - Added more logging around TLS 79 | 80 | ## [0.2.0] - 2022-08-05 81 | 82 | - Added TLS support thanks to [@Quedale](https://github.com/Quedale) in https://github.com/loganmarchione/hassos-addons/pull/7 83 | - Mapped Node Exporter config files from `/etc` to `/config`, to allow editing via the [File editor add-on](https://github.com/home-assistant/addons/tree/master/configurator) 84 | 85 | ## [0.1.1] - 2022-08-05 86 | 87 | - Added configuration option descriptions 88 | 89 | ## [0.1.0] - 2022-07-11 90 | 91 | - Upgraded base image from `ghcr.io/hassio-addons/base/:11.1.2` to `12.2.0` (Alpine Linux 3.16), but also disabled the s6 init system because of [this issue](https://github.com/home-assistant/supervisor/issues/3642) 92 | - Added CI from [here](https://github.com/hassio-addons/addon-glances/blob/main/.github/workflows/ci.yaml) 93 | 94 | ## [0.0.7] - 2022-06-07 95 | 96 | - Upgraded base image from `ghcr.io/hassio-addons/base/:11.1.0` to `11.1.2` (this is the last without s6 v3) 97 | 98 | ## [0.0.6] - 2022-05-17 99 | 100 | - Fixed S6-overlay v3 problems 101 | - Added build.json file to better control base image versions 102 | - Small formatting fixes and readability changes 103 | 104 | ## [0.0.5] - 2022-02-13 105 | 106 | - Added HTTP Basic Auth 107 | 108 | ## [0.0.4] - 2021-12-29 109 | 110 | - Upgraded Node Exporter to `1.3.1` 111 | 112 | ## [0.0.3] - 2021-12-12 113 | 114 | - Built for `armv7` (Raspberry Pi 3B) thanks to [@jaredacox](https://github.com/jaredacox) in https://github.com/loganmarchione/hassos-addons/pull/1 115 | 116 | ## [0.0.2] - 2021-11-16 117 | 118 | - Built for `aarch64` (Raspberry Pi 4B) 119 | 120 | ## [0.0.1] - 2021-11-03 121 | 122 | - Initial release 123 | 124 | ## Note 125 | 126 | I'm not making numbered GitHub releases/tags, since this is still a beta project. These release numbers are purely made up. 127 | -------------------------------------------------------------------------------- /prometheus_node_exporter/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Making changes 4 | 5 | Currently, this repo pushes a tagged image from `main` to the [packages](https://github.com/users/loganmarchione/packages?repo_name=hassos-addons) tab each time `main` is updated. As such, if you're proposing a change, please update the following files in a PR and DO NOT push directly to `main`. 6 | 7 | 1. Bump the `version` number in the [config.json](https://github.com/loganmarchione/hassos-addons/blob/main/prometheus_node_exporter/config.json) file 8 | 1. Make whatever changes you need (e.g., bumping the [version of Node Exporter](https://github.com/loganmarchione/hassos-addons/blob/main/prometheus_node_exporter/Dockerfile) or the [version of the base images](https://github.com/loganmarchione/hassos-addons/blob/main/prometheus_node_exporter/build.json)) 9 | 1. Add your changes to the [CHANGELOG.md](https://github.com/loganmarchione/hassos-addons/blob/main/prometheus_node_exporter/CHANGELOG.md) file 10 | 11 | ## Testing 12 | 13 | I'm still working this out, but am doing testing based on [this page](https://developers.home-assistant.io/docs/add-ons/testing). 14 | 15 | After making your changes, run the command below from the git root directory (i.e., `hassos-addons`) to ensure that the add-on builds successfully (substitute `amd64` with `armhf`, `aarch64`, or `i386` based on your system). 16 | 17 | ``` 18 | docker run \ 19 | --rm \ 20 | -it \ 21 | --name builder \ 22 | --privileged \ 23 | -v ./prometheus_node_exporter:/data \ 24 | -v /var/run/docker.sock:/var/run/docker.sock:ro \ 25 | ghcr.io/home-assistant/amd64-builder \ 26 | -t /data \ 27 | --amd64 \ 28 | --test \ 29 | -i test-prometheus-node-exporter \ 30 | -d local 31 | ``` 32 | 33 | To test that the add-on actually runs, I've been using my personal instance of Home Assistant 🤷‍♂️ 34 | 35 | 1. Open the Add-ons panel in Home Assistant by going to `Settings-->Add-ons-->Add-on Store` 36 | 1. Uninstall the current Prometheus Node Exporter add-on (the one published from GHCR.io) 37 | 1. Install the official [samba add-on](https://github.com/home-assistant/addons/tree/master/samba) 38 | 1. Enable samba with a username and password 39 | 1. Mount the samba share locally (e.g., Dolphin can use `smb://your_home_assistant_ip_address`) 40 | 1. Navigate to the `addons` directory in the samba share 41 | 1. Copy/paste the entire `prometheus_node_exporter` directory to the `addons` directory in the samba share 42 | 1. In the `config.json` file in the samba share, remove this entire line 43 | ``` 44 | "image": "ghcr.io/loganmarchione/hassos-addons/prometheusnodeexporter-{arch}", 45 | ``` 46 | 1. Open the Add-ons panel in Home Assistant by going to `Settings-->Add-ons-->Add-on Store` 47 | 1. Click the menu icon in the top-right, then click "Check for updates" 48 | 1. Refresh the page 49 | 1. At the very top, there should be a new section for "Local add-ons" with the "Prometheus Node Exporter" to install 50 | 1. Install the new add-on from the local repository 51 | 1. Test all configurations 52 | 1. Make sure log entries line up with configuration settings 53 | 1. Navigate to `http://your_home_assistant_ip_address:9100/metrics` and ensure that HTTP basic auth works as expected 54 | 1. Stop and uninstall the local add-on 55 | 1. Delete the entire `prometheus_node_exporter` directory in the `addons` directory in the samba share 56 | 1. Disable the samba add-on 57 | 1. Re-install add-on from GHCR.io (you'll need to re-configure the add-on) -------------------------------------------------------------------------------- /prometheus_node_exporter/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BUILD_FROM 2 | # hadolint ignore=DL3006 3 | FROM $BUILD_FROM 4 | 5 | # Set shell 6 | SHELL ["/bin/bash", "-o", "pipefail", "-c"] 7 | 8 | # Setup base system 9 | ARG \ 10 | BUILD_ARCH \ 11 | NODE_EXPORTER_VERSION="1.9.0" 12 | 13 | # Copy root filesystem 14 | COPY rootfs / 15 | 16 | # hadolint ignore=DL3003,DL3018 17 | RUN \ 18 | apk add --no-cache --update apache2-utils tar \ 19 | && ARCH="${BUILD_ARCH}" \ 20 | && if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \ 21 | && curl -J -L -o /tmp/node_exporter.tar.gz \ 22 | "https://github.com/prometheus/node_exporter/releases/download/v${NODE_EXPORTER_VERSION}/node_exporter-${NODE_EXPORTER_VERSION}.linux-${ARCH}.tar.gz" \ 23 | && cd /tmp \ 24 | && tar -xzvf node_exporter.tar.gz --strip-components=1 \ 25 | && mv node_exporter /usr/local/bin/ \ 26 | && adduser -s /bin/false -D -H prometheus \ 27 | && chown -R prometheus:prometheus /usr/local/bin/node_exporter \ 28 | && rm -rf /tmp/node_exporter* LICENSE NOTICE 29 | 30 | # This add-on runs on the host pid namespace, making it impossible 31 | # to use S6-Overlay. Therefore the init system is disabled at this point. 32 | ENTRYPOINT [] 33 | CMD ["/run.sh"] 34 | -------------------------------------------------------------------------------- /prometheus_node_exporter/README.md: -------------------------------------------------------------------------------- 1 | # prometheus_node_exporter 2 | 3 | [![CI](https://github.com/loganmarchione/hassos-addons/actions/workflows/main.yml/badge.svg)](https://github.com/loganmarchione/hassos-addons/actions/workflows/main.yml) 4 | 5 | The Prometheus [Node Exporter](https://github.com/prometheus/node_exporter) for hardware and OS metrics exposed by \*NIX kernels. 6 | 7 | ## Installation 8 | 9 | 1. Add my [repository](https://github.com/loganmarchione/hassos-addons). The URL is `https://github.com/loganmarchione/hassos-addons`. 10 | 1. Search for the "Prometheus Node Exporter" add-on in the Supervisor add-on store and install it. 11 | 1. Disable "Protection mode" in the add-on panel. 12 | 1. Optional - Check the `Configuration` tab of the add-on to make any changes you'd like. 13 | 1. Start the add-on. 14 | 1. Check the `Logs` tab of the add-on to see if everything went well. 15 | 1. To verify the metrics are available, visit `http://your_home_assistant_ip_address:9100/metrics` in your browser, or use curl: `curl -X GET http://your_home_assistant_ip_address:9100/metrics`. 16 | 17 | ## Configuration 18 | 19 | By default, Prometheus Node Exporter listens on TCP port 9100. 20 | 21 | ### HTTP Basic Authentication 22 | 23 | [HTTP Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) is disabled by default. If you want to enable HTTP Basic Auth: 24 | 25 | 1. set `enable_basic_auth` to true 26 | 1. enter the `basic_auth_user` and `basic_auth_pass` 27 | 28 | ### TLS 29 | 30 | TLS is disabled by default. If you want to enable TLS: 31 | 32 | 1. set `enable_tls` to true 33 | 1. enter the `cert_file` and `cert_key` 34 | 35 | ⚠️ Note that the `cert_file` and `cert_key` need to be a `/path/to/fullchain.pem` and `/path/to/privkey.pem`, respectively (`/config` and `/ssl` are mapped to this add-on) ⚠️ 36 | 37 | ### Command-line arguments 38 | 39 | This option allows you to pass command-line arguments directly to Prometheus Node Exporter. This is particularly useful to adjust which [collectors](https://github.com/prometheus/node_exporter/#collectors) run. For example, to disable all collectors except the `cpu` collector, you can use this string: `--collector.disable-defaults --collector.cpu`. 40 | 41 | ## Usage (in Prometheus server) 42 | 43 | Add the following to the `/etc/prometheus/prometheus.yml` config file on your Prometheus server: 44 | 45 | ``` 46 | scrape_configs: 47 | ... 48 | ... 49 | ... 50 | - job_name: 'homeassistant' 51 | static_configs: 52 | - targets: ['your_home_assistant_ip_address:9100'] 53 | basic_auth: 54 | username: username_goes_here 55 | password: password_goes_here 56 | ``` 57 | 58 | The following Prometheus query should return data: 59 | 60 | ``` 61 | node_uname_info{job="homeassistant"} 62 | ``` 63 | 64 | ## Support 65 | 66 | - Tested on `amd64` and `aarch64` (Raspberry Pi 4B) platforms 67 | 68 | ## License 69 | 70 | WIP 71 | 72 | ## Known issues 73 | 74 | - [ ] The "Open Web UI" button doesn't work when Home Assistant is behind a reverse proxy. 75 | - [x] Only tested on `amd64` builds. 76 | 77 | ## TODO 78 | 79 | - [x] Add HTTP Basic Auth 80 | - [x] Add abilty to enter plain-text password instead of bcyrpt-ed hash 81 | - [x] Add TLS 82 | - [x] Per [this comment](https://community.home-assistant.io/t/hello-world-example-addon-from-developer-docs-stopped-working-s6-overlay-issue/421486/7), setup container images on a registry (DockerHub or GitHub) so that users aren't building the container with each install (would have prevented [this issue](https://github.com/loganmarchione/hassos-addons/issues/2)) 83 | - [x] Investigate CI/CD for this repo, specifically [this](https://github.com/home-assistant/actions) and [this](https://github.com/hassio-addons/addon-glances/blob/main/.github/workflows/ci.yaml) as an example 84 | - [ ] Investigate dropping API access (e.g., `hassio_api`, `homeassistant_api`, `auth_api`) in order to get my rating up 85 | 86 | ## FAQ 87 | 88 | - Doesn't Home Assistant already have Prometheus integration? 89 | - Yes, but the [official integration](https://www.home-assistant.io/integrations/prometheus/) only exposes entity-related metrics, not host-related metrics. 90 | - Isn't there already an Prometheus add-on? 91 | - Yes, but that [add-on](https://github.com/hassio-addons/addon-prometheus) is for Prometheus server, not the node exporter. 92 | - Why does this add-on require so many permissions? 93 | - The add-on needs to access to host-level metrics (CPU, memory, disk, etc...). As such, I have requested all possible permissions. Please inspect the code of this add-on before you run it. 94 | -------------------------------------------------------------------------------- /prometheus_node_exporter/build.json: -------------------------------------------------------------------------------- 1 | { 2 | "build_from": { 3 | "amd64": "ghcr.io/hassio-addons/base/amd64:17.2.1", 4 | "aarch64": "ghcr.io/hassio-addons/base/aarch64:17.2.1", 5 | "armv7": "ghcr.io/hassio-addons/base/armv7:17.2.1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /prometheus_node_exporter/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Prometheus Node Exporter", 3 | "version": "1.0.4", 4 | "slug": "prometheus_node_exporter", 5 | "description": "Prometheus node exporter for hardware and OS metrics", 6 | "url": "https://github.com/loganmarchione/hassos-addons/tree/main/prometheus_node_exporter", 7 | "image": "ghcr.io/loganmarchione/hassos-addons/prometheusnodeexporter-{arch}", 8 | "arch": ["amd64", "aarch64", "armv7"], 9 | "startup": "services", 10 | "init": false, 11 | "webui": "[PROTO:enable_tls]://[HOST]:[PORT:9100]", 12 | "ports": { 13 | "9100/tcp": 9100 14 | }, 15 | "ports_description": { 16 | "9100/tcp": "Default node exporter port and web interface" 17 | }, 18 | "map": [ 19 | "config:rw", 20 | "ssl" 21 | ], 22 | "hassio_api": true, 23 | "homeassistant_api": true, 24 | "auth_api": true, 25 | "docker_api": true, 26 | "host_network": true, 27 | "host_pid": true, 28 | "apparmor": false, 29 | "options": { 30 | "enable_basic_auth": false, 31 | "basic_auth_user": "", 32 | "basic_auth_pass": "", 33 | "enable_tls": false, 34 | "cert_file": "", 35 | "cert_key": "", 36 | "cmdline_extra_args": "" 37 | }, 38 | "schema": { 39 | "enable_basic_auth": "bool", 40 | "basic_auth_user": "str", 41 | "basic_auth_pass": "password", 42 | "enable_tls": "bool", 43 | "cert_file": "str", 44 | "cert_key": "str", 45 | "cmdline_extra_args": "str?" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /prometheus_node_exporter/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loganmarchione/hassos-addons/d0fe35c25c405ff6d701a1392a87518196f0e386/prometheus_node_exporter/icon.png -------------------------------------------------------------------------------- /prometheus_node_exporter/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loganmarchione/hassos-addons/d0fe35c25c405ff6d701a1392a87518196f0e386/prometheus_node_exporter/logo.png -------------------------------------------------------------------------------- /prometheus_node_exporter/rootfs/etc/cont-init.d/node_exporter.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bashio 2 | # ============================================================================== 3 | # Home Assistant Community Add-on: Prometheus Node Exporter 4 | # Configures Prometheus Node Exporter 5 | # ============================================================================== 6 | bashio::require.unprotected 7 | echo "${SUPERVISOR_TOKEN}" > '/run/home-assistant.token' 8 | 9 | # Even if the user isn't using these options, we're creating the web config file 10 | # This will allow us to append to the web config file as needed (based on variables) 11 | # Prometheus Node Exporter will run with a blank web config file in the meantime 12 | 13 | config_dir=/config 14 | web_config_dir=$config_dir/prometheus_node_exporter 15 | mkdir -p $web_config_dir 16 | chmod 750 $web_config_dir 17 | chown root:prometheus $web_config_dir 18 | 19 | web_config_file=$web_config_dir/node_exporter_web.yml 20 | rm -f $web_config_file 21 | touch $web_config_file 22 | chmod 740 $web_config_file 23 | chown root:prometheus $web_config_file 24 | 25 | # Poor man's debugger: check permissions on web config file 26 | #ls -la $web_config_file 27 | 28 | bashio::log.info "Add-on info - name: $(bashio::addon.name)" 29 | bashio::log.info "Add-on info - version: $(bashio::addon.version)" 30 | bashio::log.info "Add-on info - hostname: $(bashio::addon.hostname)" 31 | bashio::log.info "Add-on info - DNS name: $(bashio::addon.dns)" 32 | bashio::log.info "Checking configuration options..." 33 | 34 | ##################### 35 | # HTTP Basic Auth 36 | ##################### 37 | 38 | if bashio::config.false 'enable_basic_auth'; then 39 | bashio::log.warning "HTTP Basic Auth is disabled!" 40 | fi 41 | 42 | if bashio::config.true 'enable_basic_auth'; then 43 | bashio::log.info "HTTP Basic Auth is enabled!" 44 | 45 | # Require variables 46 | bashio::config.require 'basic_auth_user' "You enabled HTTP Basic Auth, so you must set a username" 47 | bashio::config.require 'basic_auth_pass' "You enabled HTTP Basic Auth, so you must set a password" 48 | basic_auth_user="$(bashio::config 'basic_auth_user')" 49 | basic_auth_pass="$(bashio::config 'basic_auth_pass')" 50 | 51 | # bcrypt the password 52 | hashed_password=$(htpasswd -bnBC 12 "" "$basic_auth_pass" | tr -d ':\n') 53 | 54 | # Start echoing lines out to web config file (YAML is space-sensitive so I'm lazily not using a heredoc) 55 | echo "basic_auth_users:" >> $web_config_file 56 | echo " $basic_auth_user: $hashed_password" >> $web_config_file 57 | 58 | fi 59 | 60 | ##################### 61 | # TLS 62 | ##################### 63 | 64 | if bashio::config.false 'enable_tls'; then 65 | bashio::log.warning "TLS is disabled!" 66 | fi 67 | 68 | if bashio::config.true 'enable_tls'; then 69 | bashio::log.info "TLS is enabled!" 70 | 71 | # Require variables 72 | bashio::config.require 'cert_file' "You enabled TLS, so you must set certificate file" 73 | bashio::config.require 'cert_key' "You enabled TLS, so you must set certificate key" 74 | cert_file="$(bashio::config 'cert_file')" 75 | cert_key="$(bashio::config 'cert_key')" 76 | 77 | # Start echoing lines out to web config file (YAML is space-sensitive so I'm lazily not using a heredoc) 78 | echo "tls_server_config:" >> $web_config_file 79 | echo " cert_file: $cert_file" >> $web_config_file 80 | echo " key_file: $cert_key" >> $web_config_file 81 | 82 | fi 83 | -------------------------------------------------------------------------------- /prometheus_node_exporter/rootfs/etc/services.d/node_exporter/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bashio 2 | # ============================================================================== 3 | # Home Assistant Community Add-on: Prometheus Node Exporter 4 | # Runs the Prometheus Node Exporter 5 | # ============================================================================== 6 | bashio::log.info "Starting Prometheus Node Exporter..." 7 | 8 | # Run Prometheus 9 | exec /usr/local/bin/node_exporter --web.config.file=/config/prometheus_node_exporter/node_exporter_web.yml $(bashio::config 'cmdline_extra_args' '') 10 | -------------------------------------------------------------------------------- /prometheus_node_exporter/rootfs/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bashio 2 | # ============================================================================== 3 | # Home Assistant Community Add-on: Prometheus Node Exporter 4 | # Runs the Prometheus Node Exporter 5 | # ============================================================================== 6 | # 7 | # WHAT IS THIS FILE?! 8 | # 9 | # The Prometheus Node Exporter add-on runs in the host PID namespace, therefore it cannot 10 | # use the regular S6-Overlay; hence this add-on uses a "old school" script 11 | # to run; with a couple of "hacks" to make it work. 12 | # ============================================================================== 13 | /etc/cont-init.d/node_exporter.sh 14 | 15 | # Start Prometheus Node Exporter 16 | exec /etc/services.d/node_exporter/run -------------------------------------------------------------------------------- /prometheus_node_exporter/translations/en.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | configuration: 3 | enable_basic_auth: 4 | name: Enable HTTP basic auth 5 | description: Toggle on to enable HTTP basic authentication (i.e., password protection) 6 | basic_auth_user: 7 | name: Basic auth username 8 | description: The basic auth username 9 | basic_auth_pass: 10 | name: Basic auth password 11 | description: The basic auth password 12 | enable_tls: 13 | name: Enable TLS 14 | description: Toggle on to enable TLS (you will need to provide a path to certificates) 15 | cert_file: 16 | name: Public key 17 | description: This is a /path/to/fullchain.pem 18 | cert_key: 19 | name: Private key 20 | description: This is a /path/to/privkey.pem 21 | cmdline_extra_args: 22 | name: Command line extra arguments 23 | description: Extra arguments to pass to the "node_exporter" command at startup (see https://github.com/prometheus/node_exporter/#installation-and-usage for more information) 24 | -------------------------------------------------------------------------------- /repository.yml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/repository#repository-configuration 2 | name: Logan Marchione Home Assistant Add-Ons 3 | url: 'https://github.com/loganmarchione/hassos-addons' 4 | maintainer: Logan Marchione 5 | --------------------------------------------------------------------------------