[SOLVED] UPS, Uninteruptible Power, nut-driver vs nut-server

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] UPS, Uninteruptible Power, nut-driver vs nut-server

Postby hankivy » May 2nd, '15, 20:02

I am looking at the "Manage system services by enabling or disabling them" window of the "Mageia Control Center". Three of the services listed are nut-driver, nut-monitor, and nut-server.

[I am running "3.14.39-desktop-1.mga4 #1 SMP Sun Apr 19 14:21:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux".]

nut-monitor runs two processes, a parent and a child version of /usr/sbin/upsmon.

What is the difference between nut-driver, and nut-server? :?:

Starting the nut-driver service starts two processes.
Code: Select all
ups      24190     1  0 12:43 ?        00:00:00 /sbin/usbhid-ups -a HbiLinTower
ups      24192     1  0 12:43 ?        00:00:00 /usr/sbin/upsd


Starting the nut-server service starts two processes.
Code: Select all
ups      24301     1  0 12:45 ?        00:00:00 /sbin/usbhid-ups -a HbiLinTower
ups      24303     1  0 12:45 ?        00:00:00 /usr/sbin/upsd


I have one UPS, and one Linux tower for my system. In my simplistic configuration are the two services redundant? :?: If one is redundant, which is preferred? :?:

If I start, and stop nut-driver, and then nut-server, I get the following messages in my system logs.
Code: Select all
May  2 12:43:56 HIvyTower drakxservices[23520]: running: /bin/systemctl --quiet is-active nut-driver.service
May  2 12:45:17 HIvyTower drakxservices[23520]: GP_LANG="UTF-8" service nut-driver stop
May  2 12:45:17 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.
May  2 12:45:17 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.
May  2 12:45:17 HIvyTower drakxservices[23520]: running: /bin/systemctl --quiet is-active nut-driver.service
May  2 12:45:36 HIvyTower drakxservices[23520]: GP_LANG="UTF-8" service nut-server restart
May  2 12:45:37 HIvyTower drakxservices[23520]: running: /bin/systemctl --quiet is-active nut-server.service
May  2 12:52:44 HIvyTower drakxservices[23520]: GP_LANG="UTF-8" service nut-server stop
May  2 12:52:44 HIvyTower drakxservices[23520]: running: /bin/systemctl --quiet is-active nut-server.service
May  2 12:52:44 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.
May  2 12:52:44 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.


The nut-driver service seems to be stopped when I stop the nut-server service.
Last edited by hankivy on Aug 29th, '15, 22:51, edited 3 times in total.
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: UPS, Uninterruptable Power Supply, nut-driver vs nut-ser

Postby doktor5000 » May 3rd, '15, 00:57

You could take a look at the systemd service files to see what they do:

/usr/lib/systemd/system/nut-driver.service
/usr/lib/systemd/system/nut-server.service

Apart from that can't really help that much, you might need to read the documentation at http://www.networkupstools.org/documentation.html
or wait for some kind soul to reply which actually uses an UPS.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: UPS, Uninterruptable Power Supply, nut-driver vs nut-ser

Postby jiml8 » May 3rd, '15, 20:07

The nut driver is a device-specific interface; the nut server is a server that uses the driver to communicate with the UPS.

That said, I have an APC UPS supporting my workstation and I use apcupsd rather than nut, and gapcmon for a UI. It has always worked well for me.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: UPS, Uninterruptable Power Supply, nut-driver vs nut-ser

Postby doktor5000 » May 4th, '15, 01:19

jiml8 wrote:The nut driver is a device-specific interface; the nut server is a server that uses the driver to communicate with the UPS.

Understood, but shouldn't then both be running? For the OP only the server seems to run.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

UPS, Uninterruptable Power Supply, nut-driver vs nut-server

Postby hankivy » May 4th, '15, 09:30

One issue seems to be that processes, start and stop differently when I use different methods.
The first method is the "Mageia Control Center" - "Manage System Services".
The second method is the command line usage of the systemctl command.

