Comments (11)
Nice finding!.. Just in case - is this with NUT 2.8.0 release (e.g. package)? I think one of the first found and fixed regressions dealt with something about misinterpreted states. Wondering if this issue is different?..
Can you please check if the problem is reproducible with current master (or 2.7.4)?
from nut.
I use 2.8.0 rpm package from EPEL patched and recompiled with cyberpower snmp driver from current master because the driver in 2.8.0 release is not functional.
Sorry, I'm not able to check it with current master.
For my needs, I solved this with my own patch, which adds a status flag for the OFF state and adds a condition to the recalc power value code in upsmon.
from nut.
Thanks. So the driver is from some recent master and should include those earlier fixes (including your PRs of late), right?
I think the fix I had in mind earlier was https://github.com/networkupstools/nut/pull/1432/files and probably does not impact detection of "OFF" state after all (but could impact the "NULL" state, in case this is what might bite you - IF you run the driver built from 2.8.0 code plus your patches, but not recent-ish master plus your patches).
from nut.
Yes, I'm using the latest driver, which works fine and returns the correct UPS states.
The value of MINSUPPLIES is the key element in determining if a server with multiple power supplies should shut down. When all the UPS units can be contacted, and when their ups.status values are known, then it is the count A of those that are active, that is without [LB], which is determinant.
So if my UPS in sleep mode can be contacted and its ups.status value is known ([OFF]), it is considered as active by upsmon?
from nut.
Sorry about the delay, finally got a moment to look at this intently. While scrolling through upsmon.c::parse_status()
I found that it considers several status key words, but not "OFF"
:
Lines 1887 to 1939 in 91b3ee0
The "OFF" value is used and status_set()
extensively in the codebase however, and is long defined in our standards as "UPS is offline and is not supplying power to the load ":
Lines 210 to 261 in 91b3ee0
So currently my best guess is that you could benefit from tinkering with code to add handling for such situation (UPS manageable, but its load is powered off) and if there's an iteration that works better than now - propose a PR ;)
I think I remember some discussions about it, that a very closely related case is about support of manageable outlet groups (or individual outlets, especially on ePDUs) - so the UPS overall maybe "OL" but the electric socket your server knows it is fed from is "OFF"; such situations could need additional MONITOR
parameters or some extended syntax for powerdevice@hostname
to monitor that outlet group. So maybe that got bogged down in talks and neither case got addressed yet.
On a related note, the BYPASS
case does not seem to be handled here either. For practical purposes it could be similar to LB
I suppose - there's maintenance on the UPS, load is fed from the wall, and might disappear any moment without clear notice. At least, if the UPS is not longer manageable, we might want to consider it dead, same as loss of connection during an outage, maybe? (An unplugged comms cable would be considered a power cut though) Not sure here, either...
For that matter, the internal upsmon bitmask values also do not currently cater for these states:
Lines 23 to 34 in 91b3ee0
from nut.
Thanks.
This OFF state is probably specific to cyberpower snmp UPSes. I modified uspmon.c for my needs, here is my modification against 2.8.0 if it would be useful for someone (sorry, I'm not a programmer :-))
diff -uNrp nut-2.8.0/clients/upsmon.h nut-2.8.0.p/clients/upsmon.h
--- nut-2.8.0/clients/upsmon.h 2022-04-27 00:03:31.000000000 +0200
+++ nut-2.8.0.p/clients/upsmon.h 2023-04-27 15:08:15.044584966 +0200
@@ -31,6 +31,7 @@
#define ST_LOGIN (1 << 5) /* we are logged into this UPS */
#define ST_CONNECTED (1 << 6) /* upscli_connect returned OK */
#define ST_CAL (1 << 7) /* UPS calibration in progress (CAL) */
+#define ST_OFF (1 << 8) /* UPS is off or on sleep (OFF) */
/* required contents of flag file */
#define SDMAGIC "upsmon-shutdown-file"
diff -uNrp nut-2.8.0/clients/upsmon.c nut-2.8.0.p/clients/upsmon.c
--- nut-2.8.0/clients/upsmon.c 2022-04-23 13:56:06.000000000 +0200
+++ nut-2.8.0.p/clients/upsmon.c 2023-04-27 23:29:00.418401200 +0200
@@ -442,6 +442,7 @@ static void ups_on_batt(utype_t *ups)
do_notify(ups, NOTIFY_ONBATT);
setflag(&ups->status, ST_ONBATT);
clearflag(&ups->status, ST_ONLINE);
+ clearflag(&ups->status, ST_OFF);
}
static void ups_on_line(utype_t *ups)
@@ -463,6 +464,7 @@ static void ups_on_line(utype_t *ups)
setflag(&ups->status, ST_ONLINE);
clearflag(&ups->status, ST_ONBATT);
+ clearflag(&ups->status, ST_OFF);
}
/* create the flag file if necessary */
@@ -809,7 +811,7 @@ static void recalc(void)
/* crit = (FSD) || (OB & LB) > HOSTSYNC seconds */
if (is_ups_critical(ups))
upsdebugx(1, "Critical UPS: %s", ups->sys);
- else
+ else if (!flag_isset(ups->status, ST_OFF))
val_ol += ups->pv;
ups = ups->next;
@@ -1697,7 +1699,11 @@ static void parse_status(utype_t *ups, c
upsreplbatt(ups);
if (!strcasecmp(statword, "CAL"))
ups_cal(ups);
-
+ if (!strcasecmp(statword, "OFF")) {
+ setflag(&ups->status, ST_OFF);
+ clearflag(&ups->status, ST_ONLINE);
+ clearflag(&ups->status, ST_ONBATT);
+ }
/* do it last to override any possible OL */
if (!strcasecmp(statword, "FSD"))
ups_fsd(ups);
from nut.
Seems reasonable, after that research :)
Care to post a PR, to log the changeset in your name? :)
As for "CPS SNMP only" - no, there are many (sub)drivers with different techs that have a status_set("OFF")
or equivalent in their sources - e.g. many USB UPSes stay connected even if their load is administratively off, it seems. Even if it were just one device type... you've stepped into this problem - chances are, someone else will.
from nut.
I'll leave it up to you to post a PR, no need to mention my name.
I have been using this code with dual Cyberpower UPS for several months now and have not experienced a problem.
from nut.
Several months? So, you've actually come to similar conclusions, and proofed them IRL? Nice to have convergences like this, builds confidence up a bit :)
from nut.
Hello @Bomorav, would you have a chance to check how the proposed change in https://github.com/jimklimov/nut/tree/issue-2044 behaves for you?
I hope it would still deduct the power value when one of those UPSes reports itself as OFF, return the counter when that UPS goes back ON, and would report this change (and back) among notifications.
from nut.
Behaved well in local tests simulated with NIT, PR merged.
from nut.
Related Issues (20)
- Add support for ups.conf.d HOT 3
- Improve mDNS announcement (or any other system)
- nutdrv_nutclient and nutdrv_simulation HOT 3
- SmartNUT Home Assistant Add-on
- SmartNUT Debian packaging
- Modbus driver on Proxmox HOT 5
- nut-scanner reports non-existent driver for NUT discovery HOT 1
- After firmware upgrade snmp-ups unable to get values from APC SMART UPS network card AOS AP9617 HOT 10
- Remaining MASTER without PRIMARY references HOT 1
- Communication lost after self test. HOT 12
- nut-scanner should detect and configure dummy simulation too HOT 1
- nut-scanner generated conf can cause device-name collisions HOT 1
- nut-scanner network scans should provide a "-m auto" option HOT 4
- bcmxcp_usb/alarm_set: result was truncated HOT 7
- NUT master-branch builds broken after recent PRs and/or infra changes HOT 7
- NJOY Horus Plus 600 360W HOT 1
- Tecnoware Era Plus 2000 HOT 26
- Riello SEP series USB even in ECO mode identifies as in bypass stating UPS needs attention on pfSense HOT 6
- [HCL] CyberPower CP1500AVRLCD3 supported by usbhid-ups HOT 2
- UPS Compaq R3000h HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nut.