Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote agent #528

Closed
amastelek opened this issue Oct 2, 2021 · 11 comments
Closed

Remote agent #528

amastelek opened this issue Oct 2, 2021 · 11 comments
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added

Comments

@amastelek
Copy link

I have a request for a remote agent, This can be a docker one that can be loaded on any operating system.
The remote agent polls a tcp port on the uptime kuma server, e.g. 3010. It measures the latency and then posts it to the server using JSON. That post can include additional metrics such as CPU usage, hard disk health, wifi signal strength, etc.
When a new monitor is created on the server it generates a random unique key. That key is used as a parameter in the remote agent and is embedded in the JSON posting the metrics.
This will allow monitoring of systems behind a firewall such as work from home users. Even servers and desktops in a normal work environment being monitored by a cloud vps.

@amastelek amastelek added the feature-request Request for new features to be added label Oct 2, 2021
@gaby
Copy link
Contributor

gaby commented Oct 2, 2021

@amastelek Push based notifications are available in the mightly image tag, see here: #279

The metrics data sounds more of a "Health and Status", instead of an Uptime Status which is Uptime-Kuma

@theoneandonly-vector
Copy link

still since we have push now.. we can actually monitor if a host runs out of memory or has a high cpu load. I think we should gather simple commands/scripts to make this happen (without the need of an agent).

@Tchoupinax
Copy link

Tchoupinax commented Jan 21, 2022

Hello,

I continue this topic to talk about the agent. The push notification is a very good feature to monitor not exposed service, but you should have access to this service and have to edit it to send the request.

For this case, I think an agent is necessary. For exemple, I will take a drone-runner service, within a Docker container, with is a service written with Go. I would like to monitor this service but it is not exposed, and I do not want edit the container (even if I could because the code is open source).

For this case, I imagine this feature. I made the POC with bash

IP=$(docker inspect drone-runner | jq '.[].NetworkSettings.Networks.bridge.IPAddress' -r)
PORT=$(docker inspect drone-runner | jq '.[].NetworkSettings.Ports' | jq 'keys []' -r | cut -d "/" -f 1)

URI="http://$IP:$PORT/healthz"

CODE=$(curl -s -o /dev/null -w "%{http_code}" $URI)

if [[ $CODE == 200 ]]; then
  curl https://UPTIME_KUMA_URL/api/push/lB95pTNgVI?msg=OK &> /dev/null
fi

I could edit this project to create the agent but I do not really know if this pattern is ok and how to implement this feature. Let's discuss about it :)

TL;DR : How to monitor not exposed service without the ability to edit this service to add a push notification ?

