-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 nut server monitor #3967
Add nut server monitor #3967
Conversation
@@ -0,0 +1,20 @@ | |||
exports.up = function (knex) { |
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.
In the description you mentioned the following, what are your questions?
Some questions I had were regarding the database schema,
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.
I wanted to know if these column names are OK and in keeping with the conventions, I think I did the right thing based on what else I saw.
|
||
const nut = new Nut(monitor.port, monitor.hostname); | ||
|
||
nut.on("ready", () => { |
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.
This might be me not knowing js enough, but I think this function is racable (have not debugged this, just a hunch)
- First observation is, that none of the functions which are called are actually blocking (): https://www.npmjs.com/package/node-nut?activeTab=code
- if Nut does not immediatly become ready, heartbeat being set might be missed as the event loop has already exited this function
I think this might be why you are seeing
WARN: The ping is not effective when the status is DOWN
I think the following code looks more promissing:
https://github.com/skarcha/node-nut/blob/2729b2f3a6d1bb9d9105c68c0b1cdc62933c0f81/examples/polling.js
/** | ||
* @inheritdoc | ||
*/ | ||
async check(monitor, heartbeat, _server) { |
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.
node-nut
does not seem to include a timeout function.
Given that this is doing network calls, adding such an option would be a nice touch.
@@ -166,6 +166,7 @@ | |||
"favico.js": "~0.3.10", | |||
"jest": "~29.6.1", | |||
"marked": "~4.2.5", | |||
"node-nut": "^1.0.3", |
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.
Unsure if this library is a good idea…
skarcha/node-nut#9 (comment)
|
||
<div class="my-3"> | ||
<label for="nutPassword" class="form-label">{{ $t("Password") }}</label> | ||
<input id="nutPassword" v-model="monitor.nutPassword" type="password" class="form-control"> |
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.
Could you utilise the HiddenInput
component instead for all secret fields?
<!-- For NUT Type --> | ||
<template v-if="monitor.type === 'nut'"> | ||
<div class="my-3"> | ||
<label for="upsName" class="form-label">UPS {{ $t("Name") }}</label> |
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.
I think adding a description on where to obtain the correct ups name might be worth it to prevent other users spending excessive time on this field
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.
<!-- For NUT Type --> | ||
<template v-if="monitor.type === 'nut'"> | ||
<div class="my-3"> | ||
<label for="upsName" class="form-label">UPS {{ $t("Name") }}</label> |
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.
I am unshure if a longer name like name of the uninterruptible power supply
might be clearer and more importantly translate better.
In any case, I think it would be better if the word order ups name is correct in all languages (some are rtl) => It might be saver to include this in the translated string
Thoughts?
Use template string suggestion Co-authored-by: Frank Elsinga <frank@elsinga.de>
This comment was marked as off-topic.
This comment was marked as off-topic.
Another (a bit more permananet) solution might be to store the monior config as a json string. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Use searchable name Co-authored-by: Frank Elsinga <frank@elsinga.de>
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as resolved.
This comment was marked as resolved.
@johnelliott |
Description
Resolves #3932
Hello and thank you to @CommanderStorm for on-boarding me to the project in #3932
This is my first PR to the project. I read the contributions guide and I think I'm going about the style correctly.
Some questions I had were regarding the database schema,
Otherwise I added a separate file for the monitor as Frank suggested, used the new Knex migrations, and modeled the data after the way MQTT worked since the authentication of NUT isn't http basic auth.
Some shortcomings of this patch are that I wasn't sure how to deal with
isImportant
and the current patch creates some noise with the toasts popping up for each ping. I'd appreciate any help that can point me in towards solving that.Type of change
New feature (non-breaking change which adds functionality)
Checklist
(including JSDoc for methods)
Most of the added code is anonymous functions and doesn't ad library code for other code to use, so I didn't add extra documentation
I do see a warning I would like help with:
Screenshots
Edit Monitor