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

Command based monitors via local execution and ssh #2609

Closed
1 task done
rmatte opened this issue Jan 14, 2023 · 11 comments
Closed
1 task done

Command based monitors via local execution and ssh #2609

rmatte opened this issue Jan 14, 2023 · 11 comments
Labels
area:monitor Everything related to monitors feature-request Request for new features to be added

Comments

@rmatte
Copy link

rmatte commented Jan 14, 2023

⚠️ Please verify that this feature request has NOT been suggested before.

  • I checked and didn't find similar feature request

🏷️ Feature Request Type

New Monitor

🔖 Feature description

It would be great to be able to create command based monitors/checks with commands that can be executed locally on the host/container where uptime kuma is running or executed remotely via ssh.

✔️ Solution

Status of pass or fail would be based on the exit code of the command. Exit 0 would be a clear, exiting with anything other than 0 would be a failure. This would allow for a lot more flexibility with the checks. Have it so the user can specify a command for the check, then run the check locally or remotely via ssh and gather the exit code then pass or fail the check/monitor based on the exit code value for the command.

❓ Alternatives

No response

📝 Additional Context

No response

@rmatte rmatte added the feature-request Request for new features to be added label Jan 14, 2023
@rmatte
Copy link
Author

rmatte commented Jan 27, 2023

In terms of the exit codes, the way this sort of thing generally works in other monitoring software (nagios, zenoss, sensu, etc...) is that the exit code from the command corresponds to different severities.

exit 0 = clear
exit 1 = warning
exit 2 = critical
exit higher than 2 = critical

This would allow us to create a script with something like this in it, and run it from uptime kuma each cycle...

#!/bin/bash
echo "THE SKY IS FALLING!"
exit 2

Which would produce a critical alert/event. Obviously a monitoring script would be a bit more sophisticated than the above example but this is a really common functionality to have in monitoring software and would significantly increase the flexibility of what we'd be able to monitor with uptime kuma.

I like the monitors which are included so far, some of them are absolutely fantastic such as the ping, docker, and http/https checks, but having the ability to easily implement checks with custom written scripts like this on local and remote hosts would be huge.

Thanks.

@Computroniks
Copy link
Contributor

This is already handled by the push monitor type.

@rmatte
Copy link
Author

rmatte commented Jan 28, 2023

This is already handled by the push monitor type.

Using the push monitor type puts the responsibility of actually running the check script on something else like crontab instead of having uptime kuma run it, which isn't ideal in all situations, but for my own personal use case I could make a push style implementation work. I'd still like to see the type of implementation that I'm proposing considered. It would be nice to be able to throw some bash code together in to a text field in a "Command" style monitor and have it run and get the status based on the exit code, rather than having to code a script that has to talk to the API via http or https every time it runs.

@kushaldas
Copy link

This will be great for all the different random things sometimes we want to check.

@jordantrizz
Copy link

jordantrizz commented Mar 10, 2023

This would potentially address #1851 if not more requests and allow extending Uptime Kuma further without the need to build specific monitors.

@louislam would it be possible to sponsor this feature?

@rbhr
Copy link

rbhr commented Mar 28, 2023

This would potentially address #1851 if not more requests and allow extending Uptime Kuma further without the need to build specific monitors.

@louislam would it be possible to sponsor this feature?

The feature request is great in itself. This reason is spot on!

@AndrewKvalheim
Copy link

This might also cover the needs of #2431.

@jordantrizz
Copy link

Sorry for the @louislam but I'm wondering if this is something that would be possible to implement, I'm sure it there's a few people that would sponsor it.

@Ramalama2
Copy link

Ramalama2 commented Apr 30, 2023

Hi boys, i would request such a feature either.
The problem here on my side is, that i dont want to configure ipv6 in my docker daemon.

  • Im getting an ipv6 over prefix delegation which changes every 24h, so its not possible to define a cidr.
  • Its actually possible to use a fixed cidr for docker with either serving over opnsense dhcpv6 an useless ipv6 network only for this task, or using simply nat with that docker daemon.
  • But only to monitor an ipv6 ping, this is simply not reasonable.
  • Its a docker server, that runs 20+ docker images, i dont even want there ipv6 :-)

However, if Uptime Kuma, could execute over ssh (with ssh keys) a command, this would solve my issue, as i could simply write a script that exits with 0 or 3 and inside the script i can do my ping6 or whatever i want....

Thanks!

@CommanderStorm CommanderStorm added the area:monitor Everything related to monitors label Dec 5, 2023
@CommanderStorm
Copy link
Collaborator

@rmatte
We are consolidating duplicate issues a bit to make issue management easier.
I think, we should track this issue in #1117 as there is no functional difference (ssh is nor explicitely mentioned there, but given that ssh commands can be issued => not nessesary). If you disagree, discussions are appreciated ^^
⇒ I am going to close this as a duplicate.

@CommanderStorm CommanderStorm closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@rmatte
Copy link
Author

rmatte commented Dec 6, 2023

Sounds fine.

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