This commit is contained in:
2022-01-26 21:59:52 +01:00
parent 4e776537f1
commit 7844c9cbab
14 changed files with 6147 additions and 120 deletions

View File

@@ -1,6 +0,0 @@
# All Changes will be posted here
## 0.1.0 - 23/01/2022
* First release
## 0.1.00 - 23/01/2022
- Initial release after local dev

57
telegraf/Dockerfile Executable file
View File

@@ -0,0 +1,57 @@
ARG BUILD_FROM
FROM ${BUILD_FROM}
# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Setup base system
ARG BUILD_ARCH=amd64
ARG TELEGRAF_VERSION
# Setup base
RUN \
apt-get update \
&& apt-get install -y --no-install-recommends \
iputils-ping snmp procps lm-sensors smartmontools ipmitool \
&& ARCH="${BUILD_ARCH}" \
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
&& if [ "${BUILD_ARCH}" = "armv7" ]; then ARCH="armhf"; fi \
&& curl -J -L -o /tmp/telegraf.deb \
" https://dl.influxdata.com/telegraf/releases/telegraf_${TELEGRAF_VERSION}-1_${ARCH}.deb" \
&& dpkg --install /tmp/telegraf.deb \
&& rm -fr \
/tmp/* \
/var/{cache,log}/* \
/var/lib/apt/lists/*
# Copy root filesystem
COPY rootfs /
EXPOSE 8092/udp 8094 8125/udp 9273/tcp
# Build arguments
ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_DESCRIPTION
ARG BUILD_NAME
ARG BUILD_REF
ARG BUILD_REPOSITORY
ARG BUILD_VERSION
# Labels
LABEL \
io.hass.name="${BUILD_NAME}" \
io.hass.description="${BUILD_DESCRIPTION}" \
io.hass.arch="${BUILD_ARCH}" \
io.hass.type="addon" \
io.hass.version=${BUILD_VERSION} \
maintainer="fbonelle" \
org.opencontainers.image.title="${BUILD_NAME}" \
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
org.opencontainers.image.vendor="fbonelle's addons" \
org.opencontainers.image.authors="fbonelle" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.revision=${BUILD_REF} \
org.opencontainers.image.version=${BUILD_VERSION}

View File

@@ -1,66 +0,0 @@
# Telegraf Plugin for Hassio
[![GitHub Release][releases-shield]][releases]
[![License][license-shield]](LICENSE.md)
![Supports aarch64 Architecture][aarch64-shield]
![Supports amd64 Architecture][amd64-shield]
![Supports armhf Architecture][armhf-shield]
![Supports armv7 Architecture][armv7-shield]
![Supports i386 Architecture][i386-shield]
![Travis Ci][travis-shield]
[![Github Activity][commits-shield]][commits]
# Description
This is a very simple hassio plugin that ebnables you to run telegraf on your hassio system, I am still working on this so please bear with me, I am happy to accept PR's
# Installation
To Install this addon simply go to: Hassio->Addon-store.
Then add https://gitea.bonelle-family.dscloud.biz/francois.bonelle/hassio-repo.git in the add repository by URL box.
Scroll down to Francois's Repo and install Telegraf. Give it a few minutes to install and update.
# Config
The config is simple but there are some things to consider,
```yaml
custom_conf:
enabled: false
location: /share/telegraf.conf
```
This allows you to specify a custom configuration file so you can add things for yourself if this addon doesn't currently support it. Please note this must be a full telegraf config file not just parts.
## License
MIT License
Copyright (c) 2019 Robert Dunne
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg

9
telegraf/build.yaml Normal file
View File

@@ -0,0 +1,9 @@
---
build_from:
aarch64: ghcr.io/hassio-addons/debian-base/aarch64:11.0.1
amd64: ghcr.io/hassio-addons/debian-base/amd64:11.0.1
armhf: ghcr.io/hassio-addons/debian-base/armhf:11.0.1
armv7: ghcr.io/hassio-addons/debian-base/armv7:11.0.1
i386: ghcr.io/hassio-addons/debian-base/i386:11.0.1
args:
TELEGRAF_VERSION: 1.21.2

View File

@@ -1,48 +0,0 @@
{
"name": "Telegraf",
"version": "1.21.2_a",
"slug": "hassio_telegraf",
"description": "An addon to add telegraf to hassio.",
"url": "https://gitea.bonelle-family.dscloud.biz/francois.bonelle/hassio-telegraf.git",
"arch": [
"armhf",
"armv7",
"aarch64",
"amd64",
"i386"
],
"init": false,
"startup": "services",
"boot": "manual",
"hassio_api": true,
"hassio_role": "default",
"auth_api": true,
"docker_api": true,
"host_network": true,
"host_pid": true,
"apparmor": false,
"map": [
"config:rw",
"ssl:rw",
"addons:rw",
"backup:rw",
"share:rw"
],
"privileged": [
"SYS_ADMIN"
],
"full_access": true,
"options": {
"custom_conf": {
"location": "/share/telegraf.conf"
}
},
"schema": {
"custom_conf": {
"location": "str"
}
},
"ports": {
"9273/tcp": 9273
}
}

39
telegraf/config.yaml Normal file
View File

@@ -0,0 +1,39 @@
---
name: Telegraf
version: 1.21.2_a
slug: hassio_telegraf
description: An addon to add telegraf to hassio.
url: https://gitea.bonelle-family.dscloud.biz/francois.bonelle/hassio-telegraf.git
init: false
arch:
- aarch64
- amd64
- armhf
- armv7
- i386
ports:
9273/tcp: 9273
hassio_api: true
hassio_role: default
host_network: true
auth_api: true
privileged:
- SYS_ADMIN
apparmor: false
map:
- config:rw
- ssl:rw
- addons:rw
- backup:rw
- share:rw
startup: services
boot: manual
docker_api: true
host_pid: true
full_access: true
options:
custom_conf:
location: "/share/telegraf.conf"
schema:
custom_conf:
location: str

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# ==============================================================================
# Home Assistant Community Add-on: Glances
# This file turns s6-nuke into a NOOP to prevent total termination
# of the host system since the add-on runs in the same PID namespace.
# ==============================================================================
echo "S6-NUKE: NOOP"
exit 0

View File

@@ -0,0 +1,20 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Telegraf
# Configures Telegraf
# ==============================================================================
declare influx_un
declare influx_pw
declare influx_ret
declare hostname
bashio::require.unprotected
readonly CONFIG="/etc/telegraf/telegraf.conf"
CUSTOM_CONF=$(bashio::config 'custom_conf.location')
bashio::log.info "Using custom conf file"
rm /etc/telegraf/telegraf.conf
cp "${CUSTOM_CONF}" /etc/telegraf/telegraf.conf
bashio::log.info "Finished updating config"

View File

@@ -0,0 +1,3 @@
/etc/telegraf/telegraf.conf false root 0755 0755
/usr/bin/tele.sh false root 0755 0755
/usr/bin/telegraf.sh false root 0755 0755

View File

@@ -0,0 +1,8 @@
#!/usr/bin/execlineb -S0
# ==============================================================================
# Home Assistant Community Add-on: Telegraf
# ==============================================================================
if -n { s6-test $# -ne 0 }
if -n { s6-test ${1} -eq 256 }
s6-svscanctl -t /var/run/s6/services

View File

@@ -0,0 +1,10 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Home Assistant Community Add-on: Example
# Runs example1 script
# ==============================================================================
bashio::log.info "Starting Telegraf"
exec telegraf

File diff suppressed because it is too large Load Diff

18
telegraf/run.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bashio
declare influx_un
declare influx_pw
declare influx_ret
declare hostname
bashio::require.unprotected
readonly CONFIG="/etc/telegraf/telegraf.conf"
CUSTOM_CONF=$(bashio::config 'custom_conf.location')
bashio::log.info "Using custom conf file"
rm /etc/telegraf/telegraf.conf
cp "${CUSTOM_CONF}" /etc/telegraf/telegraf.conf
bashio::log.info "Finished updating config, Starting Telegraf"
telegraf