Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiab77/ipfire-netdata-addon-service-patch
Simple patch for adding Netdata add-on service to the IPFire web interface.
https://github.com/jiab77/ipfire-netdata-addon-service-patch
ipfire netdata
Last synced: 2 days ago
JSON representation
Simple patch for adding Netdata add-on service to the IPFire web interface.
- Host: GitHub
- URL: https://github.com/jiab77/ipfire-netdata-addon-service-patch
- Owner: Jiab77
- License: mit
- Created: 2023-01-15T23:11:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-23T23:25:06.000Z (about 2 months ago)
- Last Synced: 2024-11-24T00:20:34.023Z (about 2 months ago)
- Topics: ipfire, netdata
- Language: Shell
- Homepage:
- Size: 107 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Netdata add-on installer and service patch for IPFire
Simple Netdata add-on installer and service patch for the IPFire web interface.
## Current versions
* Script: __`0.3.0`__
* Netdata: __[1.47.0-1](https://github.com/siosios/Netdata-on-Ipfire/tree/main/core189)__## Content
* [Features](#features)
* [Installation](#installation)
* [Update](#update)
* [Uninstall](#uninstall)
* [Reset](#reset)
* [Fix broken permissions](#fix-broken-permissions)
* [Service](#service)
* [Known issues](#known-issues)
* [Netdata plugins does not get started](#netdata-plugins-does-not-get-started)
* [Workaround](#workaround)
* [Screenshots](#screenshots)
* [Roadmap](#roadmap)
* [Community](#community)
* [Thanks](#thanks)
* [Author](#author)---
## Features
The installer script will allow you to do the following:
* Install / Update / Remove / Reset the add-on
* Fix broken permissions
* Backup and restore config files when running `remove` or `reset` commands
* Add / Remove the patch on the __services__ page (__removed__)## Installation
1. Install `git` with __Pakfire__
2. Clone the project and run the patch:```console
# pakfire install -y git
# git clone https://github.com/Jiab77/ipfire-netdata-addon-service-patch.git
# cd ipfire-netdata-addon-service-patch
# ./install.sh -h
```Once done, simply reload the page(s).
> You can remove `git` right after from __Pakfire__ once installed. `git` is just required for downloading and updating the project to get the latest versions.
## Update
```console
# cd ipfire-netdata-addon-service-patch
# ./install.sh -u
```> You can also use `--update` if you prefer the long version.
## Uninstall
```console
# cd ipfire-netdata-addon-service-patch
# ./install.sh -r
```> You can also use `--remove` if you prefer the long version.
## Reset
```console
# cd ipfire-netdata-addon-service-patch
# ./install.sh -R
```> You can also use `--reset` if you prefer the long version.
## Fix broken permissions
This feature should be ran automatically during the install process but if you have used `--no-fix` then you have to do it manually.
```console
# cd ipfire-netdata-addon-service-patch
# ./install.sh -f
```> You can also use `--fix-perms` if you prefer the long version.
## Service
The Netdata service will be added to the IPFire services page by injecting a custom line inside the `CGI` file.
> __NOTE__
>
> This feature has been removed from the script.## Known issues
Here is the list of known issues and related workarounds.
### Netdata plugins does not get started
When I was looking for the __Unbound__ service graph in Netdata, I've discovered that the `go.d.plugin` was not running and was not displayed when running the `ps fax | grep netdata` command.
It took few hours to debug it but I could finally find the reason why simply no plugin could be started by analyzing the file `/opt/netdata/var/log/netdata/collector.log` and discovered that all plugin got __`permission denied`__ errors:
Collector logs
```console
# cat /opt/netdata/var/log/netdata/collector.log.1 | grep -i "permission denied" | sort -u | head -n20
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/charts.d.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/cups.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/ebpf.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/fping.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/go.d.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/ioping.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/perf.plugin: cannot execute: Permission denied
sh: line 1: exec: /opt/netdata/usr/libexec/netdata/plugins.d/python.d.plugin: cannot execute: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/charts.d.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/cups.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/ebpf.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/fping.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/go.d.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/ioping.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/perf.plugin: Permission denied
sh: line 1: /opt/netdata/usr/libexec/netdata/plugins.d/python.d.plugin: Permission denied
```I then looked at the `/opt/netdata/usr/libexec/netdata/plugins.d` folder and seen that all the `*.plugin` files had their `GID` defined to the group id `999`.
The problem here is that the group id `999` does not exist on __IPFire__...
You can check it on your side by running these commands:
* Search for the group id `999`
```console
# grep -c "999" /etc/group
0
```* Search for the user id `999`
```console
# grep -c "999" /etc/passwd
0
```While if you are running the same commands but with `netdata` instead:
* Search for the group name `netdata`
```console
# grep -c "netdata" /etc/group
1
```* Search for the user name `netdata`
```console
# grep -c "netdata" /etc/passwd
1
```#### Workaround
So... What does all of this means? Well... it means that there is probably a permission issue during the install process or during the package building process.
To be sure of that and also find a way to fix that permission issue, we'll need to find which files are impacted and set to the wrong group id.
Here is how to do so:
```console
# find /opt/netdata -group 999 2>/dev/null | wc -l
321
```> Woow... that's quite a lot 😅 Just forget to fix them all manually 😆
Ok so let's stop the Netdata service, fix the permissions, restart the service and see how it goes after that!
```console
# /etc/init.d/netdata stop
Stopping real-time performance and health monitoring... [ OK ]# find /opt/netdata -group 999 | wc -l
321# find /opt/netdata -group 999 -exec chown -c root:netdata {} \; | wc -l
321# find /opt/netdata -group 999 | wc -l
0# /etc/init.d/netdata start
Starting real-time performance and health monitoring...# /etc/init.d/netdata status
netdata is running with Process ID(s) 20865 20863 20859.
```Now, if you check the screenshots in the next section, you should get a similar result on your side.
Don't worry, you'll not have to do all this technical things, I've already implemented everything in the [install.sh](install.sh) script 😉
If you want to fix your current installation, you just need to run the following command:
```console
# cd ~/ipfire-netdata-addon-service-patch
# ./install.sh -f
```> You can also use `--fix-perms` instead if you prefer long arguments.
Or if you want to be more radical and reset your Netdata installation, you can run this command instead:
```console
# cd ~/ipfire-netdata-addon-service-patch
# ./install.sh -R
```> You can also use `--reset` instead if you prefer long arguments.
If for whatever reasons you want to reset your Netdata installation __without__ fixing the permissions, you can run this command:
```console
# cd ~/ipfire-netdata-addon-service-patch
# ./install.sh -R --no-fix
```That's all! Hope that all of this could have been helpful for everyone. 🙇♂️
#### Screenshots
* __Before fixing permissions__
![Before fixing Netdata permissions](images/before-permissions-fix.png)
* __After fixing permissions__
![After Netdata permissions fix](images/after-permissions-fix.png)## Roadmap
* [X] Create initial version
* [X] Make the script better
* [X] Fix permissions issues
* [X] Implement __script__ `update` feature
* [ ] Finish the `service` code
* [ ] See if the [kickstart](https://learn.netdata.cloud/docs/installing/one-line-installer-for-all-linux-systems) method can be supported## Community
You can find the discussion around this project [here](https://community.ipfire.org/t/netdata-addon-by-ummeegge/5318).
## Thanks
Huge thanks to [@siosios](https://github.com/siosios) for his work on the [Netdata package](https://github.com/siosios/Netdata-on-Ipfire) for [IPFire](https://www.ipfire.org/)!
## Author
* [Jiab77](https://community.ipfire.org/u/jiab77)