The important lines of the systemd unit files for the nut services are:
Code: Select all
[hank@HIvyTower system]$ pwd
/usr/lib/systemd/system
[hank@HIvyTower system]$ grep -v -e "^#" -e "^\$" nut-* | grep -e ":After" -e ":Before" -e ":Requires" -e ":ExecSt" -e ":Stop" | more
nut-driver.service:After=local-fs.target network.target
nut-driver.service:StopWhenUnneeded=yes
nut-driver.service:ExecStart=/sbin/upsdrvctl start
nut-driver.service:ExecStop=/sbin/upsdrvctl stop
nut-monitor.service:After=local-fs.target network.target nut-server.service
nut-monitor.service:ExecStartPre=-/usr/bin/systemd-tmpfiles --create /lib/tmpfiles.d/nut-client.conf
nut-monitor.service:ExecStart=/usr/sbin/upsmon
nut-server.service:After=local-fs.target network.target nut-driver.service
nut-server.service:Requires=nut-driver.service
nut-server.service:Before=nut-monitor.service
nut-server.service:ExecStart=/usr/sbin/upsd
[hank@HIvyTower system]


I can start the nut driver from the Mageia Control Center, and it will continue to run without the other nut services running.
But the unit file says to stop the nut-driver when it is not needed, and only the nut-server says it will need it.
If I use the command line to start the nut-driver, it will start, and stop because nothing needs it. Like so:
Code: Select all
[hank@HIvyTower ~]$ sudo systemctl start nut-driver
[sudo] password for hank:
[hank@HIvyTower ~]$ ps -ef | grep -v -e grep -e cups | grep -i -e nut -e ups
[hank@HIvyTower ~]$ sudo systemctl status nut-driver                       
nut-driver.service - Network UPS Tools - power device driver controller
   Loaded: loaded (/usr/lib/systemd/system/nut-driver.service; static)
   Active: inactive (dead)

May 04 01:49:31 HIvyTower systemd[1]: Service nut-driver.service is not needed anymore. Stopping.
May 04 01:49:31 HIvyTower systemd[1]: Stopping Network UPS Tools - power device driver controller...
May 04 01:49:31 HIvyTower usbhid-ups[15067]: Startup successful
May 04 01:49:31 HIvyTower upsdrvctl[15071]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Using subdriver: CyberPower HID 0.3
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Network UPS Tools - Generic HID driver 0.37 (2.6.5)
May 04 01:49:31 HIvyTower upsdrvctl[15061]: USB communication driver 0.31
May 04 01:49:31 HIvyTower upsdrvctl[15061]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:49:33 HIvyTower usbhid-ups[15067]: Signal 15: exiting
May 04 01:49:33 HIvyTower systemd[1]: Stopped Network UPS Tools - power device driver controller.
[hank@HIvyTower ~]


If I start the nut-server using the CLI, then all three services are started, and continue to run. See:
Code: Select all
[hank@HIvyTower ~]$ sudo systemctl start nut-server
[hank@HIvyTower ~]$ sudo systemctl status nut-driver           
nut-driver.service - Network UPS Tools - power device driver controller
   Loaded: loaded (/usr/lib/systemd/system/nut-driver.service; static)
   Active: active (running) since Mon 2015-05-04 01:58:10 CDT; 8s ago
  Process: 15830 ExecStop=/sbin/upsdrvctl stop (code=exited, status=0/SUCCESS)
  Process: 15865 ExecStart=/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
 Main PID: 15871 (usbhid-ups)
   CGroup: /system.slice/nut-driver.service
           └─15871 /sbin/usbhid-ups -a HbiLinTower

May 04 01:58:10 HIvyTower systemd[1]: Starting Network UPS Tools - power device driver controller...
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Using subdriver: CyberPower HID 0.3
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Network UPS Tools - Generic HID driver 0.37 (2.6.5)
May 04 01:58:10 HIvyTower upsdrvctl[15865]: USB communication driver 0.31
May 04 01:58:10 HIvyTower usbhid-ups[15871]: Startup successful
May 04 01:58:10 HIvyTower upsdrvctl[15865]: Network UPS Tools - UPS driver controller 2.6.5
May 04 01:58:10 HIvyTower systemd[1]: Started Network UPS Tools - power device driver controller.
[hank@HIvyTower ~]$ sudo systemctl start nut-server 
[hank@HIvyTower ~]$ sudo systemctl status nut-server
nut-server.service - Network UPS Tools - power devices information server
   Loaded: loaded (/usr/lib/systemd/system/nut-server.service; disabled)
   Active: active (running) since Mon 2015-05-04 01:58:10 CDT; 37s ago
  Process: 15872 ExecStart=/usr/sbin/upsd (code=exited, status=0/SUCCESS)
 Main PID: 15873 (upsd)
   CGroup: /system.slice/nut-server.service
           └─15873 /usr/sbin/upsd

May 04 01:58:10 HIvyTower upsd[15872]: fopen /var/state/ups/upsd.pid: No such file or directory
May 04 01:58:10 HIvyTower upsd[15872]: listening on 127.0.0.1 port 3493
May 04 01:58:10 HIvyTower upsd[15872]: /var/state/ups is world readable
May 04 01:58:10 HIvyTower upsd[15872]: Connected to UPS [HbiLinTower]: usbhid-ups-HbiLinTower
May 04 01:58:10 HIvyTower upsd[15872]: listening on 127.0.0.1 port 3493
May 04 01:58:10 HIvyTower upsd[15872]: /var/state/ups is world readable
May 04 01:58:10 HIvyTower upsd[15872]: Connected to UPS [HbiLinTower]: usbhid-ups-HbiLinTower
May 04 01:58:10 HIvyTower upsd[15873]: Startup successful
May 04 01:58:10 HIvyTower systemd[1]: Started Network UPS Tools - power devices information server.
May 04 01:58:36 HIvyTower systemd[1]: Started Network UPS Tools - power devices information server.
[hank@HIvyTower ~]$ sudo systemctl status nut-monitor
nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
   Loaded: loaded (/usr/lib/systemd/system/nut-monitor.service; disabled)
   Active: active (running) since Mon 2015-05-04 01:55:50 CDT; 3min 9s ago
  Process: 15701 ExecStart=/usr/sbin/upsmon (code=exited, status=0/SUCCESS)
  Process: 15699 ExecStartPre=/usr/bin/systemd-tmpfiles --create /lib/tmpfiles.d/nut-client.conf (code=exited, status=0/SUCCESS)
 Main PID: 15705 (upsmon)
   CGroup: /system.slice/nut-monitor.service
           ├─15704 /usr/sbin/upsmon
           └─15705 /usr/sbin/upsmon

May 04 01:57:35 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:40 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:45 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:50 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:57:55 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:00 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:05 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:10 HIvyTower upsmon[15705]: UPS [HbiLinTower@localhost]: connect failed: Connection failure: Connection refused
May 04 01:58:15 HIvyTower upsmon[15705]: Login on UPS [HbiLinTower@localhost] failed - got [ERR ACCESS-DENIED]
May 04 01:58:20 HIvyTower upsmon[15705]: Communications with UPS HbiLinTower@localhost established
[hank@HIvyTower ~]


Here are the processes finally running:
Code: Select all
[hank@HIvyTower ~]$ ps -ef | grep -v -e grep -e cups | grep -i -e nut -e ups
root     15704     1  0 01:55 ?        00:00:00 /usr/sbin/upsmon
ups      15705 15704  0 01:55 ?        00:00:00 /usr/sbin/upsmon
ups      15871     1  0 01:58 ?        00:00:00 /sbin/usbhid-ups -a HbiLinTower
ups      15873     1  0 01:58 ?        00:00:00 /usr/sbin/upsd
[hank@HIvyTower ~]


My answer to my original question is: The usbhid-ups process is nut-driver service. The upsd process is the nut-server service. And the upsmon processes in the nut-monitor service.

Regardless, I seem to need all three running on my system.
hankivy
 
Posts: 128
Joined: May 19th, '14, 20:36

Re: UPS, Uninterruptable Power Supply, nut-driver vs nut-ser

Postby doktor5000 » May 4th, '15, 11:51

Please mark the thread accordingly by editing the topic of the first post and prefix it by [DONE], thanks
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest