copy from official addon
This commit is contained in:
66
.yamllint
Normal file
66
.yamllint
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
level: error
|
||||||
|
min-spaces-inside: 0
|
||||||
|
max-spaces-inside: 1
|
||||||
|
min-spaces-inside-empty: -1
|
||||||
|
max-spaces-inside-empty: -1
|
||||||
|
brackets:
|
||||||
|
level: error
|
||||||
|
min-spaces-inside: 0
|
||||||
|
max-spaces-inside: 0
|
||||||
|
min-spaces-inside-empty: -1
|
||||||
|
max-spaces-inside-empty: -1
|
||||||
|
colons:
|
||||||
|
level: error
|
||||||
|
max-spaces-before: 0
|
||||||
|
max-spaces-after: 1
|
||||||
|
commas:
|
||||||
|
level: error
|
||||||
|
max-spaces-before: 0
|
||||||
|
min-spaces-after: 1
|
||||||
|
max-spaces-after: 1
|
||||||
|
comments:
|
||||||
|
level: error
|
||||||
|
require-starting-space: true
|
||||||
|
min-spaces-from-content: 2
|
||||||
|
comments-indentation:
|
||||||
|
level: error
|
||||||
|
document-end:
|
||||||
|
level: error
|
||||||
|
present: false
|
||||||
|
document-start:
|
||||||
|
level: error
|
||||||
|
present: true
|
||||||
|
empty-lines:
|
||||||
|
level: error
|
||||||
|
max: 1
|
||||||
|
max-start: 0
|
||||||
|
max-end: 1
|
||||||
|
hyphens:
|
||||||
|
level: error
|
||||||
|
max-spaces-after: 1
|
||||||
|
indentation:
|
||||||
|
level: error
|
||||||
|
spaces: 2
|
||||||
|
indent-sequences: true
|
||||||
|
check-multi-line-strings: false
|
||||||
|
key-duplicates:
|
||||||
|
level: error
|
||||||
|
line-length:
|
||||||
|
ignore: |
|
||||||
|
.github/support.yml
|
||||||
|
level: warning
|
||||||
|
max: 120
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
allow-non-breakable-inline-mappings: true
|
||||||
|
new-line-at-end-of-file:
|
||||||
|
level: error
|
||||||
|
new-lines:
|
||||||
|
level: error
|
||||||
|
type: unix
|
||||||
|
trailing-spaces:
|
||||||
|
level: error
|
||||||
|
truthy:
|
||||||
|
level: error
|
||||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2025 Franck Nijhof
|
||||||
|
|
||||||
|
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.
|
||||||
127
README.md
Normal file
127
README.md
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
|
||||||
|
[![GitHub Release][releases-shield]][releases]
|
||||||
|
![Project Stage][project-stage-shield]
|
||||||
|
[![License][license-shield]](LICENSE.md)
|
||||||
|
|
||||||
|
![Supports aarch64 Architecture][aarch64-shield]
|
||||||
|
![Supports amd64 Architecture][amd64-shield]
|
||||||
|
|
||||||
|
[![Github Actions][github-actions-shield]][github-actions]
|
||||||
|
![Project Maintenance][maintenance-shield]
|
||||||
|
[![GitHub Activity][commits-shield]][commits]
|
||||||
|
|
||||||
|
[![Discord][discord-shield]][discord]
|
||||||
|
[![Community Forum][forum-shield]][forum]
|
||||||
|
|
||||||
|
[![Sponsor Frenck via GitHub Sponsors][github-sponsors-shield]][github-sponsors]
|
||||||
|
|
||||||
|
[![Support Frenck on Patreon][patreon-shield]][patreon]
|
||||||
|
|
||||||
|
The open platform for beautiful analytics and monitoring.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
The analytics platform for all your metrics.
|
||||||
|
|
||||||
|
Grafana allows you to query, visualize, alert on and understand your metrics
|
||||||
|
no matter where they are stored. Create, explore, and share dashboards. Learn
|
||||||
|
about your Home Automation system using sexy and compelling graphs, and other
|
||||||
|
data visualizations.
|
||||||
|
|
||||||
|
Combine this add-on with the InfluxDB add-on to get insanely powerful
|
||||||
|
insights to your home.
|
||||||
|
|
||||||
|
[:books: Read the full add-on documentation][docs]
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Got questions?
|
||||||
|
|
||||||
|
You have several options to get them answered:
|
||||||
|
|
||||||
|
- The [Home Assistant Community Add-ons Discord chat server][discord] for add-on
|
||||||
|
support and feature requests.
|
||||||
|
- The [Home Assistant Discord chat server][discord-ha] for general Home
|
||||||
|
Assistant discussions and questions.
|
||||||
|
- The Home Assistant [Community Forum][forum].
|
||||||
|
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||||
|
|
||||||
|
You could also [open an issue here][issue] GitHub.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
This is an active open-source project. We are always open to people who want to
|
||||||
|
use the code or contribute to it.
|
||||||
|
|
||||||
|
We have set up a separate document containing our
|
||||||
|
[contribution guidelines](.github/CONTRIBUTING.md).
|
||||||
|
|
||||||
|
Thank you for being involved! :heart_eyes:
|
||||||
|
|
||||||
|
## Authors & contributors
|
||||||
|
|
||||||
|
The original setup of this repository is by [Franck Nijhof][frenck].
|
||||||
|
|
||||||
|
For a full list of all authors and contributors,
|
||||||
|
check [the contributor's page][contributors].
|
||||||
|
|
||||||
|
## We have got some Home Assistant add-ons for you
|
||||||
|
|
||||||
|
Want some more functionality to your Home Assistant instance?
|
||||||
|
|
||||||
|
We have created multiple add-ons for Home Assistant. For a full list, check out
|
||||||
|
our [GitHub Repository][repository].
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2025 Franck Nijhof
|
||||||
|
|
||||||
|
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
|
||||||
|
[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/addon-grafana.svg
|
||||||
|
[commits]: https://github.com/hassio-addons/addon-grafana/commits/main
|
||||||
|
[contributors]: https://github.com/hassio-addons/addon-grafana/graphs/contributors
|
||||||
|
[discord-ha]: https://discord.gg/c5DvZ4e
|
||||||
|
[discord-shield]: https://img.shields.io/discord/478094546522079232.svg
|
||||||
|
[discord]: https://discord.me/hassioaddons
|
||||||
|
[docs]: https://github.com/hassio-addons/addon-grafana/blob/main/grafana/DOCS.md
|
||||||
|
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
|
||||||
|
[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-grafana/54674?u=frenck
|
||||||
|
[frenck]: https://github.com/frenck
|
||||||
|
[github-actions-shield]: https://github.com/hassio-addons/addon-grafana/workflows/CI/badge.svg
|
||||||
|
[github-actions]: https://github.com/hassio-addons/addon-grafana/actions
|
||||||
|
[github-sponsors-shield]: https://frenck.dev/wp-content/uploads/2019/12/github_sponsor.png
|
||||||
|
[github-sponsors]: https://github.com/sponsors/frenck
|
||||||
|
[issue]: https://github.com/hassio-addons/addon-grafana/issues
|
||||||
|
[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-grafana.svg
|
||||||
|
[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg
|
||||||
|
[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png
|
||||||
|
[patreon]: https://www.patreon.com/frenck
|
||||||
|
[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg
|
||||||
|
[reddit]: https://reddit.com/r/homeassistant
|
||||||
|
[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-grafana.svg
|
||||||
|
[releases]: https://github.com/hassio-addons/addon-grafana/releases
|
||||||
|
[repository]: https://github.com/hassio-addons/repository
|
||||||
78
grafana/.README.j2
Normal file
78
grafana/.README.j2
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
|
||||||
|
[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield]
|
||||||
|
|
||||||
|
[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum]
|
||||||
|
|
||||||
|
[![Sponsor Frenck via GitHub Sponsors][github-sponsors-shield]][github-sponsors]
|
||||||
|
|
||||||
|
[![Support Frenck on Patreon][patreon-shield]][patreon]
|
||||||
|
|
||||||
|
The open platform for beautiful analytics and monitoring.
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
The analytics platform for all your metrics.
|
||||||
|
|
||||||
|
Grafana allows you to query, visualize, alert on and understand your metrics
|
||||||
|
no matter where they are stored. Create, explore, and share dashboards. Learn
|
||||||
|
about your Home Automation system using sexy and compelling graphs, and other
|
||||||
|
data visualizations.
|
||||||
|
|
||||||
|
Combine this add-on with the InfluxDB add-on to get insanely powerful
|
||||||
|
insights to your home.
|
||||||
|
|
||||||
|
![Grafana in the Home Assistant Frontend][screenshot]
|
||||||
|
|
||||||
|
{% if channel == "edge" %}
|
||||||
|
## WARNING! THIS IS AN EDGE VERSION!
|
||||||
|
|
||||||
|
This Home Assistant Add-ons repository contains edge builds of add-ons.
|
||||||
|
Edge builds add-ons are based upon the latest development version.
|
||||||
|
|
||||||
|
- They may not work at all.
|
||||||
|
- They might stop working at any time.
|
||||||
|
- They could have a negative impact on your system.
|
||||||
|
|
||||||
|
This repository was created for:
|
||||||
|
|
||||||
|
- Anybody willing to test.
|
||||||
|
- Anybody interested in trying out upcoming add-ons or add-on features.
|
||||||
|
- Developers.
|
||||||
|
|
||||||
|
If you are more interested in stable releases of our add-ons:
|
||||||
|
|
||||||
|
<https://github.com/hassio-addons/repository>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
{% if channel == "beta" %}
|
||||||
|
## WARNING! THIS IS A BETA VERSION!
|
||||||
|
|
||||||
|
This Home Assistant Add-ons repository contains beta releases of add-ons.
|
||||||
|
|
||||||
|
- They might stop working at any time.
|
||||||
|
- They could have a negative impact on your system.
|
||||||
|
|
||||||
|
This repository was created for:
|
||||||
|
|
||||||
|
- Anybody willing to test.
|
||||||
|
- Anybody interested in trying out upcoming add-ons or add-on features.
|
||||||
|
|
||||||
|
If you are more interested in stable releases of our add-ons:
|
||||||
|
|
||||||
|
<https://github.com/hassio-addons/repository>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
[discord-shield]: https://img.shields.io/discord/478094546522079232.svg
|
||||||
|
[discord]: https://discord.me/hassioaddons
|
||||||
|
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
|
||||||
|
[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-grafana/54674?u=frenck
|
||||||
|
[github-sponsors-shield]: https://frenck.dev/wp-content/uploads/2019/12/github_sponsor.png
|
||||||
|
[github-sponsors]: https://github.com/sponsors/frenck
|
||||||
|
[maintenance-shield]: https://img.shields.io/maintenance/yes/2025.svg
|
||||||
|
[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png
|
||||||
|
[patreon]: https://www.patreon.com/frenck
|
||||||
|
[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg
|
||||||
|
[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg
|
||||||
|
[release]: {{ repo }}/tree/{{ version }}
|
||||||
|
[screenshot]: https://github.com/hassio-addons/addon-grafana/raw/main/images/screenshot.png
|
||||||
234
grafana/DOCS.md
Normal file
234
grafana/DOCS.md
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
|
||||||
|
The analytics platform for all your metrics.
|
||||||
|
|
||||||
|
Grafana allows you to query, visualize, alert on and understand your metrics
|
||||||
|
no matter where they are stored. Create, explore, and share dashboards. Learn
|
||||||
|
about your Home Automation system using sexy and compelling graphs, and other
|
||||||
|
data visualizations.
|
||||||
|
|
||||||
|
Combine this add-on with the InfluxDB add-on to get insanely powerful
|
||||||
|
insights to your home.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
The installation of this add-on is pretty straightforward and not different in
|
||||||
|
comparison to installing any other Home Assistant add-on.
|
||||||
|
|
||||||
|
1. Click the Home Assistant My button below to open the add-on on your Home
|
||||||
|
Assistant instance.
|
||||||
|
|
||||||
|
[![Open this add-on in your Home Assistant instance.][addon-badge]][addon]
|
||||||
|
|
||||||
|
1. Click the "Install" button to install the add-on.
|
||||||
|
1. Start the "Grafana" add-on.
|
||||||
|
1. Check the logs of the "Grafana" to see if everything went well.
|
||||||
|
1. Open the Web UI.
|
||||||
|
|
||||||
|
**Note**: As the addon now supports both Ingress and direct access, the default
|
||||||
|
`admin` user has a password of `hassio`. **Due to the implementation the
|
||||||
|
password cannot be changed, however you can delete and create a new user, if so
|
||||||
|
please ensure to update the `grafana_ingress_user` option.**
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
**Note**: _Remember to restart the add-on when the configuration is changed._
|
||||||
|
|
||||||
|
Example add-on configuration:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
log_level: info
|
||||||
|
grafana_ingress_user: frenck
|
||||||
|
plugins:
|
||||||
|
- ayoungprogrammer-finance-datasource
|
||||||
|
- grafana-clock-panel
|
||||||
|
env_vars:
|
||||||
|
- name: GF_DEFAULT_INSTANCE_NAME
|
||||||
|
value: Hassio
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: _This is just an example, don't copy and paste it! Create your own!_
|
||||||
|
|
||||||
|
### Option: `log_level`
|
||||||
|
|
||||||
|
The `log_level` option controls the level of log output by the addon and can
|
||||||
|
be changed to be more or less verbose, which might be useful when you are
|
||||||
|
dealing with an unknown issue. Possible values are:
|
||||||
|
|
||||||
|
- `trace`: Show every detail, like all called internal functions.
|
||||||
|
- `debug`: Shows detailed debug information.
|
||||||
|
- `info`: Normal (usually) interesting events.
|
||||||
|
- `warning`: Exceptional occurrences that are not errors.
|
||||||
|
- `error`: Runtime errors that do not require immediate action.
|
||||||
|
- `fatal`: Something went terribly wrong. Add-on becomes unusable.
|
||||||
|
|
||||||
|
Please note that each level automatically includes log messages from a
|
||||||
|
more severe level, e.g., `debug` also shows `info` messages. By default,
|
||||||
|
the `log_level` is set to `info`, which is the recommended setting unless
|
||||||
|
you are troubleshooting.
|
||||||
|
|
||||||
|
### Option: `grafana_ingress_user`
|
||||||
|
|
||||||
|
When using Ingress grafana will automatically log in by default with a username
|
||||||
|
of `admin`. If a different user is required this option can be set.
|
||||||
|
|
||||||
|
### Option: `plugins`
|
||||||
|
|
||||||
|
Allows you to specify additional Grafana plugins to be installed to your
|
||||||
|
Grafana setup. For a list of available plugins, see:
|
||||||
|
|
||||||
|
<https://grafana.com/plugins>
|
||||||
|
|
||||||
|
**Note**: _Adding plugins will result in a longer start-up for the add-on._
|
||||||
|
|
||||||
|
### Option: `custom_plugins`
|
||||||
|
|
||||||
|
Allows you to specify additional Grafana custom plugins to be installed to your
|
||||||
|
Grafana setup from an URL.
|
||||||
|
You must specify the property `url` to the plugin configuration.
|
||||||
|
|
||||||
|
If you want to install unsigned plugins, you must also set the `unsigned` property to `true`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
custom_plugins:
|
||||||
|
- name: my-plugin-name
|
||||||
|
url: https://github.com/my-repo/my-plugin-name/releases/download/0.1.0/my-plugin-name-0.1.0.zip
|
||||||
|
unsigned: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option: `env_vars`
|
||||||
|
|
||||||
|
This option allows you to tweak every aspect of Grafana by setting
|
||||||
|
configuration options using environment variables. See the example at the
|
||||||
|
start of this chapter to get an idea of how the configuration looks.
|
||||||
|
|
||||||
|
For more information about using these variables, see the official Grafana
|
||||||
|
documentation:
|
||||||
|
|
||||||
|
<http://docs.grafana.org/installation/configuration/#using-environment-variables>
|
||||||
|
|
||||||
|
**Note**: _Only environment variables starting with `GF_` are accepted.\_
|
||||||
|
|
||||||
|
## Using it with the InfluxDB Community add-on
|
||||||
|
|
||||||
|
Grafana does not come out of the box pre-configured, but letting it interact
|
||||||
|
with the community [InfluxDB add-on][influxdb-addon] is pretty easy. Please,
|
||||||
|
follow the instructions from the on how to [create a database][create-db]
|
||||||
|
for Home Assistant.
|
||||||
|
|
||||||
|
1. Create a new user for Grafana on InfluxDB
|
||||||
|
(InfluxDB Admin -> Users and "+ Create User")
|
||||||
|
1. Login into Grafana
|
||||||
|
1. Create a new datasource:
|
||||||
|
|
||||||
|
- Name: Anything you want, e.g., Home Assistant
|
||||||
|
- Type: InfluxDB
|
||||||
|
- HTTP > URL: `http://a0d7b954-influxdb:8086`
|
||||||
|
- HTTP > Access: Server (Default)
|
||||||
|
- Auth: (leave them all disabled)
|
||||||
|
- InfluxDB Details > Database: _Your Home Assistant InfluxDB database_,
|
||||||
|
e.g., `homeassistant`
|
||||||
|
- InfluxDB Details > User: _Grafana InfluxDB username defined in step 1_
|
||||||
|
- InfluxDB Details > Password: _Grafana InfluxDB user password defined_
|
||||||
|
_in step 1_
|
||||||
|
|
||||||
|
1. Hit Save & Test
|
||||||
|
|
||||||
|
## Anonymous Access
|
||||||
|
|
||||||
|
Anonymous access on a local network is possible by exposing the port in the
|
||||||
|
add-on configuration, along with setting the following environment variables:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
env_vars:
|
||||||
|
- name: GF_AUTH_ANONYMOUS_ENABLED
|
||||||
|
value: "true"
|
||||||
|
- name: GF_AUTH_ANONYMOUS_ORG_NAME
|
||||||
|
value: "Main Org."
|
||||||
|
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
|
||||||
|
value: "Viewer"
|
||||||
|
```
|
||||||
|
|
||||||
|
It is not possible to enable anonymous or non-administrator access with Home
|
||||||
|
Assistant Cloud. This includes embedding Grafana resources with an iframe or
|
||||||
|
rendered image inside of a dashboard. For more details see
|
||||||
|
[Anonymous login not working, Grafana add-on 3.0.0 #55](https://github.com/hassio-addons/addon-grafana/issues/55).
|
||||||
|
|
||||||
|
## Known issues and limitations
|
||||||
|
|
||||||
|
- `To render a panel image, you must install the Grafana Image Renderer plugin.`
|
||||||
|
This message is shown on ARM devices, like a Raspberry Pi. The Grafana Image
|
||||||
|
Renderer plugin is not available for these devices.
|
||||||
|
|
||||||
|
## Changelog & Releases
|
||||||
|
|
||||||
|
This repository keeps a change log using [GitHub's releases][releases]
|
||||||
|
functionality.
|
||||||
|
|
||||||
|
Releases are based on [Semantic Versioning][semver], and use the format
|
||||||
|
of `MAJOR.MINOR.PATCH`. In a nutshell, the version will be incremented
|
||||||
|
based on the following:
|
||||||
|
|
||||||
|
- `MAJOR`: Incompatible or major changes.
|
||||||
|
- `MINOR`: Backwards-compatible new features and enhancements.
|
||||||
|
- `PATCH`: Backwards-compatible bugfixes and package updates.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
Got questions?
|
||||||
|
|
||||||
|
You have several options to get them answered:
|
||||||
|
|
||||||
|
- The [Home Assistant Community Add-ons Discord chat server][discord] for add-on
|
||||||
|
support and feature requests.
|
||||||
|
- The [Home Assistant Discord chat server][discord-ha] for general Home
|
||||||
|
Assistant discussions and questions.
|
||||||
|
- The Home Assistant [Community Forum][forum].
|
||||||
|
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||||
|
|
||||||
|
You could also [open an issue here][issue] GitHub.
|
||||||
|
|
||||||
|
## Authors & contributors
|
||||||
|
|
||||||
|
The original setup of this repository is by [Franck Nijhof][frenck].
|
||||||
|
|
||||||
|
For a full list of all authors and contributors,
|
||||||
|
check [the contributor's page][contributors].
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-2025 Franck Nijhof
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
[addon-badge]: https://my.home-assistant.io/badges/supervisor_addon.svg
|
||||||
|
[addon]: https://my.home-assistant.io/redirect/supervisor_addon/?addon=a0d7b954_grafana&repository_url=https%3A%2F%2Fgithub.com%2Fhassio-addons%2Frepository
|
||||||
|
[contributors]: https://github.com/hassio-addons/addon-grafana/graphs/contributors
|
||||||
|
[create-db]: https://github.com/hassio-addons/addon-influxdb/blob/main/influxdb/DOCS.md#integrating-into-home-assistant
|
||||||
|
[discord-ha]: https://discord.gg/c5DvZ4e
|
||||||
|
[discord]: https://discord.me/hassioaddons
|
||||||
|
[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-grafana/54674?u=frenck
|
||||||
|
[frenck]: https://github.com/frenck
|
||||||
|
[influxdb-addon]: https://github.com/hassio-addons/addon-influxdb
|
||||||
|
[issue]: https://github.com/hassio-addons/addon-grafana/issues
|
||||||
|
[reddit]: https://reddit.com/r/homeassistant
|
||||||
|
[releases]: https://github.com/hassio-addons/addon-grafana/releases
|
||||||
|
[semver]: https://semver.org/spec/v2.0.0.html
|
||||||
99
grafana/Dockerfile
Normal file
99
grafana/Dockerfile
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base/amd64:9.1.0
|
||||||
|
# hadolint ignore=DL3006
|
||||||
|
FROM ${BUILD_FROM}
|
||||||
|
|
||||||
|
# Set shell
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
# Setup base system
|
||||||
|
ARG BUILD_ARCH=amd64
|
||||||
|
ARG GRAFANA_VERSION="v12.3.1"
|
||||||
|
ARG GRAFANA_IMAGE_RENDERER_VERSION="v4.1.5"
|
||||||
|
RUN \
|
||||||
|
ARCH="${BUILD_ARCH}" \
|
||||||
|
&& if [ "${BUILD_ARCH}" = "aarch64" ]; then ARCH="arm64"; fi \
|
||||||
|
\
|
||||||
|
&& curl -J -L -o /tmp/grafana.deb \
|
||||||
|
"https://dl.grafana.com/oss/release/grafana_${GRAFANA_VERSION#v}_${ARCH}.deb" \
|
||||||
|
\
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
fonts-noto-cjk=1:20240730+repack1-1 \
|
||||||
|
libfontconfig1=2.15.0-2.3 \
|
||||||
|
memcached=1.6.38-1 \
|
||||||
|
musl=1.2.5-3 \
|
||||||
|
nginx=1.26.3-3+deb13u1 \
|
||||||
|
\
|
||||||
|
&& dpkg --install /tmp/grafana.deb \
|
||||||
|
\
|
||||||
|
&& if [ "${BUILD_ARCH}" = "amd64" ]; then \
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
libasound2t64=1.2.14-1 \
|
||||||
|
libcups2t64=2.4.10-3+deb13u1 \
|
||||||
|
libdbus-1-3=1.16.2-2 \
|
||||||
|
libdrm-amdgpu1=2.4.124-2 \
|
||||||
|
libgbm1=25.0.7-2 \
|
||||||
|
libglib2.0-0t64=2.84.4-3~deb13u1 \
|
||||||
|
libgtk-4-1=4.18.6+ds-2 \
|
||||||
|
libnss3=2:3.110-1 \
|
||||||
|
libx11-6=2:1.8.12-1 \
|
||||||
|
libx11-xcb1=2:1.8.12-1 \
|
||||||
|
libxcb-dri3-0=1.17.0-2+b1 \
|
||||||
|
libxcomposite1=1:0.4.6-1 \
|
||||||
|
libxcursor1=1:1.2.3-1 \
|
||||||
|
libxdamage1=1:1.1.6-1+b2 \
|
||||||
|
libxext6=2:1.3.4-1+b3 \
|
||||||
|
libxfixes3=1:6.0.0-2+b4 \
|
||||||
|
libxi6=2:1.8.2-1 \
|
||||||
|
libxrandr2=2:1.5.4-1+b3 \
|
||||||
|
libxrender1=1:0.9.12-1 \
|
||||||
|
libxshmfence1=1.3.3-1 \
|
||||||
|
libxss1=1:1.2.3-1+b3 \
|
||||||
|
libxtst6=2:1.2.5-1 \
|
||||||
|
&& grafana-cli plugins install "grafana-image-renderer" "${GRAFANA_IMAGE_RENDERER_VERSION#v}"; \
|
||||||
|
fi \
|
||||||
|
\
|
||||||
|
&& rm -fr \
|
||||||
|
/tmp/* \
|
||||||
|
/var/{cache,log}/* \
|
||||||
|
/var/lib/apt/lists/* \
|
||||||
|
/etc/nginx \
|
||||||
|
\
|
||||||
|
&& mkdir -p /var/log/nginx \
|
||||||
|
&& touch /var/log/nginx/error.log
|
||||||
|
|
||||||
|
# Copy root filesystem
|
||||||
|
COPY rootfs /
|
||||||
|
|
||||||
|
# Health check
|
||||||
|
HEALTHCHECK \
|
||||||
|
CMD curl --fail http://127.0.0.1:1337/api/health || exit 1
|
||||||
|
|
||||||
|
# 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="Franck Nijhof <frenck@addons.community>" \
|
||||||
|
io.hass.name="${BUILD_NAME}" \
|
||||||
|
io.hass.description="${BUILD_DESCRIPTION}" \
|
||||||
|
org.opencontainers.image.vendor="Home Assistant Community Add-ons" \
|
||||||
|
org.opencontainers.image.authors="Franck Nijhof <frenck@addons.community>" \
|
||||||
|
org.opencontainers.image.licenses="MIT" \
|
||||||
|
org.opencontainers.image.url="https://addons.community" \
|
||||||
|
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
||||||
|
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
||||||
|
org.opencontainers.image.created=${BUILD_DATE} \
|
||||||
|
org.opencontainers.image.revision=${BUILD_REF} \
|
||||||
|
org.opencontainers.image.version=${BUILD_VERSION}
|
||||||
4
grafana/build.yaml
Normal file
4
grafana/build.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
build_from:
|
||||||
|
aarch64: ghcr.io/hassio-addons/debian-base/aarch64:9.1.0
|
||||||
|
amd64: ghcr.io/hassio-addons/debian-base/amd64:9.1.0
|
||||||
46
grafana/config.yaml
Normal file
46
grafana/config.yaml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
---
|
||||||
|
name: Grafana
|
||||||
|
version: dev
|
||||||
|
slug: grafana
|
||||||
|
description: The open platform for beautiful analytics and monitoring
|
||||||
|
url: https://github.com/hassio-addons/addon-grafana
|
||||||
|
startup: services
|
||||||
|
ingress: true
|
||||||
|
ingress_port: 1337
|
||||||
|
ingress_stream: true
|
||||||
|
init: false
|
||||||
|
panel_icon: mdi:chart-timeline
|
||||||
|
panel_title: Grafana
|
||||||
|
arch:
|
||||||
|
- aarch64
|
||||||
|
- amd64
|
||||||
|
map:
|
||||||
|
- homeassistant_config
|
||||||
|
- share
|
||||||
|
- ssl
|
||||||
|
options:
|
||||||
|
plugins: []
|
||||||
|
custom_plugins: []
|
||||||
|
env_vars: []
|
||||||
|
ssl: true
|
||||||
|
certfile: fullchain.pem
|
||||||
|
keyfile: privkey.pem
|
||||||
|
ports:
|
||||||
|
80/tcp: null
|
||||||
|
ports_description:
|
||||||
|
80/tcp: Not required for Ingress
|
||||||
|
schema:
|
||||||
|
log_level: list(trace|debug|info|notice|warning|error|fatal)?
|
||||||
|
plugins:
|
||||||
|
- str
|
||||||
|
custom_plugins:
|
||||||
|
- name: str
|
||||||
|
url: str
|
||||||
|
unsigned: bool?
|
||||||
|
certfile: str
|
||||||
|
keyfile: str
|
||||||
|
ssl: bool
|
||||||
|
grafana_ingress_user: str?
|
||||||
|
env_vars:
|
||||||
|
- name: match(^GF_([A-Z0-9_])+$)
|
||||||
|
value: str
|
||||||
BIN
grafana/icon.png
Normal file
BIN
grafana/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
grafana/logo.png
Normal file
BIN
grafana/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
332
grafana/rootfs/etc/grafana/grafana.ini
Normal file
332
grafana/rootfs/etc/grafana/grafana.ini
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
##################### Grafana Configuration Defaults #####################
|
||||||
|
#
|
||||||
|
# Do not modify this file in grafana installs
|
||||||
|
#
|
||||||
|
|
||||||
|
# possible values : production, development
|
||||||
|
app_mode = production
|
||||||
|
|
||||||
|
instance_name = Home Assistant
|
||||||
|
|
||||||
|
#################################### Paths ####################################
|
||||||
|
[paths]
|
||||||
|
# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
|
||||||
|
#
|
||||||
|
data = /data
|
||||||
|
#
|
||||||
|
# Directory where grafana can store logs
|
||||||
|
#
|
||||||
|
logs = /var/logs/grafana
|
||||||
|
#
|
||||||
|
# Directory where grafana will automatically scan and look for plugins
|
||||||
|
#
|
||||||
|
plugins = /var/lib/grafana/plugins
|
||||||
|
|
||||||
|
#################################### Plugins ####################################
|
||||||
|
[plugins]
|
||||||
|
allow_loading_unsigned_plugins =
|
||||||
|
|
||||||
|
#################################### Server ####################################
|
||||||
|
[server]
|
||||||
|
# Protocol (http or https)
|
||||||
|
protocol = http
|
||||||
|
|
||||||
|
# The ip address to bind to, empty will bind to all interfaces
|
||||||
|
http_addr =
|
||||||
|
|
||||||
|
# The http port to use
|
||||||
|
http_port = 3000
|
||||||
|
|
||||||
|
# The public facing domain name used to access grafana from a browser
|
||||||
|
domain = localhost
|
||||||
|
|
||||||
|
# Redirect to correct domain if host header does not match domain
|
||||||
|
# Prevents DNS rebinding attacks
|
||||||
|
enforce_domain = false
|
||||||
|
|
||||||
|
# The full public facing url
|
||||||
|
root_url = %(protocol)s://%(domain)s:%(http_port)s%%ingress_entry%%
|
||||||
|
|
||||||
|
# Log web requests
|
||||||
|
router_logging = false
|
||||||
|
|
||||||
|
# the path relative working path
|
||||||
|
static_root_path = public
|
||||||
|
|
||||||
|
# enable gzip
|
||||||
|
enable_gzip = true
|
||||||
|
|
||||||
|
# https certs & key file
|
||||||
|
cert_file = false
|
||||||
|
cert_key = false
|
||||||
|
|
||||||
|
#################################### Database ####################################
|
||||||
|
[database]
|
||||||
|
# Either "mysql", "postgres" or "sqlite3", it's your choice
|
||||||
|
type = sqlite3
|
||||||
|
host = 127.0.0.1:3306
|
||||||
|
name = grafana
|
||||||
|
user = root
|
||||||
|
password =
|
||||||
|
|
||||||
|
# For "postgres", use either "disable", "require" or "verify-full"
|
||||||
|
# For "mysql", use either "true", "false", or "skip-verify".
|
||||||
|
ssl_mode = disable
|
||||||
|
|
||||||
|
ca_cert_path =
|
||||||
|
client_key_path =
|
||||||
|
client_cert_path =
|
||||||
|
server_cert_name =
|
||||||
|
|
||||||
|
# For "sqlite3" only, path relative to data_path setting
|
||||||
|
path = grafana.db
|
||||||
|
|
||||||
|
################################# Remote Cache ####################################
|
||||||
|
[remote_cache]
|
||||||
|
type = memcached
|
||||||
|
connstr = 127.0.0.1:11211
|
||||||
|
|
||||||
|
#################################### Analytics ####################################
|
||||||
|
[analytics]
|
||||||
|
# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
|
||||||
|
# No ip addresses are being tracked, only simple counters to track
|
||||||
|
# running instances, dashboard and error counts. It is very helpful to us.
|
||||||
|
# Change this option to false to disable reporting.
|
||||||
|
reporting_enabled = true
|
||||||
|
|
||||||
|
# Set to false to disable all checks to https://grafana.net
|
||||||
|
# for new vesions (grafana itself and plugins), check is used
|
||||||
|
# in some UI views to notify that grafana or plugin update exists
|
||||||
|
# This option does not cause any auto updates, nor send any information
|
||||||
|
# only a GET request to http://grafana.net to get latest versions
|
||||||
|
check_for_updates = true
|
||||||
|
|
||||||
|
# Google Analytics universal tracking code, only enabled if you specify an id here
|
||||||
|
google_analytics_ua_id =
|
||||||
|
|
||||||
|
# Google Tag Manager ID, only enabled if you specify an id here
|
||||||
|
google_tag_manager_id =
|
||||||
|
|
||||||
|
#################################### Security ####################################
|
||||||
|
[security]
|
||||||
|
# default admin user, created on startup
|
||||||
|
admin_user = admin
|
||||||
|
|
||||||
|
# default admin password, can be changed before first start of grafana, or in profile settings
|
||||||
|
admin_password = hassio
|
||||||
|
|
||||||
|
# used for signing
|
||||||
|
secret_key = SW2YcwTIb9zpOOhoPsMm
|
||||||
|
|
||||||
|
# Auto-login remember days
|
||||||
|
login_remember_days = 7
|
||||||
|
cookie_username = grafana_user
|
||||||
|
cookie_remember_name = grafana_remember
|
||||||
|
|
||||||
|
# disable gravatar profile images
|
||||||
|
disable_gravatar = false
|
||||||
|
|
||||||
|
# data source proxy whitelist (ip_or_domain:port seperated by spaces)
|
||||||
|
data_source_proxy_whitelist =
|
||||||
|
|
||||||
|
# allow Grafana interface to be embeded, since this is done a lot
|
||||||
|
# with Home Assistant, this is on by default.
|
||||||
|
allow_embedding = true
|
||||||
|
|
||||||
|
[snapshots]
|
||||||
|
# snapshot sharing options
|
||||||
|
external_enabled = true
|
||||||
|
external_snapshot_url = https://snapshots-origin.raintank.io
|
||||||
|
external_snapshot_name = Publish to snapshot.raintank.io
|
||||||
|
|
||||||
|
#################################### Users ####################################
|
||||||
|
[users]
|
||||||
|
# disable user signup / registration
|
||||||
|
allow_sign_up = false
|
||||||
|
|
||||||
|
# Allow non admin users to create organizations
|
||||||
|
allow_org_create = false
|
||||||
|
|
||||||
|
# Set to true to automatically assign new users to the default organization (id 1)
|
||||||
|
auto_assign_org = true
|
||||||
|
|
||||||
|
# Default role new users will be automatically assigned (if auto_assign_org above is set to true)
|
||||||
|
auto_assign_org_role = Admin
|
||||||
|
|
||||||
|
# Require email validation before sign up completes
|
||||||
|
verify_email_enabled = false
|
||||||
|
|
||||||
|
# Background text for the user field on the login page
|
||||||
|
login_hint = email or username
|
||||||
|
|
||||||
|
#################################### Anonymous Auth ##########################
|
||||||
|
[auth.anonymous]
|
||||||
|
# enable anonymous access
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
# specify organization name that should be used for unauthenticated users
|
||||||
|
org_name = Main Org.
|
||||||
|
|
||||||
|
# specify role for unauthenticated users
|
||||||
|
org_role = Viewer
|
||||||
|
|
||||||
|
#################################### Github Auth ##########################
|
||||||
|
[auth.github]
|
||||||
|
enabled = false
|
||||||
|
allow_sign_up = false
|
||||||
|
client_id = some_id
|
||||||
|
client_secret = some_secret
|
||||||
|
scopes = user:email
|
||||||
|
auth_url = https://github.com/login/oauth/authorize
|
||||||
|
token_url = https://github.com/login/oauth/access_token
|
||||||
|
api_url = https://api.github.com/user
|
||||||
|
team_ids =
|
||||||
|
allowed_organizations =
|
||||||
|
|
||||||
|
#################################### Google Auth ##########################
|
||||||
|
[auth.google]
|
||||||
|
enabled = false
|
||||||
|
allow_sign_up = false
|
||||||
|
client_id = some_client_id
|
||||||
|
client_secret = some_client_secret
|
||||||
|
scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
|
||||||
|
auth_url = https://accounts.google.com/o/oauth2/auth
|
||||||
|
token_url = https://accounts.google.com/o/oauth2/token
|
||||||
|
allowed_domains =
|
||||||
|
|
||||||
|
#################################### Basic Auth ##########################
|
||||||
|
[auth.basic]
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
#################################### Auth Proxy ##########################
|
||||||
|
[auth.proxy]
|
||||||
|
enabled = true
|
||||||
|
header_name = X-WEBAUTH-USER
|
||||||
|
header_property = username
|
||||||
|
auto_sign_up = true
|
||||||
|
whitelist = 127.0.0.1
|
||||||
|
|
||||||
|
#################################### Auth LDAP ##########################
|
||||||
|
[auth.ldap]
|
||||||
|
enabled = false
|
||||||
|
config_file = /etc/grafana/ldap.toml
|
||||||
|
|
||||||
|
#################################### SMTP / Emailing ##########################
|
||||||
|
[smtp]
|
||||||
|
enabled = false
|
||||||
|
host = localhost:25
|
||||||
|
user =
|
||||||
|
password =
|
||||||
|
cert_file =
|
||||||
|
key_file =
|
||||||
|
skip_verify = false
|
||||||
|
from_address = admin@grafana.localhost
|
||||||
|
|
||||||
|
[emails]
|
||||||
|
welcome_email_on_sign_up = false
|
||||||
|
templates_pattern = emails/*.html
|
||||||
|
|
||||||
|
#################################### Logging ##########################
|
||||||
|
[log]
|
||||||
|
# Either "console", "file", "syslog". Default is console and file
|
||||||
|
# Use comma to separate multiple modes, e.g. "console, file"
|
||||||
|
mode = console
|
||||||
|
|
||||||
|
# Buffer length of channel, keep it as it is if you don't know what it is.
|
||||||
|
buffer_len = 10000
|
||||||
|
|
||||||
|
# Either "Trace", "Debug", "Info", "Warn", "Error", "Critical", default is "Info"
|
||||||
|
level = Info
|
||||||
|
|
||||||
|
# For "console" mode only
|
||||||
|
[log.console]
|
||||||
|
level =
|
||||||
|
# Set formatting to "false" to disable color formatting of console logs
|
||||||
|
formatting = false
|
||||||
|
|
||||||
|
# For "file" mode only
|
||||||
|
[log.file]
|
||||||
|
level =
|
||||||
|
# This enables automated log rotate(switch of following options), default is true
|
||||||
|
log_rotate = true
|
||||||
|
|
||||||
|
# Max line number of single file, default is 1000000
|
||||||
|
max_lines = 1000000
|
||||||
|
|
||||||
|
# Max size shift of single file, default is 28 means 1 << 28, 256MB
|
||||||
|
max_lines_shift = 28
|
||||||
|
|
||||||
|
# Segment log daily, default is true
|
||||||
|
daily_rotate = true
|
||||||
|
|
||||||
|
# Expired days of log file(delete after max days), default is 7
|
||||||
|
max_days = 7
|
||||||
|
|
||||||
|
[log.syslog]
|
||||||
|
level =
|
||||||
|
# Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used.
|
||||||
|
network =
|
||||||
|
address =
|
||||||
|
|
||||||
|
# Syslog facility. user, daemon and local0 through local7 are valid.
|
||||||
|
facility =
|
||||||
|
|
||||||
|
# Syslog tag. By default, the process' argv[0] is used.
|
||||||
|
tag =
|
||||||
|
|
||||||
|
#################################### AMPQ Event Publisher ##########################
|
||||||
|
[event_publisher]
|
||||||
|
enabled = false
|
||||||
|
rabbitmq_url = amqp://localhost/
|
||||||
|
exchange = grafana_events
|
||||||
|
|
||||||
|
#################################### Dashboard JSON files ##########################
|
||||||
|
[dashboards.json]
|
||||||
|
enabled = false
|
||||||
|
path = /var/lib/grafana/dashboards
|
||||||
|
|
||||||
|
#################################### Usage Quotas ##########################
|
||||||
|
[quota]
|
||||||
|
enabled = false
|
||||||
|
|
||||||
|
#### set quotas to -1 to make unlimited. ####
|
||||||
|
# limit number of users per Org.
|
||||||
|
org_user = 10
|
||||||
|
|
||||||
|
# limit number of dashboards per Org.
|
||||||
|
org_dashboard = 100
|
||||||
|
|
||||||
|
# limit number of data_sources per Org.
|
||||||
|
org_data_source = 10
|
||||||
|
|
||||||
|
# limit number of api_keys per Org.
|
||||||
|
org_api_key = 10
|
||||||
|
|
||||||
|
# limit number of orgs a user can create.
|
||||||
|
user_org = 10
|
||||||
|
|
||||||
|
# Global limit of users.
|
||||||
|
global_user = -1
|
||||||
|
|
||||||
|
# global limit of orgs.
|
||||||
|
global_org = -1
|
||||||
|
|
||||||
|
# global limit of dashboards
|
||||||
|
global_dashboard = -1
|
||||||
|
|
||||||
|
# global limit of api_keys
|
||||||
|
global_api_key = -1
|
||||||
|
|
||||||
|
# global limit on number of logged in users.
|
||||||
|
global_session = -1
|
||||||
|
|
||||||
|
#################################### Grafana Live ##########################
|
||||||
|
[live]
|
||||||
|
max_connections = 0
|
||||||
|
|
||||||
|
#################################### Alerting ##########################
|
||||||
|
[unified_alerting]
|
||||||
|
enabled = true
|
||||||
|
|
||||||
|
[alerting]
|
||||||
|
enabled = false
|
||||||
96
grafana/rootfs/etc/nginx/includes/mime.types
Normal file
96
grafana/rootfs/etc/nginx/includes/mime.types
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
types {
|
||||||
|
text/html html htm shtml;
|
||||||
|
text/css css;
|
||||||
|
text/xml xml;
|
||||||
|
image/gif gif;
|
||||||
|
image/jpeg jpeg jpg;
|
||||||
|
application/javascript js;
|
||||||
|
application/atom+xml atom;
|
||||||
|
application/rss+xml rss;
|
||||||
|
|
||||||
|
text/mathml mml;
|
||||||
|
text/plain txt;
|
||||||
|
text/vnd.sun.j2me.app-descriptor jad;
|
||||||
|
text/vnd.wap.wml wml;
|
||||||
|
text/x-component htc;
|
||||||
|
|
||||||
|
image/png png;
|
||||||
|
image/svg+xml svg svgz;
|
||||||
|
image/tiff tif tiff;
|
||||||
|
image/vnd.wap.wbmp wbmp;
|
||||||
|
image/webp webp;
|
||||||
|
image/x-icon ico;
|
||||||
|
image/x-jng jng;
|
||||||
|
image/x-ms-bmp bmp;
|
||||||
|
|
||||||
|
font/woff woff;
|
||||||
|
font/woff2 woff2;
|
||||||
|
|
||||||
|
application/java-archive jar war ear;
|
||||||
|
application/json json;
|
||||||
|
application/mac-binhex40 hqx;
|
||||||
|
application/msword doc;
|
||||||
|
application/pdf pdf;
|
||||||
|
application/postscript ps eps ai;
|
||||||
|
application/rtf rtf;
|
||||||
|
application/vnd.apple.mpegurl m3u8;
|
||||||
|
application/vnd.google-earth.kml+xml kml;
|
||||||
|
application/vnd.google-earth.kmz kmz;
|
||||||
|
application/vnd.ms-excel xls;
|
||||||
|
application/vnd.ms-fontobject eot;
|
||||||
|
application/vnd.ms-powerpoint ppt;
|
||||||
|
application/vnd.oasis.opendocument.graphics odg;
|
||||||
|
application/vnd.oasis.opendocument.presentation odp;
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet ods;
|
||||||
|
application/vnd.oasis.opendocument.text odt;
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation
|
||||||
|
pptx;
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
|
||||||
|
xlsx;
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
|
docx;
|
||||||
|
application/vnd.wap.wmlc wmlc;
|
||||||
|
application/x-7z-compressed 7z;
|
||||||
|
application/x-cocoa cco;
|
||||||
|
application/x-java-archive-diff jardiff;
|
||||||
|
application/x-java-jnlp-file jnlp;
|
||||||
|
application/x-makeself run;
|
||||||
|
application/x-perl pl pm;
|
||||||
|
application/x-pilot prc pdb;
|
||||||
|
application/x-rar-compressed rar;
|
||||||
|
application/x-redhat-package-manager rpm;
|
||||||
|
application/x-sea sea;
|
||||||
|
application/x-shockwave-flash swf;
|
||||||
|
application/x-stuffit sit;
|
||||||
|
application/x-tcl tcl tk;
|
||||||
|
application/x-x509-ca-cert der pem crt;
|
||||||
|
application/x-xpinstall xpi;
|
||||||
|
application/xhtml+xml xhtml;
|
||||||
|
application/xspf+xml xspf;
|
||||||
|
application/zip zip;
|
||||||
|
|
||||||
|
application/octet-stream bin exe dll;
|
||||||
|
application/octet-stream deb;
|
||||||
|
application/octet-stream dmg;
|
||||||
|
application/octet-stream iso img;
|
||||||
|
application/octet-stream msi msp msm;
|
||||||
|
|
||||||
|
audio/midi mid midi kar;
|
||||||
|
audio/mpeg mp3;
|
||||||
|
audio/ogg ogg;
|
||||||
|
audio/x-m4a m4a;
|
||||||
|
audio/x-realaudio ra;
|
||||||
|
|
||||||
|
video/3gpp 3gpp 3gp;
|
||||||
|
video/mp2t ts;
|
||||||
|
video/mp4 mp4;
|
||||||
|
video/mpeg mpeg mpg;
|
||||||
|
video/quicktime mov;
|
||||||
|
video/webm webm;
|
||||||
|
video/x-flv flv;
|
||||||
|
video/x-m4v m4v;
|
||||||
|
video/x-mng mng;
|
||||||
|
video/x-ms-asf asx asf;
|
||||||
|
video/x-ms-wmv wmv;
|
||||||
|
video/x-msvideo avi;
|
||||||
|
}
|
||||||
16
grafana/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
16
grafana/rootfs/etc/nginx/includes/proxy_params.conf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_ignore_client_abort off;
|
||||||
|
proxy_read_timeout 86400s;
|
||||||
|
proxy_redirect off;
|
||||||
|
proxy_send_timeout 86400s;
|
||||||
|
proxy_max_temp_file_size 0;
|
||||||
|
|
||||||
|
proxy_set_header Accept-Encoding "";
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header X-NginX-Proxy true;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-WEBAUTH-USER "";
|
||||||
6
grafana/rootfs/etc/nginx/includes/server_params.conf
Normal file
6
grafana/rootfs/etc/nginx/includes/server_params.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
root /dev/null;
|
||||||
|
server_name $hostname;
|
||||||
|
|
||||||
|
add_header X-Content-Type-Options nosniff;
|
||||||
|
add_header X-XSS-Protection "1; mode=block";
|
||||||
|
add_header X-Robots-Tag none;
|
||||||
8
grafana/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
8
grafana/rootfs/etc/nginx/includes/ssl_params.conf
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_prefer_server_ciphers off;
|
||||||
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||||
|
ssl_session_timeout 10m;
|
||||||
|
ssl_session_cache shared:SSL:10m;
|
||||||
|
ssl_session_tickets off;
|
||||||
|
ssl_stapling on;
|
||||||
|
ssl_stapling_verify on;
|
||||||
3
grafana/rootfs/etc/nginx/includes/upstream.conf
Normal file
3
grafana/rootfs/etc/nginx/includes/upstream.conf
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
upstream backend {
|
||||||
|
server 127.0.0.1:3000;
|
||||||
|
}
|
||||||
48
grafana/rootfs/etc/nginx/nginx.conf
Normal file
48
grafana/rootfs/etc/nginx/nginx.conf
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Run nginx in foreground.
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
# This is run inside Docker.
|
||||||
|
user root;
|
||||||
|
|
||||||
|
# Pid storage location.
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
# Set number of worker processes.
|
||||||
|
worker_processes 1;
|
||||||
|
|
||||||
|
# Enables the use of JIT for regular expressions to speed-up their processing.
|
||||||
|
pcre_jit on;
|
||||||
|
|
||||||
|
# Write error log to the add-on log.
|
||||||
|
error_log /proc/1/fd/1 error;
|
||||||
|
|
||||||
|
# Load dynamic modules.
|
||||||
|
include /etc/nginx/modules/*.conf;
|
||||||
|
|
||||||
|
# Max num of simultaneous connections by a worker process.
|
||||||
|
events {
|
||||||
|
worker_connections 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/includes/mime.types;
|
||||||
|
|
||||||
|
access_log off;
|
||||||
|
client_max_body_size 4G;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
gzip on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
sendfile on;
|
||||||
|
server_tokens off;
|
||||||
|
tcp_nodelay on;
|
||||||
|
tcp_nopush on;
|
||||||
|
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' close;
|
||||||
|
}
|
||||||
|
|
||||||
|
include /etc/nginx/includes/upstream.conf;
|
||||||
|
|
||||||
|
include /etc/nginx/servers/*.conf;
|
||||||
|
}
|
||||||
20
grafana/rootfs/etc/nginx/servers/direct-ssl.disabled
Normal file
20
grafana/rootfs/etc/nginx/servers/direct-ssl.disabled
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server ssl;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/ssl_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
ssl_certificate /ssl/%%certfile%%;
|
||||||
|
ssl_certificate_key /ssl/%%keyfile%%;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 302 $scheme://$http_host%%ingress_entry%%/;
|
||||||
|
}
|
||||||
|
location %%ingress_entry%% {
|
||||||
|
rewrite ^%%ingress_entry%%/(.*) /$1 break;
|
||||||
|
proxy_set_header X-WEBAUTH-USER "";
|
||||||
|
proxy_pass http://backend/;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
15
grafana/rootfs/etc/nginx/servers/direct.disabled
Normal file
15
grafana/rootfs/etc/nginx/servers/direct.disabled
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
return 302 $scheme://$http_host%%ingress_entry%%/;
|
||||||
|
}
|
||||||
|
location %%ingress_entry%% {
|
||||||
|
rewrite ^%%ingress_entry%%/(.*) /$1 break;
|
||||||
|
proxy_set_header X-WEBAUTH-USER "";
|
||||||
|
proxy_pass http://backend/;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
grafana/rootfs/etc/nginx/servers/ingress.conf
Normal file
14
grafana/rootfs/etc/nginx/servers/ingress.conf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
server {
|
||||||
|
listen 1337 default_server;
|
||||||
|
|
||||||
|
include /etc/nginx/includes/server_params.conf;
|
||||||
|
include /etc/nginx/includes/proxy_params.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
allow 127.0.0.1;
|
||||||
|
allow 172.30.32.2;
|
||||||
|
deny all;
|
||||||
|
proxy_set_header X-WEBAUTH-USER %%grafana_user%%;
|
||||||
|
proxy_pass http://backend;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/finish
Executable file
27
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/finish
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
# Take down the S6 supervision tree when Grafana fails
|
||||||
|
# ==============================================================================
|
||||||
|
declare exit_code
|
||||||
|
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
|
||||||
|
readonly exit_code_service="${1}"
|
||||||
|
readonly exit_code_signal="${2}"
|
||||||
|
readonly service="Grafana"
|
||||||
|
|
||||||
|
bashio::log.info \
|
||||||
|
"Service ${service} exited with code ${exit_code_service}" \
|
||||||
|
"(by signal ${exit_code_signal})"
|
||||||
|
|
||||||
|
if [[ "${exit_code_service}" -eq 256 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
|
||||||
|
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
exec /run/s6/basedir/bin/halt
|
||||||
|
fi
|
||||||
41
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/run
Executable file
41
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/run
Executable file
@@ -0,0 +1,41 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
# Runs the Grafana Server
|
||||||
|
# ==============================================================================
|
||||||
|
declare -a options
|
||||||
|
declare -a unsigned_plugins
|
||||||
|
declare name
|
||||||
|
declare value
|
||||||
|
|
||||||
|
# Wait for Memcached to become available
|
||||||
|
bashio::net.wait_for 11211
|
||||||
|
|
||||||
|
bashio::log.info 'Starting Grafana...'
|
||||||
|
|
||||||
|
options+=(--config="/etc/grafana/grafana.ini")
|
||||||
|
options+=(--homepath="/usr/share/grafana")
|
||||||
|
|
||||||
|
# Load custom environment variables
|
||||||
|
for var in $(bashio::config 'env_vars|keys'); do
|
||||||
|
name=$(bashio::config "env_vars[${var}].name")
|
||||||
|
value=$(bashio::config "env_vars[${var}].value")
|
||||||
|
bashio::log.info "Setting ${name} to ${value}"
|
||||||
|
export "${name}=${value}"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Verify if we have unsigned custom plugins to load
|
||||||
|
if bashio::config.has_value 'custom_plugins'; then
|
||||||
|
for plugin in $(bashio::config 'custom_plugins|keys'); do
|
||||||
|
name=$(bashio::config "custom_plugins[${plugin}].name")
|
||||||
|
if bashio::config.true "custom_plugins[${plugin}].unsigned"; then
|
||||||
|
unsigned_plugins+="${name},"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
export "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=${unsigned_plugins}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Run Grafana
|
||||||
|
exec grafana-server "${options[@]}"
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/type
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/grafana/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
69
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/run
Executable file
69
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/run
Executable file
@@ -0,0 +1,69 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
# Configures Grafana
|
||||||
|
# ==============================================================================
|
||||||
|
readonly CONFIG="/etc/grafana/grafana.ini"
|
||||||
|
declare ingress_entry
|
||||||
|
declare log_level
|
||||||
|
|
||||||
|
# Symlink the new style config directory to the old one. People might have
|
||||||
|
# configurations for Grafana that access the database via the old path.
|
||||||
|
ln -s "/homeassistant" "/config" \
|
||||||
|
|| bashio::log.warning "Failed linking Home Assistant configuration alias"
|
||||||
|
|
||||||
|
# Configures Grafana with the add-on log level
|
||||||
|
log_level="Info"
|
||||||
|
if bashio::config.exists 'log_level'; then
|
||||||
|
case "$(bashio::string.lower "$(bashio::config 'log_level')")" in
|
||||||
|
all|trace)
|
||||||
|
log_level="Trace"
|
||||||
|
;;
|
||||||
|
debug)
|
||||||
|
log_level="Debug"
|
||||||
|
;;
|
||||||
|
info|notice)
|
||||||
|
log_level="Info"
|
||||||
|
;;
|
||||||
|
warning)
|
||||||
|
log_level="Warn"
|
||||||
|
;;
|
||||||
|
error)
|
||||||
|
log_level="Error"
|
||||||
|
;;
|
||||||
|
fatal|off)
|
||||||
|
log_level="Critical"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
sed -i "s/level = Info/level = ${log_level}/g" "${CONFIG}"
|
||||||
|
|
||||||
|
# Sets unique secret key used for signing cookies.
|
||||||
|
if ! bashio::fs.file_exists "/data/secret"; then
|
||||||
|
echo "${SUPERVISOR_TOKEN}" > /data/secret
|
||||||
|
fi
|
||||||
|
secret=$(</data/secret)
|
||||||
|
sed -i "s/secret_key.*/secret_key = ${secret}/g" "${CONFIG}"
|
||||||
|
|
||||||
|
ingress_entry=$(bashio::addon.ingress_entry)
|
||||||
|
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" "${CONFIG}"
|
||||||
|
|
||||||
|
# Install user configured/requested Grafana plugins
|
||||||
|
if bashio::config.has_value 'plugins'; then
|
||||||
|
for plugin in $(bashio::config 'plugins'); do
|
||||||
|
grafana-cli plugins install "$plugin" \
|
||||||
|
|| bashio::exit.nok "Failed installing Grafana plugin: ${plugin}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install user configured/requested Grafana custom plugins (from URL)
|
||||||
|
if bashio::config.has_value 'custom_plugins'; then
|
||||||
|
for plugin in $(bashio::config 'custom_plugins|keys'); do
|
||||||
|
name=$(bashio::config "custom_plugins[${plugin}].name")
|
||||||
|
url=$(bashio::config "custom_plugins[${plugin}].url")
|
||||||
|
bashio::log.debug "Installing custom plugin ${name} from ${url}"
|
||||||
|
grafana-cli --pluginUrl ${url} plugins install $name \
|
||||||
|
|| bashio::exit.nok "Failed installing Grafana custom plugin: ${name} from: ${url}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/type
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/up
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-grafana/up
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/init-grafana/run
|
||||||
38
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/run
Executable file
38
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/run
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: grafana
|
||||||
|
# Configures NGINX
|
||||||
|
# ==============================================================================
|
||||||
|
declare port
|
||||||
|
declare certfile
|
||||||
|
declare grafana_user
|
||||||
|
declare ingress_entry
|
||||||
|
declare ingress_interface
|
||||||
|
declare keyfile
|
||||||
|
|
||||||
|
|
||||||
|
port=$(bashio::addon.port 80)
|
||||||
|
if bashio::var.has_value "${port}"; then
|
||||||
|
bashio::config.require.ssl
|
||||||
|
|
||||||
|
if bashio::config.true 'ssl'; then
|
||||||
|
certfile=$(bashio::config 'certfile')
|
||||||
|
keyfile=$(bashio::config 'keyfile')
|
||||||
|
|
||||||
|
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
||||||
|
sed -i "s#%%certfile%%#${certfile}#g" /etc/nginx/servers/direct.conf
|
||||||
|
sed -i "s#%%keyfile%%#${keyfile}#g" /etc/nginx/servers/direct.conf
|
||||||
|
|
||||||
|
else
|
||||||
|
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
||||||
|
fi
|
||||||
|
ingress_entry=$(bashio::addon.ingress_entry)
|
||||||
|
sed -i "s#%%ingress_entry%%#${ingress_entry}#g" /etc/nginx/servers/direct.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
grafana_user='admin'
|
||||||
|
if bashio::config.has_value 'grafana_ingress_user'; then
|
||||||
|
grafana_user=$(bashio::config 'grafana_ingress_user')
|
||||||
|
fi
|
||||||
|
sed -i "s/%%grafana_user%%/${grafana_user}/g" /etc/nginx/servers/ingress.conf
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/init-nginx/up
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/init-nginx/run
|
||||||
27
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/finish
Executable file
27
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/finish
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
# Take down the S6 supervision tree when memcached fails
|
||||||
|
# ==============================================================================
|
||||||
|
declare exit_code
|
||||||
|
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
|
||||||
|
readonly exit_code_service="${1}"
|
||||||
|
readonly exit_code_signal="${2}"
|
||||||
|
readonly service="memcached"
|
||||||
|
|
||||||
|
bashio::log.info \
|
||||||
|
"Service ${service} exited with code ${exit_code_service}" \
|
||||||
|
"(by signal ${exit_code_signal})"
|
||||||
|
|
||||||
|
if [[ "${exit_code_service}" -eq 256 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
|
||||||
|
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
exec /run/s6/basedir/bin/halt
|
||||||
|
fi
|
||||||
15
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/run
Executable file
15
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/run
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: Grafana
|
||||||
|
# Runs the memcached Server
|
||||||
|
# ==============================================================================
|
||||||
|
declare -a options
|
||||||
|
|
||||||
|
bashio::log.info 'Starting Memcached...'
|
||||||
|
|
||||||
|
options+=(-l 127.0.0.1)
|
||||||
|
options+=(-m 32)
|
||||||
|
|
||||||
|
# Run Memcached
|
||||||
|
exec s6-setuidgid memcache /usr/bin/memcached "${options[@]}"
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/type
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/memcached/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
26
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish
Executable file
26
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/finish
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: grafana
|
||||||
|
# Take down the S6 supervision tree when NGINX fails
|
||||||
|
# ==============================================================================
|
||||||
|
declare exit_code
|
||||||
|
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
|
||||||
|
readonly exit_code_service="${1}"
|
||||||
|
readonly exit_code_signal="${2}"
|
||||||
|
readonly service="NGINX"
|
||||||
|
|
||||||
|
bashio::log.info \
|
||||||
|
"Service ${service} exited with code ${exit_code_service}" \
|
||||||
|
"(by signal ${exit_code_signal})"
|
||||||
|
|
||||||
|
if [[ "${exit_code_service}" -eq 256 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
|
||||||
|
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
||||||
|
if [[ "${exit_code_container}" -eq 0 ]]; then
|
||||||
|
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
|
||||||
|
fi
|
||||||
|
exec /run/s6/basedir/bin/halt
|
||||||
|
fi
|
||||||
12
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/run
Executable file
12
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/run
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/command/with-contenv bashio
|
||||||
|
# ==============================================================================
|
||||||
|
# Home Assistant Community Add-on: grafana
|
||||||
|
# Runs the Nginx daemon
|
||||||
|
# ==============================================================================
|
||||||
|
|
||||||
|
# Wait for grafana to become available
|
||||||
|
bashio::net.wait_for 3000
|
||||||
|
|
||||||
|
bashio::log.info "Starting NGINX..."
|
||||||
|
|
||||||
|
exec nginx
|
||||||
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
1
grafana/rootfs/etc/s6-overlay/s6-rc.d/nginx/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
longrun
|
||||||
BIN
images/screenshot.png
Normal file
BIN
images/screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 KiB |
Reference in New Issue
Block a user