-
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
feat(input): add upsd implementation #9890
Conversation
Thanks so much for the pull request! |
!signed-cla |
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.
Hey @Malinskiy, thanks for this nice plugin! I have some comments in the code... Please think about querying only a single server with the plugin as this will reduce the complexity quite dramatically. You can still collect multiple servers by duplicating the plugin entry in the config file.
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 quick adaptation! Some more comments from my side, the biggest question being why you are not using the upstream version of go.nut
?
"serial": fmt.Sprintf("%v", metrics["device.serial"]), | ||
"ups_name": name, | ||
//"variables": variables.Status not sure if it's a good idea to provide this | ||
"model": fmt.Sprintf("%v", metrics["device.model"]), |
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 don't use fmt.Sprintf
if not necessary. This way we will notice if the protocol changes (which should never happen actually).
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.
Nice update @Malinskiy! This only leaves us with the fmt.Sprintf
s and the restructuring of the tests. Furthermore, I want to ask you to split the status flags and add them as separate tags instead of a field...
@Malinskiy any chance to work on this? I'm eagerly waiting for this plugin to use with my UPS... :-) |
I will resume work on this when I have more time: have a conference talk to prepare to. |
@Malinskiy perfect. Just wanted to let you know your PR is appreciated. :-) |
With the fmt.Sprintf - it's either this or a type cast. If you really want to break in case there is a protocol change - let me know, otherwise I'd leave the fmt.Sprintf call and the breaking behaviour becomes just an incorrect metric |
📦 Looks like new artifacts were built from this PR. Expand this list to get them here! 🐯Artifact URLs |
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.
Hey @Malinskiy thanks for the nice update. I think the code is pretty close now, however, I think the remaining fmt.Sprintf
s should be removed and replace by proper "casting".
Furthermore, depending on your fork for this plugin is not something we should do as telegraf would then rely on a single person maintaining an external library. Therefore we try to avoid using forked version of libraries wherever possible. I want to ask you to either upstream your changes or to not rely on your modifications and switch to the upstream go.nut
library.
Removed timeout handling as requested, upstream version is used. Keep in mind that upstream version does 2 additional network requests each time it connects, namely Sidenote: I am running the forked version of go.nut since October without any issues. |
Exciting! 🎉 |
@srebhan @Malinskiy any update on this one ? I can't wait to get rid of the python scripts I currently use and send UPS data with Telegraf instead :) |
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.
Looks good. I only have one comment about the naming of the ups.status
field. Can you please solve this and I think we are ready to go...
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
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.
Looks good to me. Thank you very much @Malinskiy for keeping this PR alive!
I will fix the sample.conf
once this is merged...
Thanks @Malinskiy! |
@ostueker you are right. This is due to the changed way of how the sample configuration is handled now. Can you please open an issue and assign it to me or at least mention me? I'll fix the plugin today then... |
Hi, Thank you in advance |
It doesn't look like it's been released yet unless you build your own from master
Aug 2, 2022 13:11:06 Karel Krýda ***@***.***>:
… Hi,
I'm using docker version 1.23.3. According to the date of merging this PR, the plugin should already be available, but it is not.
Am I doing something wrong, or will the plugin only be available in the next version?
Thank you in advance
—
Reply to this email directly, view it on GitHub[#9890 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABXBTVQDLAFPQV6OUEOLBN3VXEF5HANCNFSM5FSTHYKA].
You are receiving this because you were mentioned.[Tracking image][https://github.com/notifications/beacon/ABXBTVSD7QJ4FWIPTMEOZM3VXEF5HA5CNFSM5FSTHYKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOI6VTXFQ.gif]
|
the sample telegraf configuration contains a sample of this plugin, but for some reason the plugin itself is not part of the current version 1.23.3 despite the fact that it was released 8 days ago and this plugin was merged 28 days ago. |
If I have to guess the documentation is updated between minor release and plugins like this between main release like a 1.24 maybe? I'm waiting too for this to be implemented |
New plugins are generally not added to bug-fix releases. This will be released in v1.24.0. We have nightly packages, archives, and docker images for users who want to jump-start on what is available. We appreciate when users do run these nightly images to catch issues earlier, but the typical warnings about the fact that they are nightlies apply. |
I'm having an issue with mixed types on Also, I'm considering a patch to report power draw, but since both vendors also report that differently, I want to test the waters here for whether that's in the scope of the plugin. The APCs give me output voltage and current, and don't distinguish between reactive and apparent power, even though load% for both is available in the web UI. The Eaton, however, gives |
@calebj can you please open an issue (best is one per topic) to discuss on how to go on from here!? |
Required for all PRs:
Fixes #6316
Added an input plugin to gather upsd metrics using a forked golang library Malinskiy/go.nut from robbiet480/go.nut. Fork is needed to support network timeouts. The metrics are mimicking the apcupsd input plugin as close as possible to allow users to reuse existing dashboards.