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

Apcupsd NUT Wrapper Script issues with WebNUT Container #5

Closed
TechaNima opened this issue Mar 16, 2024 · 17 comments
Closed

Apcupsd NUT Wrapper Script issues with WebNUT Container #5

TechaNima opened this issue Mar 16, 2024 · 17 comments

Comments

@TechaNima
Copy link

I'm trying to get it to work with WebNUT container and I'm getting this kind of a log from the script:

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 >>> USERNAME monuser OK

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 PASSWORD secret

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 >>> PASSWORD secret OK

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 LIST UPS

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 >>> Serving all the names of the UPSs

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 LIST VAR ups

Fri 15 Mar 2024 09:40:14 PM EET REM_IP=10.7.5.201 PID=2426534 >>> Requested all VARs for UPSNAME=ups

Fri 15 Mar 2024 09:40:15 PM EET REM_IP=10.7.5.201 PID=2426534 >>> returned all VARs

Fri 15 Mar 2024 09:40:15 PM EET REM_IP=10.7.5.201 PID=2426534 GET UPSDESC ups

Fri 15 Mar 2024 09:40:15 PM EET REM_IP=10.7.5.201 PID=2426534 >>> failed to process command

Fri 15 Mar 2024 09:40:15 PM EET REM_IP=10.7.5.201 PID=2426534 LOGOUT

Fri 15 Mar 2024 09:40:15 PM EET REM_IP=10.7.5.201 PID=2426534 >>> Logout, exiting script
@gitmachtl
Copy link
Owner

Hi,

thx for opening the issue.

Is WebNUT not showing any value at all, or did it just miss the description?

Ciao
Martin

@gitmachtl
Copy link
Owner

@TechaNima hi, i have uploaded a new version in the "test" branch. can you try that out please and paste the LOG again here?

It should at least now get one step further. The question is, if WebNUT is requesting the description later on for each and every variable.

You can get the updated version here: https://raw.githubusercontent.com/gitmachtl/various/test/upsnutwrapper/upsnutwrapper.sh

@TechaNima
Copy link
Author

TechaNima commented Mar 18, 2024

Hi,

thx for opening the issue.

Is WebNUT not showing any value at all, or did it just miss the description?

Ciao Martin

Nada. It doesn't see any UPS info coming from the Proxmox host. I'll have a look at the updated script tomorrow after work. Apcupsd is working normally. I can see all the info correctly on the host and on its built in web page.

I have verified that the WebNUT port is open on the Container host VM and docker-compose is fine as well.
I'll paste the log after I update the script.

@TechaNima
Copy link
Author

TechaNima commented Mar 19, 2024

@gitmachtl

I can see both UPSs on WebNUT with the updated script. However, now I'm getting an internal server error when I click either of them in WebNUT.
WebNUT dashboard

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

Here's the log from the script:

root@pve:/usr/local/bin# cat /tmp/upsnutwrapper.log
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     USERNAME monuser
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> USERNAME monuser OK
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     PASSWORD secret
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> PASSWORD secret OK
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     LIST UPS
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Serving all the names of the UPSs
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     LIST VAR ups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Requested all VARs for UPSNAME=ups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> returned all VARs
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     GET UPSDESC ups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Requested upsdescription for UPSNAME=ups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     LIST VAR qnapups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Requested all VARs for UPSNAME=qnapups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> returned all VARs
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     GET UPSDESC qnapups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Requested upsdescription for UPSNAME=qnapups
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     LOGOUT
Tue 19 Mar 2024 08:17:43 PM EET REM_IP=10.7.5.201       PID=3960328     >>> Logout, exiting script
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     USERNAME monuser
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     >>> USERNAME monuser OK
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     PASSWORD secret
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     >>> PASSWORD secret OK
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     LIST UPS
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     >>> Serving all the names of the UPSs
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     LOGOUT
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961361     >>> Logout, exiting script
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     USERNAME monuser
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> USERNAME monuser OK
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     PASSWORD secret
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> PASSWORD secret OK
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     LIST VAR ups
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> Requested all VARs for UPSNAME=ups
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> returned all VARs
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     GET DESC ups server.info
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> failed to process command
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     LOGOUT
Tue 19 Mar 2024 08:18:07 PM EET REM_IP=10.7.5.201       PID=3961369     >>> Logout, exiting script

