-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add monitor for Zookeeper #4114
base: master
Are you sure you want to change the base?
Conversation
It will be accepted, but currently we are working on 2.0.0 and there are a lot of pull requests that are waiting for review. It may take some to be merge. Maybe in 2.2.0. You can check the current progress here: |
Sure, I can wait for the 2.2.0 release. I have already implemented the feature for my use case, and I wanted to contribute them back to the main project.
|
Put it here and a single PR is preferred, so that we don't need to checkout two PRs in order to test it. |
Please note that it cannot pass the ARM64 test, probably due to native build issue. You may need to find another library or find a way to pre-build that. |
Sure, I'll replace the zookeeper dependency with netcat. I only need to run the equivalent of |
Signed-off-by: Aayush Gupta <[email protected]>
Signed-off-by: Aayush Gupta <[email protected]>
Signed-off-by: Aayush Gupta <[email protected]>
I realized I could simply use the inbuilt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR
I have gone trough this monitor and have left inline comments where things need to be changed ^^
exports.up = function (knex) { | ||
// update monitor.push_token to 32 length | ||
return knex.schema.alterTable("monitor", function (table) { | ||
table.string("zookeeper_host", 255); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the hostname
and timeout
fields instead.
I don't see a reason why we shoud add these fields ^^
@@ -891,6 +893,12 @@ class Monitor extends BeanModel { | |||
bean.status = UP; | |||
bean.ping = dayjs().valueOf() - startTime; | |||
|
|||
} else if (this.type === "zookeeper") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have recently started using a better syntax for creating monitors.
It is documented in our contribution guide here:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#:~:text=new%20monitoring%20types
The currently migrated montiors live here:
https://github.com/louislam/uptime-kuma/tree/master/server/monitor-types
All new monitors MUST to use this, to use this format instead.
Rationale: We can't keep dumping all code in the giormous monitor.js
. This does not scale in terms of maintenance/.. effort.
<template v-if="monitor.type === 'zookeeper'"> | ||
<div class="my-3"> | ||
<label for="zookeeperHost" class="form-label">{{ $t("Zookeeper Host") }}</label> | ||
<input id="zookeeperHost" v-model="monitor.zookeeperHost" type="text" class="form-control" required> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please include a helptext about what you mentioned in the PR-description.
Currently, a user might just think it is not working, right?
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
I have some zookeeper hosts that I want to monitor. So, I decided to use uptime-kuma, but it does not have a dedicated monitor for zookeeper instances. This PR adds that support by using
node:net
module to doecho ruok | nc <host> <port>
and checks forimok
response.PS: I tried using TCP, but it always gives a UP status if the instance is running, but the zookeeper process is down. Hence the need for this monitor.
Caveat:
The below feature only supports zookeeper versions 3.3.0+
In order for the monitoring to work, the zookeeper process should have 4lw command
ruok
permitted via the 4lw.commands.whitelist configuration option.Fixes #(issue)
Type of change
Checklist
Screenshots (if any)