APC UPS new plugin

Started by Droid999, February 13, 2021, 05:04:01 AM

Previous topic - Next topic
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

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.

To me it looks nearly finished. Most problematic is time cause it needs a maintainer when going to official pluginse

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
Best regards
Dan Lundqvist (mrzaz)

"It's better to burn up, than fade away..." (Highlander)

This looks great, would be awesome to have as an official plugin.

apcupsd seems better the NUT in a few key configurations.

I'll add my vote. I'd like to see an official plugin.


I'd like to see it also.
I'm a home user of OPNsense, not a networking expert.  I'd much appreciate it if you'd keep that in mind if replying to something I posted.  Many thanks!

May 08, 2021, 01:28:20 AM #6 Last Edit: May 08, 2021, 01:41:50 AM by Greelan
Looks good to me. Maybe the OP should submit a PR [emoji12]

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

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

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

How can I add the apcupsd service to the services widget on my dashboard?

Has anyone an idea?

hloiter

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

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



Quote from: 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

hi. how did you "copy paste" the plugin? there is more that i have to do other than just install the apcupsd pkg correct?

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

June 19, 2021, 07:13:21 PM #14 Last Edit: June 19, 2021, 07:16:53 PM by i1mran92
Quote from: 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


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