louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
60.65k stars 5.41k forks source link

Telegraf Support with Basic Metric Alarms #4515

Open johnny-de opened 9 months ago

johnny-de commented 9 months ago

📑 I have found these related issues/pull requests

I checked and didn't find similar feature request.

🏷️ Feature Request Type

New monitor

🔖 Feature description

I would like to propose the implementation of Telegraf support and the addition of basic metric alarms for RAM, CPU, and disk space in Uptimekuma. This enhancement aims to simplify monitoring tasks, particularly in home lab environments where existing solutions are very complicated and difficult to implement, especially for beginners. With notifications already in place within Uptimekuma, users can seamlessly manage and respond to alerts without the need for additional tools or configurations.

Proposal:

✔️ Solution

Getting Telegraf set up is quite easy: 1 — Install Telegraf as described on the official website. Select Ubuntu & Debian as platforms. https://www.influxdata.com/downloads/ 2 — Open configuration. sudo nano /etc/telegraf/telegraf.conf Remove or rename the following lines in the configuration.

metric_buffer_limit = 0
...
hostname = "[IP-ADRESS]"
...
[[outputs.http]]
   url = "[UPTIMEKUMA HTTP ENDPOINT:PORT]"
   data_format = "json"

3 — Start telegraph sudo systemctl start telegraf

Messages will arrive in JSON format. After some formatting it can look like this, where you just have to find the appropriate parameters and use them. image

❓ Alternatives

I haven't found a solution as simple as Uptimekuma.

📝 Additional Context

Great project. Thank you for all the work everyone is putting in here!

CommanderStorm commented 9 months ago

If the service has an API endpoint where these JSON objects can be queried, the json-query-monitor can be used to monitor said API.

If this is not the case, any implementation should likely use the engine from the json-query monitor. We plan to do some maintenance work in this area, see https://github.com/louislam/uptime-kuma/pull/3919 for the concrete proposal.

If by "would like to propose the implementation" meant that you'd like to implement this, here is our contribution guide.

johnny-de commented 9 months ago

Thanks for clarifying. I mistakenly thought suggesting functions without programming itself was an option, but I understand now. I'll review the source code to see if I can contribute. If I'm up for it, I'll reach out again, but that may take a while. Thanks for the info.

CommanderStorm commented 9 months ago

Suggesting features without programming itself is one of the options