Can't get upsmon service started to monitor (and respond to) remote UPS

9,011

Solution 1

For some ridiculous reasons the client's upsmon requires the password for readonly operation. Fake passwords don't work (while e.g. nut-monitor will accept it). This could be troubling if passwords are not used / not visible to the user, especially for appliances. Some users will set up the configuration, start the service (often no error reported) and keep the dysfunctional configuration running for years.

Luckily millions of appliances will have some of the credentials collected below, in order to try a little dictionary attack:

  • monuser / secret
  • monuser / pass
  • upsmon / 123456
  • upsmon / pass
  • admin / 123456
  • UPSMON / UPSMON
  • upsmon / fixmepass
  • realadminuser / realadminpassword (if a distro takes a bit care of it, but usually for admins only)

If there's an access to the UPS host, it'd make sense to search for a copy of the configfile in case it's not placed in /etc/nut:

find / -name uspd.users

Solution 2

You need to edit /etc/nut/upsd.users (on buffalo.local in your case) and define a upsmon user, like so:

[yourupsmonuser]
password = somerandompassword
upsmon master

Then in /etc/nut/upsmon.conf (on the "monitoring" machine) set the MONITOR line to

MONITOR yourups@yourhost 1 yourupsmonuser somerandompassword master

With a systemctl enable nut-monitor that should be it. Just watch out for SystemD starting up your upsmon instance before the network is available - it will fail to assert MINSUPPLIES 1 and trigger the shutdown of your computer before you're able to edit /etc/nut/upsmon.conf to increase the DEADTIME. Cue lots of "fun".

Share:
9,011

Related videos on Youtube

stefandz
Author by

stefandz

You want electrons? We got electrons. You want design? We got that too.

Updated on September 18, 2022

Comments

  • stefandz
    stefandz almost 2 years

    I am having difficulty getting my nut install to simply monitor a single remote UPS attached to a Buffalo LinkStation Duo. I can manually correctly read its status using upsc [email protected] and it is user / passwordless.

    Long-run, what I want is for my system to monitor this remote UPS - if it goes into battery operation, I want my system to shut down (the UPS behaviour itself will be managed by the LinkStation Duo).

    Relevant config files

    #/etc/nut/upsmon.conf
    
    MONITOR [email protected]
    MINSUPPLIES 1
    SHUTDOWNCMD "/sbin/shutdown -h +0"
    POLLFREQ 5
    POLLFREQALERT 5
    HOSTSYNC 15
    DEADTIME 15
    POWERDOWNFLAG /etc/killpower
    NOTIFYMSG ONLINE    "UPS %s on line power"
    NOTIFYMSG ONBATT    "UPS %s on battery"
    NOTIFYMSG FSD       "UPS %s: forced shutdown in progress"
    NOTIFYMSG SHUTDOWN  "Auto logout and shutdown proceeding"
    NOTIFYFLAG ONLINE   SYSLOG+WALL
    NOTIFYFLAG ONBATT   SYSLOG+WALL
    NOTIFYFLAG FSD  SYSLOG+WALL
    NOTIFYFLAG SHUTDOWN SYSLOG+WALL
    RBWARNTIME 43200
    NOCOMMWARNTIME 300
    FINALDELAY 5
    

    -

    #/etc/nut/nut.conf
    
    MODE=netclient
    

    The other config files are untouched - that is they do not implement any local UPSes (as there are none) - but I think that might be part of my issue, as in /var/log/syslog we have this after boot:

    upsdrvctl[559]: Network UPS Tools - UPS driver controller 2.7.2
    upsmon[588]: fopen /var/run/nut/upsmon.pid: No such file or directory
    upsmon[588]: /etc/nut/upsmon.conf line 86: invalid directive MONITOR [email protected]
    upsmon[588]: Using power down flag file /etc/killpower
    upsmon[588]: Network UPS Tools upsmon 2.7.2
    upsmon[588]: Fatal error: insufficient power configured!
    upsmon[588]: Sum of power values........: 0
    upsmon[588]: Minimum value (MINSUPPLIES): 1
    upsmon[588]: Edit your upsmon.conf and change the values.
    

    So upsmon doesn't think I have correctly configured the remote UPS - but I don't know how to configure it to be user / passwordless. Any help would be gratefully received - I have spent a fair bit of time with Google on this and find myself stuck.

  • stefandz
    stefandz over 6 years
    This is great advice - but I don't have access to buffalo.local's filesystem sadly. In the end I found that just running /bin/upsc [email protected] ups.status and parsing the output was enough.