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

UPS support #488

Open
rmenessec opened this issue Jan 18, 2015 · 6 comments
Open

UPS support #488

rmenessec opened this issue Jan 18, 2015 · 6 comments

Comments

@rmenessec
Copy link

Would it be possible to add support for basic UPS status--say batt level, temp, and offline / online status?

PyNUT appears to ship as part of the Network UPS Tools.

Thanks!

@nicolargo nicolargo added this to the Next releases milestone Jan 19, 2015
@nicolargo
Copy link
Owner

nicolargo commented Jan 19, 2015

Development test bed:

@rmenessec
Copy link
Author

Well, no, PyNUT isn't available via pip. It only appears to be shipped with each release of NUT. That said, it's available as a separately installable package via at least Debian-derived distros ("python-nut").

I have several non-APC units, so apcupsd wouldn't get me glances support; I'm not sure if the first link is meant to imply adding support via apcupsd.

@nicolargo nicolargo modified the milestones: Next releases, Version 2.5 May 4, 2015
@nicolargo nicolargo modified the milestones: Next releases, Version 2.5 Aug 15, 2015
@nicolargo nicolargo modified the milestones: Next releases, Version 2.8 Sep 11, 2016
@nicolargo
Copy link
Owner

Could be implemented through an AMP ==> http://glances.readthedocs.io/en/stable/aoa/amps.html

@rmenessec
Copy link
Author

@nicolargo , there's nothing in the documentation to indicate that an AMP can be used to evaluate command output. I'm also not seeing a way to discard stderr.
This—

# upslist0 2> /dev/null ups.load
9

—becomes this—

Ups_load			1	Init SSL without certificate database
					9

—in the current best case, with the label malformed, useless stderr output included, and no obvious processing of the value (9%). I don't see a way to trigger a warning or error in Glances if the value is, for example, 75% or 90%. There's no intelligent formatting of the output, and no way to define it, either.

What I was really looking for was something like the output from lm_sensors that Glances already formats, displays attractively, and handles error reporting for.

Since it's impossible to write some custom script to be executed by Glances that can take into account the display width and height and perform formatting and line-wrapping, it's also impossible to avoid wasting a huge amount of vertical and horizontal space. This information—

# upslist0 |& egrep '(battery.(charge|runtime|temperature|voltage))|(input.(frequency|voltage))|(output.(frequency|voltage))|(ups.(load|status)):'
battery.charge: 100
battery.charge.low: 25
battery.charge.warning: 50
battery.runtime: 6365
battery.temperature: 18.9
battery.voltage: 55.7
battery.voltage.nominal: 48.0
input.frequency: 59.9
input.voltage: 121.9
input.voltage.nominal: 120
output.frequency: 59.9
output.frequency.nominal: 60
output.voltage: 119.8
output.voltage.nominal: 120
ups.load: 9
ups.status: OL

—could be displayed on as little as one line with some abbreviation and grouping. The only way to do that, however, would be if Glances actually parsed the output as variables, which it doesn't.

(I tried sending some tabs and ANSI escape codes for color highlighting through AMP. The escapes were printed as literal characters and the tabs ended up uneven somehow. So it looks like Glances is in complete control of the display, and I can't customize it even the least bit by writing a wrapper to attempt to handle some of the parsing and formatting myself.)

One item that occurred to me, involving saved space? Glances could use some global options to optionally hide or "collapse" output as long as it doesn't indicate a warning / error / critical state. Intelligent retrieval of NUT variables—again, completely possible through the Python bindings the NUT project provides—could transform a list of "healthy" UPS variables into a space-saving "UPS: GOOD", or even just a "UPS" section header in green, with no contents.

Likewise, it would be great to be able to hide filesystems that aren't over a certain percentage used, sensors or a laptop battery that are within normal parameters, and so forth. The same could be done with the process listing, by providing the ability to hide processes that aren't performing storage I/O or network I/O, aren't utilizing more than a configurable range (1-5%?) of CPU time, and so forth.

If this is something you'd consider, I'd be happy to split it into a separate issue.

Thanks!

@nicolargo nicolargo reopened this Mar 10, 2017
@nicolargo nicolargo added this to the Glances 2.9 milestone Mar 10, 2017
@nicolargo nicolargo modified the milestones: Glances 2.9, Glances 2.9.1 Mar 27, 2017
@nicolargo nicolargo modified the milestones: Glances 2.9.2, Glances 2.9.1 Mar 29, 2017
@nicolargo nicolargo modified the milestones: Glances 2.9.2, Next releases Apr 11, 2017
@nicolargo nicolargo modified the milestone: Next releases May 28, 2017
@utdrmac
Copy link

utdrmac commented Apr 24, 2019

Has there been any progress on this?

@RazCrimson
Copy link
Collaborator

In case anyone is interested in contributing, newer version of PyNUT: https://github.com/rshipp/python-nut2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants