OPNsense Forum

English Forums => General Discussion => Topic started by: TheLatestWire on December 06, 2016, 03:14:50 am

Title: I Have Nut Working but not Autostarting
Post by: TheLatestWire on December 06, 2016, 03:14:50 am
Hello,

I've successfully installed and configured nut to monitor a UPS connected to another computer on my network but I can't figure out how to set the nut_upsmon service to start automatically when OPNsense boots.  I tried creating /etc/rc.conf and added the following:
nut_enable="YES"
nut_upslog_enable="YES"
nut_upsmon_enable="YES"

This allows me to check the nut service status with "service nut_upsmon status", which would fail with a complaint without those lines in that file, but the service still doesn't start when OPNsense boots.

I'm guessing it has something to do with the fact that the nut config files really exist int /usr/local/etc/nut but I can't figure out what I need to do in order to enable the service to start automatically.

Could someone give me a hint or suggestion please?

Thanks,
ObecalpEffect.
Title: Re: I Have Nut Working but not Autostarting
Post by: franco on December 06, 2016, 06:46:06 am
Hi,

The question here is which one doesn't start?

I looked at nut specifically under /usr/local/etc/rc.d/nut and it wants three files in order to start:

required_files="${nut_prefix}/etc/nut/ups.conf ${nut_prefix}/etc/nut/upsd.conf ${nut_prefix}/etc/nut/upsd.users"

These files are not on a normal install so that will probably fail right there.

It would be good to get the output of:

# service nut start
# service nut_upslog start
# service nut_upsmon start


Thanks,
Franco
Title: Re: I Have Nut Working but not Autostarting
Post by: TheLatestWire on December 06, 2016, 03:43:27 pm
I could be wrong as I'm quite new to nut, but I thought I only needed nut_upsmon to run on my OPNsense server since it's just a slave monitoring a USB connected UPS on another server on my LAN.  My OPNsense server can communicate with the nut daemon on the other server when I manually start "service nut_upsmon" but I can't get it to start automatically when OPNsense boots.

That said, I wasn't able to start "service nut start" manually as I was missing a number of configuration files.  I fixed most of the missing files but I can't figure out what my ups.conf should look like since I don't actually have a UPS physically attached to the OPNsense box.  I tried just using this line in ups.conf but it wasn't enough to start "service nut start":
MONITOR MYUPS@10.1.1.2 1 upsuser incrediblepassword slave

This is the output of trying to run "service nut start":
root@OPNsense:/usr/local/etc/rc.d # service nut start
Network UPS Tools - UPS driver controller 2.7.4
Error: no UPS definitions found in ups.conf
/usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut

Moving on,  both "service nut_upslog start" and "service nut_upsmon start" both start without any errors and are running correctly.

Sorry if this is turning into more of a nut question rather than an OPNSense question.

Thanks,
ObecalpEffect.