I think this feature could create an agent that register to the master when starting. On the dashboard, we can choose a method and specify an agent if we need it to make the check (e.g. PING this url with Agent #1). For performing the action, in the case an agent has been specified, the master will contact the agent to execute the query instead of executing itself. When the agent received the answer, it forward it to the master.

What do you think ?

@theoneandonly-vector
Copy link

@Tchoupinax
I think you should create agents in a seperate Agent-Repository where we as a community gather different agents for different usecases (add a little readme for every usecase/agent) and just run it using crontab or windows service etc..

@theoneandonly-vector
Copy link

and I must say I really see a big potential in all sizes of companys.. as they often have "monitoring for everything" but in the end it's never as good as a specific monitor for specific usecases.

@Tchoupinax
Copy link

Tchoupinax commented Jan 21, 2022

Is this repository already exists ? (can I have the link ? :D)

I do not really understand your reasoning, uptime-kuma is a monitoring for everything : it accepts HTTP, TCP, Ping... a lot of protocol and it supports a lot of service for notifications. The purpose of agent is just to extend the capability for not exposed service. The push notification feature is the right way, but incomplete as my sense... To complete this, the project misses agents, in my sens always; I'm asking and expose my idea because I do not know if it is good.

I can create an agent like the code I published, but It could be integrated to the project as a native feature and I think it could be better for configuring and handle all your monitoring. We have just to improve a little the push notification feature, make an agent and modify the UI to specify an agent.

If I understand your idea : why uptime kuma supports so many notifcation type ? Kuma could only send a webhook and tells "if you want to notify on XX, please use our agent for this usecase". But it is simpler to select your notification type on the list and click on "valid".

I really need think agent could be a good part of this project but I would love to read your explanation if you think it is not the case.

@theoneandonly-vector
Copy link

I don't see enough improvement in bloating uptime-kuma for this.
you could just create a few installer-scripts where you put in the url and auto-create a crontab.

there are limitless amounts of agents.. so including them in the UI is quite useless as soon as the numbers build up

@kobozo
Copy link

kobozo commented Aug 30, 2022

I need to monitor servers that are hidden from the network where Kuma is running. However I have, what we call, a jump server that has access to these hidden servers. The jump server can see both the hidden and Kuma. In this case a passthrough agent would be nice...

@FrankSanabria
Copy link

FrankSanabria commented Mar 1, 2023

Hello,

I continue this topic to talk about the agent. The push notification is a very good feature to monitor not exposed service, but you should have access to this service and have to edit it to send the request.

For this case, I think an agent is necessary. For exemple, I will take a drone-runner service, within a Docker container, with is a service written with Go. I would like to monitor this service but it is not exposed, and I do not want edit the container (even if I could because the code is open source).

For this case, I imagine this feature. I made the POC with bash

IP=$(docker inspect drone-runner | jq '.[].NetworkSettings.Networks.bridge.IPAddress' -r)
PORT=$(docker inspect drone-runner | jq '.[].NetworkSettings.Ports' | jq 'keys []' -r | cut -d "/" -f 1)

URI="http://$IP:$PORT/healthz"

CODE=$(curl -s -o /dev/null -w "%{http_code}" $URI)

if [[ $CODE == 200 ]]; then
  curl https://UPTIME_KUMA_URL/api/push/lB95pTNgVI?msg=OK &> /dev/null
fi

I could edit this project to create the agent but I do not really know if this pattern is ok and how to implement this feature. Let's discuss about it :)

TL;DR : How to monitor not exposed service without the ability to edit this service to add a push notification ?

I think this feature could create an agent that register to the master when starting. On the dashboard, we can choose a method and specify an agent if we need it to make the check (e.g. PING this url with Agent #1). For performing the action, in the case an agent has been specified, the master will contact the agent to execute the query instead of executing itself. When the agent received the answer, it forward it to the master.

What do you think ?

Great solution, don't need a agent in a local computer, with a simple script we can do it.

For example, I adjust your script to this:

#/usr/bin/bash
DATE=$(date +'%Y_%m_%d')
UK="UPTIMEKUMAURLPUSH"
SERVER=192.168.8.11
PORT=9392
netcat -z  ${SERVER} ${PORT}
if [ $? -eq 0 ]
then
        curl $UK &> /dev/null
        echo "$DATE - $SERVER:$PORT - RESULT: $? (CERO IS ONLINE)" 
fi


I will run this over local RPI computer with crontab and deploy it in local network for monitoring local servers and send to Cloud.

**Important:** Uptime Kuma Monitor define every 35 Segs. twice

@Sid-Sun
Copy link

Sid-Sun commented Oct 1, 2023

Not exactly remote agents but I've created a small script on top of uptime kuma to do "replication" at database layer through restic https://github.com/Sid-Sun/replicator-kuma there are a few quirks though

@CommanderStorm
Copy link
Collaborator

still since we have push now.. we can actually monitor [...]

This part of the issue is resolved.
I think we should track the rest of the issue in #84 instead, being the more poplar issue and contentwise a duplicate
=> closing as a duplicate

@CommanderStorm CommanderStorm closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@CommanderStorm CommanderStorm added the area:monitor Everything related to monitors label Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added
Projects
None yet
Development

No branches or pull requests

8 participants