What's new

Entware Asus Merlin Entware NUT Server

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

busch09

Regular Contributor
on your router, ssh in, run amtm, install entware with "ep"

Setup NUT on Asus Merlin as per here:

need to change start upsd on asus to your login user as there is no root, tell the ASUS to load the UPS driver during boot and listen to the right IP.

my router 192.168.1.2, Merlin 386.1
```
Add/edit the following lines in these files.
/jffs/scripts/service-event
/tmp/mnt/32gb/entware/sbin/upsdrvctl -u admin start

/opt/etc/nut/
nut.conf
MODE=standalone

ups.conf
[ups]
driver = usbhid-ups
port = auto
pollinterval = 10

upsd.conf
LISTEN 127.0.0.1 3493
LISTEN 192.168.1.2 3493

upsd.users
[admin]
password = pass
actions = SET
instcmds = ALL
actions = fsd

[upsmon]
password = pass
upsmon master

upsmon.conf
RUN_AS_USER admin
MONITOR ups@localhost 1 upsmon pass master

/opt/etc/init.d/
S15upsmon
ARGS="-u admin -p"

S15upsd
ARGS="-u admin"
 
Last edited:
Hi there,

I'm trying to follow your instructions above and have managed to do everyrthing except for the first edit:
Add/edit the following lines in these files.
/jffs/scripts/service-event
/tmp/mnt/32gb/entware/sbin/upsdrvctl -u admin start

I'm unable to edit the service-event file and add /tmp/mnt/32gb/entware/sbin/upsdrvctl -u admin start to it. The file opens, but I can't save.
Any ideas? I've tried using putty and WinSCP.
Is there any other way to run a script to start the ups driver on boot?

Thanks
 
Thanks for posting. I setup NUT last year on my ac86u. At that time, I had to load 3 other kernel modules first. Which router did you use to set up NUT on?
 
Hi there,

I'm trying to follow your instructions above and have managed to do everyrthing except for the first edit:
Add/edit the following lines in these files.
/jffs/scripts/service-event
/tmp/mnt/32gb/entware/sbin/upsdrvctl -u admin start

I'm unable to edit the service-event file and add /tmp/mnt/32gb/entware/sbin/upsdrvctl -u admin start to it. The file opens, but I can't save.
Any ideas? I've tried using putty and WinSCP.
Is there any other way to run a script to start the ups driver on boot?

Thanks

When you are signing into the router, are you signing in as the router's admin user?
 
Hi there,
Thanks for the quick reply, seems like a reboot sorted things out. I was able to edit the file. I'm running an AC-88U router.
Do you perhaps have any scripts or guidelines for scripts that I can run to notify me via email that the UPS is running in battery mode or when it returns to AC mode?
I know how to send email and have setup a wan-event script that notifies me when WAN has been connected, but I'm unsure how to setup something to do with the UPS.
The article here http://www.giuseppeparrello.it/en/net_router_install_nut_server.php only shows how to get NUT running, but after a reboot I needed your startup scripts to get it working. Thanks alot!
 
I do. In fact, that is how I have NUT set up now. On certain events (i think there is 9 of them in all), i have NUT email and text me.

On vacation with the wife for the next couple of weeks, but can share my set up when i am back. Not hard, it is all in the NUT config files if you want to do some reading.

Otherwise, i will get back to you i get home.
 
Good morning @Michael Schemmer. We decided to come in from camp to do some laundry and go to Mass this morning, so it gave me the opportunity to get back to you.

The file you are going to want to modify is "/opt/etc/nut/upsmon.conf". I am assuming you got NUT working and the UPSMON is also started. If so, you have probably already made changes to upsmon.conf as you needed to supply the name of the UPS to monitor and the username of the router for UPSMON to use.

In the same upsmon.conf file is where you define the user script that you want to run on any UPS event and which events the script is to run, the script you want to use on an imminent UPS shutdown (I send a shutdown command to my server and NAS and put the router into a safe state before the plug gets pulled). The upsconf.conf file shipped with NUT is very well documented and explains everything well. I modified the event names in my install so that I use a case statements in my script easier.

If you need an example, I can share my modified upsmon and scripts, although you may need to wait another week :)
 
Hi @Jeffrey Young,
Apologies for the late reply. I managed to come right with the notifications! I now receive emails when my UPS goes ONBATT and ONLINE, which is perfect. I do however also periodically receive COMMBAD and COMMOK messages. I understand that these may occur when the router is rebooted or there is a service restart, but this also happens randomly during the day. Do you receive these too? I'm wondering if one can change the service timeout value to mitigate the errors? Or should I just edit the /opt/etc/nut/upsmon.conf NOTIFYFLAG COMMBAD and COMMOK values. I'd still like to know if communication to the UPS is broken, just not the email. Any ideas?

Regards,

Michael
 
I think I've managed to sort it out. Just removed the EXEC value for COMMBAD and COMMOK

Hi @Jeffrey Young,
Apologies for the late reply. I managed to come right with the notifications! I now receive emails when my UPS goes ONBATT and ONLINE, which is perfect. I do however also periodically receive COMMBAD and COMMOK messages. I understand that these may occur when the router is rebooted or there is a service restart, but this also happens randomly during the day. Do you receive these too? I'm wondering if one can change the service timeout value to mitigate the errors? Or should I just edit the /opt/etc/nut/upsmon.conf NOTIFYFLAG COMMBAD and COMMOK values. I'd still like to know if communication to the UPS is broken, just not the email. Any ideas?

Regards,

Michael
 
Glad you got it sorted out. I have only had one occasion that I got a commlost error.

Perhaps you are dealing with a flaky USB cable or perhaps you actually do have a hardware issue developing.
 
How to solve the problem of incorrect display of the voltage scale? shows the scale from -20 to 20v, but in fact there is 220v. screenshot attached
 

Attachments

  • Снимок экрана 2022-05-17 113453.png
    Снимок экрана 2022-05-17 113453.png
    28.5 KB · Views: 231
What Client software are you using? I use WinNUT, so I can't help you. That said, if I know what Client software you are using, perhaps a google search will help.
 
That is cool. I'll have to look into the package. As I said, right now, I use WinNUT for monitoring the UPS status. Only thing that I can suggest right now is seeing if there are any conf files that go with the cgi package. Perhaps there are range settings there.
 
That is cool. I'll have to look into the package. As I said, right now, I use WinNUT for monitoring the UPS status. Only thing that I can suggest right now is seeing if there are any conf files that go with the cgi package. Perhaps there are range settings there.
the problem is that the second ups displays the values correctly. And to be honest, I don't know where to look for the problem anymore (((
 

Attachments

  • A1767DBE-721F-400B-9B9D-EFF838A23025.png
    A1767DBE-721F-400B-9B9D-EFF838A23025.png
    119.4 KB · Views: 258
@Jeffrey Young Hope you're keeping well.

I'm trying to get NUT to work in a slightly different way. My setup is as follows:

1) ASUS AC88U router with NUT installed
2) I've connected the router to a LiPo Battery pack which keeps the Router and ONT available during long power outages
3) NUT on the router connects to an APC Backups Pro 900 UPS
4) The UPS is connected to a NUC and a Windows File Server which I'd like to gracefully shutdown when a power outage occurs

Currently, NUT works-ish as in it sends notifications when the UPS is in battery mode, but executing the shutdown script fails, in fact trying to run anything from SHUTDOWNCMD fails. At the moment, I've just connected a lightbulb to the UPS. When I pull the power and the battery goes below 95% I receive an email, but the shutdown script does not work. (I'd like to shutdown the UPS using /opt/sbin/upsdrvctl shutdown. I receive the following error in the router logs though:

upsmon[2700]: Unable to call shutdown command: /opt/sbin/upsdrvctl shutdown

Is there anything else I need to do to fix this?
 
Does the shutdown command work if you run in manually?

Couple of other things that come to mind is;

1. Is upsdrvctl installed? You need to install it separately using opkg.

2. Did you start upsdrvctl with the proper root user name? By default, upsdrvctl trys to start as user root. However, Asus changes the root user to what ever username you gave to the router. Therefore, to start the drivers, you need to use something like upsdrvctl -u $(nvram get http_username) start

3. Along the same line as item 2 above, perhaps you need to run upsdrvctl -u $(nvram get http_username) shutdown

Those are thoughts that come to mind right off the bat
 
Does the shutdown command work if you run in manually?

Couple of other things that come to mind is;

1. Is upsdrvctl installed? You need to install it separately using opkg.

2. Did you start upsdrvctl with the proper root user name? By default, upsdrvctl trys to start as user root. However, Asus changes the root user to what ever username you gave to the router. Therefore, to start the drivers, you need to use something like upsdrvctl -u $(nvram get http_username) start

3. Along the same line as item 2 above, perhaps you need to run upsdrvctl -u $(nvram get http_username) shutdown

Those are thoughts that come to mind right off the bat
Yip it is installed and I can start and stop it using the commands you sent, but if I run upsdrvctl -u $(nvram get http_username) shutdown I receive the following msg:
Network UPS Tools - UPS driver controller merge-with-ng-1378-gd1241271
Network UPS Tools - Generic HID driver 0.41 (merge-with-ng-1378-gd1241271)
USB communication driver 0.33
Can't claim USB device [051d:0002]: No such file or directory
Driver failed to start (exit status=1)

And lsusb outputs the following:
Bus 002 Device 003: ID 051d:0002
So the device is there....
I then run a
/opt/lib/nut/usbhid-ups -DDDDD -a ups -u $(nvram get http_username) and get the following:
0.003822 Checking device (051D/0002) (002/003)
0.014718 - VendorID: 051d
0.014763 - ProductID: 0002
0.014776 - Manufacturer: American Power Conversion
0.014788 - Product: Back-UPS RS 900G FW:879.L4 .I USB FW:L4
0.014800 - Serial Number:
0.014811 - Bus: 002
0.014823 - Device release number: 0090
0.014834 Trying to match device
0.014973 Device matches
0.015060 failed to claim USB device: Device or resource busy
0.015097 failed to detach kernel driver from USB device: No such file or directory
0.015116 failed to claim USB device: Device or resource busy
0.015134 failed to detach kernel driver from USB device: No such file or directory
0.015151 failed to claim USB device: Device or resource busy
0.015168 failed to detach kernel driver from USB device: No such file or directory
0.015184 failed to claim USB device: Device or resource busy
0.015200 failed to detach kernel driver from USB device: No such file or directory
0.015233 Can't claim USB device [051d:0002]: No such file or directory

Permissions for the driver itself?
 
Last edited:
Maybe the nvram variable is different in your router. Try using upsdrvctl with just the actual username of the router as opposed the fool proof way of using the nvram variable. ie. upsdrvctl -u admin shutdown, assuming admin is the username that you use to sign into the router.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top