@gitmachtl
Copy link
Owner

ok, now WebNUT tries to request GET DESC ups server.info

have to implement the GET DESC <upsname> <varname> command into the script. as a background, this script was made to work with synology and qnap nas devices, and they never requested extra info like that. but ok... give me a bit to add this too.

its just a bit strange, that WebNUT cannot handle such things well. i would also open up a issue on the WebNUT github repo. because my script is returning an ERR UNKNOWN-COMMAND when it does not recognize a command. which is a normal behavior. that should not force WebNUT to crash.

i will get back to you when the GET DESC command is implemented.

@TechaNima
Copy link
Author

i would also open up a issue on the WebNUT github repo. because my script is returning an ERR UNKNOWN-COMMAND when it does not recognize a command. which is a normal behavior. that should not force WebNUT to crash.

Honestly, all the interactions between your script and WebNUT goes way above my understanding. You'd be much better at explaining this to them.

I'm a bit surprised that the script picked up my QNAP at all. It's not setup as a UPS master atm. Honestly, I had forgotten I had even plugged the other UPS into it.

Thank you for taking your time to make the script work with WebNUT. I definitely would not be able to.

@gitmachtl
Copy link
Owner

gitmachtl commented Mar 20, 2024

@TechaNima please check the updated version 1.7
https://raw.githubusercontent.com/gitmachtl/various/test/upsnutwrapper/upsnutwrapper.sh

! The QNAP is not picked up. The script is originally made to be used with Synology and QNAP nas devices. And those devices need a specific name on the Nut-Server. ups for Synology NAS devices and qnapups for QNAP devices. So the script presents those two names as available UPS names.

I don't know your setup. The script should be run on the machine that has the apcupsd installed. And than devices like Synology, QNAP or your WebNUT can connect to it as NUT-Clients.

@TechaNima
Copy link
Author

TechaNima commented Mar 20, 2024

Alrighty. It mostly works now.

root@pve:~/bin# /usr/local/bin/upsnutwrapper.sh: line 213: UPS_ups_timer_start-1: command not found
/usr/local/bin/upsnutwrapper.sh: line 216: UPS_ups_timer_shutdown-1: command not found
/usr/local/bin/upsnutwrapper.sh: line 213: UPS_ups_timer_start-1: command not found
/usr/local/bin/upsnutwrapper.sh: line 216: UPS_ups_timer_shutdown-1: command not found
/usr/local/bin/upsnutwrapper.sh: line 213: UPS_ups_timer_start-1: command not found
/usr/local/bin/upsnutwrapper.sh: line 216: UPS_ups_timer_shutdown-1: command not found

I don't know if these are reported in the first place, but these values are empty on WebNUT:

battery.charge.low No description
battery.temperature No value
input.frequency No value
ups.delay.start No description
ups.power.nominal No value
ups.temperature No value
ups.test.date No value
ups.timer.shutdown No value
ups.timer.start No value

@gitmachtl
Copy link
Owner

gitmachtl commented Mar 20, 2024 via email

@TechaNima
Copy link
Author

Looks clean at a glance

