Beta test of new NUT UPS package
-
I'm not testing this but was hoping I could add some food for thought. Just speaking from my personal experience from running about 5 different pfSense routers for myself, my small business and a family member's small biz. I've used NUT and my typical setup is to have it remotely access the UPS connected directly to my Synology and/or FreeNAS devices. Obviously, because I'm dealing with small spaces and cannot have a dedicated UPS for every device.
My biggest headache has been when things go bad. Example - A pfSense router goes whacky and a fresh install then restore from backup config has to be performed. Typically, this is simple enough. However, I've always had trouble with NUT causing odd behavior with the recovery. I've had to manually edit the config file and remove all traces of NUT content. For the record, I've learned to create backup configs that do not include package data
I'd like to see this new version play nice on recovery if a config does happen to include package data…if possible.
Also, I'm very excited to see a new version and continued development of this package! Thanks DennyPage!
-
Yea, that makes sense. Theres a bit of a catch-22 as the async startup for the driver is required to support the use of startup retry (maxretry/retrydelay) in ups.conf. It's taking a long time for the initial connect to the SNMP UPS.
-
Beta 4 appears to have the same problem with Snort.
-
Can you confirm the checksum on the following files please?
32332 22 /usr/local/www/nut_settings.php
14138 5 /usr/local/www/nut_status.php
47031 3 /usr/local/pkg/nut.xml
3633 12 /usr/local/pkg/nut/nut.incBeta 4 appears to have the same problem with Snort.
-
I uninstalled and reinstalled the package and it's ok now.
-
Kinda figured that would do it. Thanks for confirming.
I uninstalled and reinstalled the package and it's ok now.
-
This modification works for me.
$status = nut_ups_status(); if ($status['_alert']) { sleep(10); $status = nut_ups_status(); if ($status['_alert']) { print_info_box("Status Alert: The UPS requires attention", "alert-danger"); } }
The other issue I have — head.inc does not show restart service button anymore after successful restart, but if I unplug cable from SNMP card then it shows.
-
$status = nut_ups_status(); if ($status['_alert']) { sleep(10); } $pgtitle = array(gettext("Services"), gettext("UPS"), gettext("Status")); include("head.inc"); $tab_array = array(); $tab_array[] = array(gettext("UPS Status"), true, "/nut_status.php"); $tab_array[] = array(gettext("UPS Settings"), false, "/nut_settings.php"); display_top_tabs($tab_array); $status = nut_ups_status(); if ($status['_alert']) { print_info_box("Status Alert: The UPS requires attention", "alert-danger"); }
This way both problems fixed, with buttons and wait for service be ready on page load.
-
Yea, there isn't much ill that a 10 second sleep doesn't fix. However I don't think I can introduce a 10 second sleep in the UX. It creates a delay in communicating the error condition for local UPSs.
-
Yea, there isn't much ill that a 10 second sleep doesn't fix. However I don't think I can introduce a 10 second sleep in the UX. It creates a delay in communicating the error condition for local UPSs.
Sleep activated only if first $status query return '_alert', else NO DELAY applied. In normal condition if I understand your
nut.inc correctly this never should return '_alert' if connection is OK, it does not matter local or remote connection established. -
It introduces a ten second delay in all alert circumstances. However the issue we are trying to address only occurs on service start and only with a slow (remote) UPS.
-
Btw, forgot to ask this earlier: Is the use of v2c a holdover from the prior NUT package, or did you explicitly configure it? Have you tried running without it?
-
It introduces a ten second delay in all alert circumstances. However the issue we are trying to address only occurs on service start and only with a slow (remote) UPS.
I am not sure are we talking about the same thing? I have tested it with firefox and it works as it should in UX. If UPS connection is OK and established there is no delay in loading status page, I mean delay is less then 1 second and if there is a problem with connection (cable unplugged or whatever), then it returns "Status Alert: The UPS requires attention" as it should be but after 10 seconds delay or returns UPS data if connection is established during this 10sec sleep. Why sleep should be called in all alert circumstances? I don't understand. I am sorry. I am not an PHP programmer, but if logiс is the same for all languages I know. If I do something wrong, then feel free to tell me :)
Btw, forgot to ask this earlier: Is the use of v2c a holdover from the prior NUT package, or did you explicitly configure it? Have you tried running without it?
It's not from prior, it's required for some other clients on network.
EDIT:
Now I understand what you mean, forgive me please for my stupidity. Looked deeply into nut.inc
Yes we need some other way to fix it. -
I'm not a PHP guy either. I'm a C and assembler programmer. :)
The proposed change introduces a 10 second delay to page processing if there is any alert condition. Let's say you have a local UPS, either local or remote, which has been running fine and then goes into alert state. You click on the widget header to go to the UPS status page. That page load will experience a 10 second delay, which it shouldn't.
The core issue comes from the delay between service start and service availability due to the time taken in driver initialization when talking to the SNMP UPS. It is only during this interval that a delay would be appropriate.
@w0w:
It introduces a ten second delay in all alert circumstances. However the issue we are trying to address only occurs on service start and only with a slow (remote) UPS.
I am not sure are we talking about the same thing? I have tested it with firefox and it works as it should in UX. If UPS connection is OK and established there is no delay in loading status page, I mean delay is less then 1 second and if there is a problem with connection (cable unplugged or whatever), then it returns "Status Alert: The UPS requires attention" as it should be. Why sleep shoud be called in all alert circumstances?
-
Now I understand what you mean, forgive me please for my stupidity. Looked deeply into nut.inc
Yes we need some other way to fix it. -
Okay. Just to make sure I understand, driver initialization fails if you remove the snmp_version=v2c from the Extra Arguments? What is in the log file?
-
No, not the driver init, but I am using SNMP card with other devices, one of them polls in SNMP v2.1c, so I decided to configure SNMP card with this version and configure all clients to use it.
Ok, I have isolated sleep function to only when "UPS Monitor not running" condition. This looks much better ;)
$status = nut_ups_status(); if ($status['_summary'] == "UPS Monitor not running") { sleep(10); } $pgtitle = array(gettext("Services"), gettext("UPS"), gettext("Status")); include("head.inc"); $tab_array = array(); $tab_array[] = array(gettext("UPS Status"), true, "/nut_status.php"); $tab_array[] = array(gettext("UPS Settings"), false, "/nut_settings.php"); display_top_tabs($tab_array); $status = nut_ups_status(); if ($status['_alert']) { print_info_box("Status Alert: The UPS requires attention", "alert-danger"); }
-
I sent out a new version to everyone. If you have a moment, please give it a run and let me know if you see any issues. Thanks!
-
Nothing changed for me.
-
Yes, the changes affect service status on restart and reboot. Please confirm the checksum of nut.inc:
49946 12 /usr/local/pkg/nut/nut.inc
If you haven't already, please go to the settings page and re-save before testing again. Thanks.