OPNsense Forum

English Forums => Development and Code Review => Topic started by: Droid999 on February 13, 2021, 05:04:01 am

Title: APC UPS new plugin
Post by: Droid999 on February 13, 2021, 05:04:01 am
Hi

I thought I would have a go at writing a plugin.  I couldn't get NUT to reliably run and stay connected to my APC UPS, so I wrote a plugin to configure the apcupsd package.

I've uploaded the code to github here: https://github.com/Gibbon99/apcupsd (https://github.com/Gibbon99/apcupsd)

It's pretty basic, but seems to get the job done.

If anyone would like to create an installable package from it, feel free - I couldn't get the plugins to compile on a VM.

Thanks.
Title: Re: APC UPS new plugin
Post by: mimugmail on February 13, 2021, 06:16:28 am
To me it looks nearly finished. Most problematic is time cause it needs a maintainer when going to official pluginse
Title: Re: APC UPS new plugin
Post by: mrzaz on February 28, 2021, 11:13:08 am
Hi,
I would really like to see this one official through Plugins.
I come from pfSense but has now taken a decision to move to
OPNSense permanently and have a few plugins I use a lot and
the apcupsd is one them as I use it to control a proper shutdown
if power outage that finally shuts down UPS so it could go down
gracefully.

Best regards
Dan Lundqvist
Title: Re: APC UPS new plugin
Post by: Napsterbater on April 27, 2021, 12:39:52 am
This looks great, would be awesome to have as an official plugin.

apcupsd seems better the NUT in a few key configurations.
Title: Re: APC UPS new plugin
Post by: adh81 on May 07, 2021, 09:04:27 pm
I'll add my vote. I'd like to see an official plugin.

Title: Re: APC UPS new plugin
Post by: comet on May 08, 2021, 12:49:49 am
I'd like to see it also.
Title: APC UPS new plugin
Post by: Greelan on May 08, 2021, 01:28:20 am
Looks good to me. Maybe the OP should submit a PR

As regards maintenance, in my experience running apcupsd on a Linux box, the daemon is rarely changed, so should not be too much involved unless the plugin integration is changed significantly?

One suggestion on the monit job - rather than pinging the port, just run a “does not exist” test on the pid. That’s why I do for dpinger on my IPv6 gateway
Title: Re: APC UPS new plugin
Post by: hloiter on May 30, 2021, 11:34:48 am
Hello,

i installed the addon (copy and paste) and see the entry for "apcupsd" in the "Services area" and can configure the add-on, but when I try to start it, I get the response "Action not found".

Can someone point me the right way to get it working?

I installed the apcupsd package with a shell command.

hloiter
Title: Re: APC UPS new plugin
Post by: hloiter on June 02, 2021, 05:23:26 pm
Ok, solved it alone.

File "apcupsd" in the directory /etc/rc.conf.d was missing.

The following entry must be in the "apcupsd" file: apcupsd_enable = "YES"

After creating this file and restarting, I was able to start "Apcupsd" via the web interface.

hloiter
Title: Re: APC UPS new plugin
Post by: hloiter on June 03, 2021, 09:04:54 am
How can I add the apcupsd service to the services widget on my dashboard?

Has anyone an idea?

hloiter
Title: Re: APC UPS new plugin
Post by: i1mran92 on June 19, 2021, 12:58:46 pm
hi there. why dont i see the apcupsd under the service area?
i've manage to install the pkg, but its not showing under service.
please help
Title: Re: APC UPS new plugin
Post by: hloiter on June 19, 2021, 01:48:05 pm
Hi,

i think the file apcupsd.inc is missing in the directory /usr/local/etc/inc/plugins.inc.d.

But I have no idea how to create this file.

Cheers

hloiter


Title: Re: APC UPS new plugin
Post by: i1mran92 on June 19, 2021, 02:11:41 pm
Hi,

i think the file apcupsd.inc is missing in the directory /usr/local/etc/inc/plugins.inc.d.

But I have no idea how to create this file.

Cheers

hloiter

hi. how did you "copy paste" the plugin? there is more that i have to do other than just install the apcupsd pkg correct?
Title: Re: APC UPS new plugin
Post by: hloiter on June 19, 2021, 04:46:19 pm
Hi,

i added the files to the individual directories under / usr / local / opensense via WinSCP. Then I created the file /etc/rc.conf.d/apcupsd and executed /usr/local/etc/rc.configure_plugins. After a restart I was able to configure the Apcupsd plugin and my UPS was recognized. My only problem is that the apcupsd daemon is not showing up in the service widget.

Best

hloiter
Title: Re: APC UPS new plugin
Post by: i1mran92 on June 19, 2021, 07:13:21 pm
Hi,

i added the files to the individual directories under / usr / local / opensense via WinSCP. Then I created the file /etc/rc.conf.d/apcupsd and executed /usr/local/etc/rc.configure_plugins. After a restart I was able to configure the Apcupsd plugin and my UPS was recognized. My only problem is that the apcupsd daemon is not showing up in the service widget.

Best

hloiter


hi,

i was able to copy everything and did > exec /usr/local/etc/rc.configure_plugins, and reboot.
I was able to see the apcupsd under the service.
so far this is correct right
start and stop service both work. was able to verify the service status when directly ssh into opnsense.
but when i edit anything in the webui, it does not reflect in the actual file of apcupsd.conf
the status in the webgui is also just empty.

but, if i were to manually edit the conf file via ssh, i was able to get it working, though still nothing in webgui?
any edit i do there doesnt seem to do anything.

any help would be greatly appreciated.


EDIT:
i should note that, i am using as a slave. the apcuspd is running on another machine as master
used cable type ether, ups type net, ups device IP:3551 ( the device running apcupsd as master )
if manual edit conf file, it works. apcacces show the related information and running
Title: Re: APC UPS new plugin
Post by: hloiter on June 20, 2021, 08:49:29 am
OK,

whats with the file apcupsd in /etc/rc.conf.d?

This file should contain apcupsd_enable="YES" ....

Cheers

hloiter
Title: Re: APC UPS new plugin
Post by: Droid999 on June 20, 2021, 10:38:38 am
Ok

Had a go at fixing some of the issues - still no idea on how to make this "official" or do a PR.

Fixed up so it should work with the latest version now - mine broke and wouldn't report the status anymore.

Added the file apcupsd.inc - it goes in "/usr/local/etc/inc/plugins.inc.d/" - this makes the apcupsd service appear in the Services widget on the dashboard.

I haven't got any problems with saving the config, and updating the apcupsd.conf file - so I can't find a fix there.
Title: Re: APC UPS new plugin
Post by: hloiter on June 20, 2021, 06:45:46 pm
Hmm, i think there is something wrong with the apcupsd.conf and some other files ....

After i copy the new version to my opnsense i can not start the service with the new apcupsd.conf.
When i replace the old one, then i can start the service but get no status anymore ...

Here is a screenshot:

(https://www.h-loit.de/opnsense/opnsense_apcupsd.png)

With the new apcupsd.inc is the apcupsd service not shown in the service widget and the apcupsd.conf is not written new with klick on the button "Save Config" ....

Cheers

hloiter
Title: Re: APC UPS new plugin
Post by: Droid999 on June 21, 2021, 11:50:28 am
Did you grab the new script file to get the Status ?

You can grab them from here:

https://github.com/Gibbon99/apcupsd/tree/master/usr/local/opnsense/scripts/OPNsense/Apcupsd (https://github.com/Gibbon99/apcupsd/tree/master/usr/local/opnsense/scripts/OPNsense/Apcupsd)

and put them here:

Code: [Select]
/usr/local/opnsense/scripts/OPNsense/Apcupsd
Should be two files:

Code: [Select]
-rwxr-xr-x  1 root  wheel  366 Jun 20 16:16 getNisStatus.py*
-rwxr-xr-x  1 root  wheel  206 Jun 20 16:24 getServiceStatus.py*
root@firewall:/usr/local/opnsense/scripts/OPNsense/Apcupsd #

What happens when you run this from the command line?

Code: [Select]
configctl apcupsd getNisStatus

This is what I have to make it show up in the Services Widget

(https://github.com/Gibbon99/apcupsd/blob/master/Docs/services.png?raw=true)

Code: [Select]
root@firewall:/usr/local/etc/inc/plugins.inc.d # ll apcupsd.inc
-rw-r--r--  1 root  wheel  2358 Jun 20 18:25 apcupsd.inc


It's not saving the config on my box anymore either. Just fails silently.

I'll chase it up.
Title: Re: APC UPS new plugin
Post by: hloiter on June 21, 2021, 12:31:08 pm
Will have a look at your hints and post a feedback as soon as possible.

hloiter
Title: Re: APC UPS new plugin
Post by: hloiter on June 21, 2021, 12:49:58 pm
Did you grab the new script file to get the Status ?

You can grab them from here:

https://github.com/Gibbon99/apcupsd/tree/master/usr/local/opnsense/scripts/OPNsense/Apcupsd (https://github.com/Gibbon99/apcupsd/tree/master/usr/local/opnsense/scripts/OPNsense/Apcupsd)

and put them here:

Code: [Select]
/usr/local/opnsense/scripts/OPNsense/Apcupsd
Should be two files:

Code: [Select]
-rwxr-xr-x  1 root  wheel  366 Jun 20 16:16 getNisStatus.py*
-rwxr-xr-x  1 root  wheel  206 Jun 20 16:24 getServiceStatus.py*
root@firewall:/usr/local/opnsense/scripts/OPNsense/Apcupsd #


Yes, i grab the new files and put them in the right directory.

Quote
What happens when you run this from the command line?

Code: [Select]
configctl apcupsd getNisStatus


(https://www.h-loit.de/opnsense/getNisstatus.png)

(https://www.h-loit.de/opnsense/getServiceStatus.png)

And this happens when i call the file direct:

(https://www.h-loit.de/opnsense/getServiceStatus_direct.png)

Quote

This is what I have to make it show up in the Services Widget

(https://github.com/Gibbon99/apcupsd/blob/master/Docs/services.png?raw=true)

Code: [Select]
root@firewall:/usr/local/etc/inc/plugins.inc.d # ll apcupsd.inc
-rw-r--r--  1 root  wheel  2358 Jun 20 18:25 apcupsd.inc

Yes, the file is there but no APC UPS Service shown in the Service section ...

(https://www.h-loit.de/opnsense/service_section.png)

Have i to run something in the shell to activate it?

Quote

It's not saving the config on my box anymore either. Just fails silently.

I'll chase it up.

Cheers

hloiter

Title: Re: APC UPS new plugin
Post by: i1mran92 on June 23, 2021, 11:46:36 am
was it able to get it save and working again?
Title: Re: APC UPS new plugin
Post by: Droid999 on June 25, 2021, 03:23:55 am

Fixed the issue with the config not being saved.  Seems to be working properly now.

Also fixed the issue with the Status not showing.

I don't know why it's not showing in your Services widget - you could try > service configd restart - but I'm just guessing. or perhaps a  reboot might help  ?


Title: Re: APC UPS new plugin
Post by: hloiter on June 26, 2021, 02:39:15 pm
Hi Droid999,

thanks for your work.

Everything is fine now and working and up.

Cheers

hloiter
Title: Re: APC UPS new plugin
Post by: mrzaz on August 26, 2021, 03:13:37 pm
Hello,

I have joined Droid999's small team of developing the Apcupsd plugin and the current version in external repo works OK now. Have tried to help Droid999 to squash some issues found.

I am in the process to do some cleanup, preparing the plugin to be migrated into the official opnsense_plugin repo.  Have not planned a official date yet for the move as I may need some help with the GitHub migration so we don't screw anything up or loose some data. If someone is good in doing that, please contact us through PM. :-)

Best regards
Dan Lundqvist (mrzaz)
Title: Re: APC UPS new plugin
Post by: Mario_Rossi on November 04, 2021, 04:03:34 pm
Hi, sorry for the ignorance, I can't figure out how to have my ups detected and managed.
I have migrated from pfsense to opnsense and am not yet practical.

I have an APC SMT1500i with AP9630 network card.
In pfSense I had both Nut (snmp) and APCUPSD (pcnet).

I don't understand what I have to download and where I have to put it.


EDIT: Problem solved.
It would be nice to have a widget on the dashboard with ups status and battery charge as there was a pfsense
Title: Re: APC UPS new plugin
Post by: xbb on November 14, 2021, 12:56:34 pm
It would be nice to have a widget on the dashboard with ups status and battery charge as there was a pfsense

Hello, you can use my fork here: https://github.com/xbb/apcupsd (branch dev if you want to verify the code)

I have made improvements, it has a widget and if you check the releases I provide packages too.

I'm waiting for the other guys to merge the projects and possibly send a pull request to the official plugins repo.

Before installing the package I suggest you remove the previous version files and remove any manually applied modifications (apcupsd auto start, it's now controlled by the plugin)

Ignore the docs for the moment they need updating, download the package file and install it with: pkg install ./os-apcupsd-1.2.1.txz
Title: Re: APC UPS new plugin
Post by: vladnik on February 01, 2022, 02:10:05 am
@Droid999, @mrzaz, @xbb

Hey guys, wanted to say thank you for working on this.

I have installed v1.2.2 of the package from @xbb's fork on OPNsense 22.1, works exactly as expected so far. I am connected to another server running apcupsd via the Ether and net options.

In the future, it would be interesting to expose these options through the GUI as well:

BATTERYLEVEL
MINUTES

With these two options one can fine tune when the system is shut down in the event of a power failure. The default settings of 3 minutes runtime left and 5% charge remaining are a little on the aggressive side.

Another thing to think about would be exposing the hosts.conf file somehow and integrate monitoring remote devices if OPNsense functions as a server for a USB connected UPS.

Sadly, I am not a programmer, so I cant help much in that area, but if you need further testing let me know.

Cheers!
Title: Re: APC UPS new plugin
Post by: mrzaz on February 01, 2022, 08:52:02 am
Hi,
This could already be done if you click on "advance mode". 🙂

Best regards
Dan Lundqvist (mrzaz)
Title: Re: APC UPS new plugin
Post by: vladnik on February 01, 2022, 04:10:01 pm
Hi mrzaz,

wow, I'm stupid  ::)

Anyway, just changed my settings and tested the auto shutdown, works perfectly!
The Dashboard widget also works without issues.

Thanks again for you guys's work, I highly recommend anyone with an APC UPS to check this out. Looking forward for this to become official  :D

Cheers!
Title: Re: APC UPS new plugin
Post by: mimugmail on February 01, 2022, 05:20:22 pm
What is the reason again why you dont pull against plugins? Any Help needed?
Title: Re: APC UPS new plugin
Post by: xbb on February 02, 2022, 01:59:27 am
What is the reason again why you dont pull against plugins? Any Help needed?

Thanks for the offer! I'm almost ready for the pull request just trying to find some time, I think later this evening.

Cheers
Title: Re: APC UPS new plugin
Post by: xbb on February 03, 2022, 01:10:24 am
Pull request: https://github.com/opnsense/plugins/pull/2799
Title: Re: APC UPS new plugin
Post by: hloiter on February 07, 2022, 10:21:48 am
Where can i download "os-apcupsd-1.2.2.txz"?

Like to test the new plugin.
Title: Re: APC UPS new plugin
Post by: xbb on February 07, 2022, 02:33:19 pm
Where can i download "os-apcupsd-1.2.2.txz"?

Like to test the new plugin.

https://github.com/xbb/apcupsd/releases (https://github.com/xbb/apcupsd/releases), click on assets

Don't forget to uninstall any previous version first via the web UI or

Code: [Select]
pkg remove os-apcupsd
Title: Re: APC UPS new plugin
Post by: hloiter on February 22, 2022, 08:49:32 pm
Hi,

installed the package on OPNsense 21.7.8 ...

Installation without any error.

When i try to open the configuration i get the error

Code: [Select]
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableModelControllerBase.php:174: Class \OPNsense\Apcupsd\apcupsd does not exist
Any ideas?

EDIT: After a reboot the problem is gone   :D

Best

hloiter


Title: Re: APC UPS new plugin
Post by: defaultuserfoo on May 31, 2022, 03:00:12 pm
Thank you for making this package!

How do I install it?  When I try to download it with

Code: [Select]
curl 'https://github.com/xbb/apcupsd/releases/download/1.2/os-apcupsd-1.2.txz' --output os-apcupsd-1.2.txz

I'm getting a file that's 0 bytes.
Title: Re: APC UPS new plugin
Post by: hloiter on May 31, 2022, 04:12:22 pm
Hello,

i think it is os-apcupsd-1.2.2.txz ....

But have a look at the page, there is a new Version devel-0.1 from this year ...

Title: Re: APC UPS new plugin
Post by: xbb on May 31, 2022, 07:27:08 pm
Thank you for making this package!

How do I install it?  When I try to download it with

Code: [Select]
curl 'https://github.com/xbb/apcupsd/releases/download/1.2/os-apcupsd-1.2.txz' --output os-apcupsd-1.2.txz

I'm getting a file that's 0 bytes.

GitHub release assets links are redirected to another URL.

With curl you need to specify -L (--location) otherwise it won't follow HTTP redirects.

Also yes as hloiter said 0.1 is the newest version
Title: Re: APC UPS new plugin
Post by: defaultuserfoo on May 31, 2022, 09:24:34 pm
Should I use the release 0.1 from April?  Maybe scp will work ...
Title: Re: APC UPS new plugin
Post by: xbb on May 31, 2022, 09:29:09 pm
Should I use the release 0.1 from April?  Maybe scp will work ...

Yes

With curl:

Code: [Select]
curl --remote-name --location https://github.com/xbb/apcupsd/releases/download/0.1/os-apcupsd-devel-0.1.txz
Title: Re: APC UPS new plugin
Post by: defaultuserfoo on June 01, 2022, 10:07:10 am
Thank you!

It looks good, but I think the executables, like apcupsd and apcaccess are missing.  The Status info says "Action not found".

It seems the config file is created ok, so I guess if the executables weren't missing, it would probably work :)


PS:  When I re-install the nut plugin, the Status page for Apcupsd says "Error: empty output from apcaccess".

But neither apcupsd, nor nut are working.  Monitoring that UPS over the network does work:  It's connected to Centos 7 machine via USB, and another Centos 7 server is also monitoring it over the network.

With nut enabled, I'm getting

Code: [Select]
root@gw0:/ # ps aux | grep nut
uucp  85440    0.0  0.0   12896    2660  -  Ss   10:19       0:00.00 /usr/local/libexec/nut/apcupsd-ups -a bigups-vm2

When I disable nut, there are no apcupsd processes.  When I enable Apcupsd, there aren't any, either.

But it does make a difference weather nut is installed or not because when nut is installed it says "empty output" rather than "action not found" on the Apcupsd status page.
Title: Re: APC UPS new plugin
Post by: franco on June 02, 2022, 09:51:30 am
Once the plugin is integrated (it was merged to development a couple of minutes ago) the underlying service package will be installed automatically.


Cheers,
Franco
Title: Re: APC UPS new plugin
Post by: defaultuserfoo on June 02, 2022, 10:11:07 am
Does that mean that we need to remove the files from the package we downloaded?  Can I install the required service package now so I can get it to work while I'm still at the site?
Title: Re: APC UPS new plugin
Post by: franco on June 02, 2022, 10:16:39 am
Not so fast... 22.1.9 will ship os-apcupsd-devel plugin (likely next week) and then another 22.1.x will enable the release plugin. I'm not sure anything changes for manual installs at the moment, but on the other hand manual installs just continue to work fine.

If you need apcupsd binaries just install it :)

# pkg install apcupsd


Cheers,
Franco
Title: Re: APC UPS new plugin
Post by: defaultuserfoo on June 02, 2022, 06:37:49 pm
Thank you!  I didn't know or dare that we can just install packages with pkg and didn't know that we're supposed to install apcupsd when installing the plugin.

Now with apcupsd installed, the status info is there and it kinda seems to work out of the box :)  This is awesome :)
Title: Re: APC UPS new plugin
Post by: danderson on July 18, 2022, 07:28:29 pm

Any way in the next version we can get an alarm time delay field, or in my case all I want is a checkbox to disable the alarm, I  dont need/want it beeping.
Title: Re: APC UPS new plugin
Post by: xbb on July 18, 2022, 08:16:28 pm

Any way in the next version we can get an alarm time delay field, or in my case all I want is a checkbox to disable the alarm, I  dont need/want it beeping.

I think you have to use the `apctest` command line tool for that, you'll need to stop the apcupsd service first.

If the UPS model is supported, it should show a menu with this option "View/Change alarm behavior"
Title: Re: APC UPS new plugin
Post by: i1mran92 on August 06, 2022, 01:35:42 pm
hi there. just updated to the latest opnsense firmware and install apcupsd plugin.

opnsense connect to apc ups server on another device
seems to be working fine.

though not sure if this is normal or not, i did a test to auto shutdown.
it went through the shut down process then it stopped for me to manually reboot or shutdown

the operating system has halted
please press any key to reboot

is there anything i can do to fully shutdown the device?
thanks
Title: Re: APC UPS new plugin
Post by: xbb on August 06, 2022, 03:35:27 pm
though not sure if this is normal or not, i did a test to auto shutdown.
it went through the shut down process then it stopped for me to manually reboot or shutdown

the operating system has halted
please press any key to reboot

is there anything i can do to fully shutdown the device?
thanks

apcupsd actions (not the plugin) are controlled via the /usr/local/etc/apcupsd/apccontrol script.

Weirdly the FreeBSD version uses "shutdown -h now" instead of "shutdown -p now". I cannot change that in the plugin.

As a workaround, the apccontrol scripts permits overriding the default actions by creating another script named after the action (in this case "doshutdown") inside the /usr/local/etc/apcupsd/ directory.

For example you can create the script /usr/local/etc/apcupsd/doshutdown and make it executable otherwise it wont be executed by apccontrol.

Code: [Select]
#!/usr/bin/env sh

set -e

printf "Beginning Shutdown Sequence" | wall
/sbin/shutdown -p now "apcupsd initiated shutdown"

# 99 prevents apccontrol from executing the default doshutdown action
exit 99
Title: Re: APC UPS new plugin
Post by: i1mran92 on August 11, 2022, 11:36:25 am
though not sure if this is normal or not, i did a test to auto shutdown.
it went through the shut down process then it stopped for me to manually reboot or shutdown

the operating system has halted
please press any key to reboot

is there anything i can do to fully shutdown the device?
thanks

apcupsd actions (not the plugin) are controlled via the /usr/local/etc/apcupsd/apccontrol script.

Weirdly the FreeBSD version uses "shutdown -h now" instead of "shutdown -p now". I cannot change that in the plugin.

As a workaround, the apccontrol scripts permits overriding the default actions by creating another script named after the action (in this case "doshutdown") inside the /usr/local/etc/apcupsd/ directory.

For example you can create the script /usr/local/etc/apcupsd/doshutdown and make it executable otherwise it wont be executed by apccontrol.

Code: [Select]
#!/usr/bin/env sh

set -e

printf "Beginning Shutdown Sequence" | wall
/sbin/shutdown -p now "apcupsd initiated shutdown"

# 99 prevents apccontrol from executing the default doshutdown action
exit 99


thank you. was able to make it shutdown fully with the script.
though i dont actually see "begining Shutdown Sequest" and "apcupsd initiated shutdown" when the shutdown procees was happening. not sure why?
but atleast it is fully shutting down now.

Title: Re: APC UPS new plugin
Post by: xbb on August 11, 2022, 02:25:29 pm
thank you. was able to make it shutdown fully with the script.
though i dont actually see "begining Shutdown Sequest" and "apcupsd initiated shutdown" when the shutdown procees was happening. not sure why?
but atleast it is fully shutting down now.

I think only logged in users can see the broadcast messages and I'm not sure if they are logged somewhere.

You can use the logger command if you want see a message in the system log.

For example:

Code: [Select]
logger -t apcupsd "some message"

man logger, for more details
Title: Re: APC UPS new plugin
Post by: mman2000 on May 23, 2023, 08:53:18 am
Here is my experience with this plugin. Trying to connect a APC SRT1000RMXLA-NC

1: Direct connection via USB works.
2: Connecting via USB and setting up a master/slave setup did not seem to work at least not with the truenas-core APCUPSD-UPS client.
3: Connecting via smart card with ethernet also failed to function.

After trying every combination multiple times I gave up after 6 to 8 hours.
Title: Re: APC UPS new plugin
Post by: tiermutter on May 23, 2023, 08:59:02 am
For me it works fine with NMC via SNMP. Also had no issues with setup...
Title: Re: APC UPS new plugin
Post by: derethor on July 28, 2023, 12:16:47 pm
This plugin was working fine for me. But today we lost power for some minutes, I came to check the status, and I find out that the plugin was not working (i didnt setup a monit alert, my fault)


2023-07-28T10:06:42   Error   apcupsd   apcupsd error shutdown completed   
2023-07-28T10:06:42   Error   apcupsd   Lock file data error:   
            please stop it and run this program again.   
            If apcupsd or apctest is already running,   
            Unable to create UPS lock file.   
2023-07-28T10:06:42   Error   apcupsd   apcupsd FATAL ERROR in apcupsd.c at line 221   
2023-07-28T10:06:42   Error   apcupsd   Lock file data error: �

The service is not running.

Also, I ran apctest as root, with the same result


2023-07-28 10:07:15 apctest 3.14.14 (31 May 2016) freebsd
Checking configuration ...
sharenet.type = ShareUPS
cable.type = USB Cable
mode.type = USB UPS Driver
apctest FATAL ERROR in apctest.c at line 313
Unable to create UPS lock file.
  If apcupsd or apctest is already running,
  please stop it and run this program again.
apctest error termination completed

root@incheon:~ # ps ax | grep apc
35558  0  S+    0:00.00 grep apc
root@incheon:~ #

mmn, maybe the path/permissions for the lock file changed or something?
Title: Re: APC UPS new plugin
Post by: beneix on April 12, 2024, 06:21:29 pm
Just installed an RJ45 --> USB cable between my APC CS 500 and my OPNSense. What am I supposed to choose in the settings for (current choice):

UPS cable type (Smart)
UPS type (apcsmart)