root@pve:~/bin# cat /tmp/upsnutwrapper.log
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      USERNAME monuser
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      >>> USERNAME monuser OK
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      PASSWORD secret
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      >>> PASSWORD secret OK
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      LIST UPS
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      >>> Serving all the names of the UPSs (ups)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      LOGOUT
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123641      >>> Logout, exiting script
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      USERNAME monuser
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> USERNAME monuser OK
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      PASSWORD secret
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> PASSWORD secret OK
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      LIST VAR ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested all VARs for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned all VARs
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups server.info
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=server.info for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_server_info=Server information
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups driver.parameter.pollfreq
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=driver.parameter.pollfreq for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_driver_parameter_pollfreq=Driver poll frequency (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.voltage
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.voltage for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_voltage=Input voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.transfer.high
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.transfer.high for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_transfer_high=High voltage transfer point (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.charge
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.charge for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_charge=Battery charge (percent)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.serial
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.serial for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_serial=UPS serial number (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups output.current
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=output.current for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_output_current=Output current (A)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.beeper.status
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.beeper.status for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_beeper_status=UPS beeper status (enabled, disabled or muted)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.vendorid
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.vendorid for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_vendorid=Vendor ID for USB devices (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.transfer.reason
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.transfer.reason for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_transfer_reason=Reason for last transfer to battery
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.id
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.id for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_id=UPS system identifier (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.mfr.date
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.mfr.date for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_mfr_date=Battery manufacturing date (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.test.date
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.test.date for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_test_date=Date of last self test (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups output.voltage
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=output.voltage for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_output_voltage=Output voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.productid
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.productid for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_productid=Product ID for USB devices
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.frequency.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.frequency.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_frequency_nominal=Nominal input line frequency (Hz)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.voltage.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.voltage.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_voltage_nominal=Nominal battery voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.voltage.maximum
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.voltage.maximum for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_voltage_maximum=Maximum incoming voltage seen (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups driver.parameter.pollinterval
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=driver.parameter.pollinterval for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_driver_parameter_pollinterval=Driver poll interval (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.voltage
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.voltage for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_voltage=Battery voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.test.result
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.test.result for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_test_result=Results of last self test (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.timer.shutdown
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.timer.shutdown for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_timer_shutdown=Time before the load will be shutdown (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.status
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.status for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_status=UPS status
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.date
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.date for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_date=Battery manufacturing date (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.mfr
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.mfr for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_mfr=UPS manufacturer
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups output.voltage.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=output.voltage.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_output_voltage_nominal=Nominal output voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.voltage.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.voltage.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_voltage_nominal=Nominal input voltage (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.power.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.power.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_power_nominal=Nominal value of apparent power (Volt-Amps)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.mfr.date
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.mfr.date for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_mfr_date=UPS manufacturing date (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups device.type
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=device.type for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_device_type=Device type (ups, pdu, scd, psu, ats)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.charge.low
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.charge.low for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> no description found for variable battery.charge.low (DESC_battery_charge_low)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups driver.version.internal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=driver.version.internal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_driver_version_internal=Internal driver version
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups driver.version.data
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=driver.version.data for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_driver_version_data=Version of the internal data mapping, for generic drivers
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.runtime.low
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.runtime.low for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_runtime_low=Remaining battery runtime when UPS switches to LB (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.timer.reboot
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.timer.reboot for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_timer_reboot=Time before the load will be rebooted (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.sensitivity
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.sensitivity for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_sensitivity=Input power sensitivity
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.load
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.load for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_load=Load on UPS (percent)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups driver.name
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=driver.name for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_driver_name=Driver name
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.runtime
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.runtime for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_runtime=Battery runtime (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups device.model
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=device.model for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_device_model=UPS model
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups device.description
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=device.description for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_device_description=Description of the device (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.charge.warning
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.charge.warning for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_charge_warning=Battery level when UPS switches to Warning state (percent)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.delay.shutdown
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.delay.shutdown for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_delay_shutdown=Interval to wait after shutdown with delay command (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.timer.start
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.timer.start for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_timer_start=Time before the load will be started (seconds)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups device.mfr
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=device.mfr for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_device_mfr=Device manufacturer
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.delay.start
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.delay.start for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> no description found for variable ups.delay.start (DESC_ups_delay_start)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.frequency
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.frequency for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_frequency=Input line frequency (Hz)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.type
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.type for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_type=Battery chemistry (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups device.serial
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=device.serial for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_device_serial=Device serial number (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups battery.temperature
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=battery.temperature for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_battery_temperature=Battery temperature (degrees C)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.voltage.minimum
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.voltage.minimum for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_voltage_minimum=Minimum incoming voltage seen (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.firmware.aux
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.firmware.aux for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_firmware_aux=Auxiliary device firmware
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups input.transfer.low
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=input.transfer.low for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_input_transfer_low=Low voltage transfer point (V)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.model
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.model for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_model=UPS model
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.firmware
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.firmware for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_firmware=UPS firmware (opaque string)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.realpower.nominal
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.realpower.nominal for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_realpower_nominal=Nominal value of real power (Watts)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      GET DESC ups ups.temperature
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Requested description for VAR=ups.temperature for UPSNAME=ups
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> returned desc for DESC_ups_temperature=UPS temperature (degrees C)
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      LOGOUT
Wed 20 Mar 2024 06:34:51 PM EET REM_IP=10.7.5.201       PID=123649      >>> Logout, exiting script

@TechaNima
Copy link
Author

Fixed some stuff that I noticed:

Line 83 DESC_battery_charge_log= -> DESC_battery_charge_low=
Line 205 DESC_ups_delay_shutdown= -> DESC_ups_delay_start=

Those 2 fixed the missing descriptions.
I assume the empty values could be fixed by giving them a default value.
I noticed some values had a default value of 0 or -1 and all of those do show up in WebNUT as 0 or -1

@gitmachtl
Copy link
Owner

gitmachtl commented Mar 21, 2024

@TechaNima yea thx, i did a super rush implementation for the DESC command so you can check it out.

Can you run the apcaccess command on the CLI and paste the output?
The values are only populated if they also showup in the apcaccess output. You can always give them a default value if needed yes.

@TechaNima
Copy link
Author

@gitmachtl

root@pve:~# apcaccess
APC      : 001,036,0863
DATE     : 2024-03-21 21:47:31 +0200
HOSTNAME : pve
VERSION  : 3.14.14 (31 May 2016) debian
UPSNAME  : pve
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2024-03-15 20:37:47 +0200
MODEL    : Back-UPS RS 1500G
STATUS   : ONLINE
LINEV    : 235.0 Volts
LOADPCT  : 15.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 44.6 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 176.0 Volts
HITRANS  : 288.0 Volts
ALARMDEL : No alarm
BATTV    : 27.3 Volts
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1309X13002
BATTDATE : 2022-08-01
NOMINV   : 230 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 865 Watts
FIRMWARE : 878.L4 .I USB FW:L4
END APC  : 2024-03-21 21:47:53 +0200

@gitmachtl
Copy link
Owner

thx, your ups is not reporting a value for the apparent power [VA] via the NOMAPNT value. that would be the ups.power.nominal value you asked about earlier. the value reported as NOMPOWER - 865 W in your case - is reported back as the ups.realpower.nominal value. is webNUT showing this value?

@gitmachtl
Copy link
Owner

@TechaNima i have uploaded a new version 1.9. In that version i also included your ups "Back-UPS RS 1500G" with the apparent power value.
https://raw.githubusercontent.com/gitmachtl/various/test/upsnutwrapper/upsnutwrapper.sh

@TechaNima
Copy link
Author

is reported back as the ups.realpower.nominal value. is webNUT showing this value?

Sure is https://gyazo.com/3e8dbf900bfcd623a07b6be234ebff67
New script looks like it's working perfectly.
Is it safe to leave logging on? Or is it going to leave the log file to grow until it can't anymore?
I know it only makes new lines when it's accessed, but it makes a lot of them at once.

Would be nice if non-reported values didn't show up in WebNUT, but that sounds like a problem for WebNUT devs and I don't care enough to bug them about it tbh.

Thank you for updating everything to work with WebNUT <3
I've been wanting to have a centralized place to see both UPS' and with this I can finally do it.
Then to figure out how to get this to work on my QNAP... Oh joy..

@gitmachtl
Copy link
Owner

gitmachtl commented Mar 22, 2024

Is it safe to leave logging on? Or is it going to leave the log file to grow until it can't anymore?
I know it only makes new lines when it's accessed, but it makes a lot of them at once.

The logfile would grow and grow. Is only ment to be used for troubleshooting, but not very useful in the longturm.

You can also remove the "qnapups" entry in this line

UPS_NAMES=("ups" "qnapups")
and only leave "ups" in or give it a name on your own. It must be a single word with no spaces or special chars. Than you would only see one ups listed and not "ups" and "qnapups" like right now. If a Synology NAS should be able to use it as a UPS, than "ups" must be in the list like now.

If you have a QNAP nas, you can directly point it to the IP if your pve host, which is running this wrapper script and it will see your ups.

Glad i works for you.

Best regards, Martin

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

No branches or pull requests

2 participants