SOLVED How to connect UPS service to pfSense or direct to SNMP?

Status
Not open for further replies.

Maxburn

Explorer
Joined
Oct 26, 2018
Messages
60
I have an APC UPS with a network card in it speaking SNMP. I would much prefer to connect FreeNAS directly to the UPS and have it read status directly but I'm not seeing the necessary SNMP settings in the setup screen, can this be accomplished?

I also have pfSense for a router for the site and it has NUT running on it and it can see the UPS and appears to work fine. How do I get FreeNAS to connect to either the UPS directly via SNMP or the NUT daemon running in pfSense? Help in section 11.17 doesn't seem useful at all. I attempted to connect FreeNAS to pfSense but I'm getting these errors and isn't working.

FreeNAS UPS setup.png


Code:
Request Method:	POST
Request URL:	http://10.0.1.23/admin/services/ups/edit/1/
Software Version:	FreeNAS-11.1-U6 (caffd76fa)
Exception Type:	CallTimeout
Exception Value:	

Call timeout

Exception Location:	/usr/local/lib/python3.6/site-packages/middlewared/client/client.py in call, line 429
Server time:	Wed, 7 Nov 2018 09:15:51 -0500
Traceback
Environment:

Software Version: FreeNAS-11.1-U6 (caffd76fa)
Request Method: POST
Request URL: http://10.0.1.23/admin/services/ups/edit/1/


Traceback:
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  42.			 response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.			 response = self._get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  178.			 response = middleware_method(request, callback, callback_args, callback_kwargs)
File "./freenasUI/freeadmin/middleware.py" in process_view
  162.		 return login_required(view_func)(request, *view_args, **view_kwargs)
File "/usr/local/lib/python3.6/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  23.				 return view_func(request, *args, **kwargs)
File "./freenasUI/freeadmin/options.py" in wrapper
  210.				 return self._admin.admin_view(view)(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  149.					 response = view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.		 response = view_func(request, *args, **kwargs)
File "./freenasUI/freeadmin/site.py" in inner
  142.			 return view(request, *args, **kwargs)
File "./freenasUI/freeadmin/options.py" in edit
  571.					 mf.save()
File "./freenasUI/services/forms.py" in save
  815.		 started = notifier().restart("ups")
File "./freenasUI/middleware/notifier.py" in restart
  223.			 return c.call('service.restart', what, {'onetime': onetime}, **kwargs)
File "./freenasUI/middleware/notifier.py" in restart
  223.			 return c.call('service.restart', what, {'onetime': onetime}, **kwargs)
File "/usr/local/lib/python3.6/site-packages/middlewared/client/client.py" in call
  429.			 raise CallTimeout("Call timeout")

Exception Type: CallTimeout at /admin/services/ups/edit/1/
Exception Value: Call timeout


Request information
GET

No GET data
POST
Variable	Value
__all__	''
ups_mode	'slave'
ups_identifier	'APC'
ups_remotehost	'10.0.1.1'
ups_remoteport	'3493'
ups_driver	''
ups_port	''
ups_options	''
ups_optionsupsd	''
ups_description	'Connect to pfSense to NUT'
ups_shutdown	'batt'
ups_shutdowntimer	'300'
ups_shutdowncmd	'/sbin/shutdown -p now'
ups_nocommwarntime	'300'
ups_monuser	'admin'
ups_monpwd	'ironwolfCount0'
ups_extrausers	''
ups_emailnotify	'on'
ups_toemail	'scottjal@gmail.com'
ups_subject	'UPS report generated by %h'
__form_id	'dialogForm_ups'
FILES

No FILES data
COOKIES
Variable	Value
csrftoken	'********'
fntreeSaveStateCookie	'stuff'
sessionid	'c78uxj81wbi3kht41da8nju'
META
Variable	Value
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I would much prefer to connect FreeNAS directly to the UPS and have it read status directly
Very easy, though not very intuitive. UPS mode is "master", port is the IP address of the network card in your UPS (yes, you can type in that field, it isn't just a drop-down). Driver is whatever's closest to the card in your UPS--mine is an AP 9631, IIRC, and I use the 9630 menu option.
 

Maxburn

Explorer
Joined
Oct 26, 2018
Messages
60
Thank you. I put all that info in and didn't receive any errors at all in greentext at the bottom of the screen. I verified the service was started and running. I also SSH'd in and went into /var/log and did egrep ups * which found this below which sounds good but I don't know why that IP is listed rather than my UPS IP.

Code:
daemon.log:Nov  7 15:35:30 freenas snmp-ups[50778]: Startup successful
daemon.log:Nov  7 15:35:30 freenas upsd[50779]: listening on 127.0.0.1 port 3493
daemon.log:Nov  7 15:35:30 freenas upsd[50779]: Connected to UPS [APC]: snmp-ups-APC
daemon.log:Nov  7 15:35:30 freenas upsd[50779]: /usr/local/etc/nut/cmdvartab not found - disabling descriptions
daemon.log:Nov  7 15:35:30 freenas upsd[50780]: Startup successful
daemon.log:Nov  7 15:35:30 freenas upsmon[50795]: Startup successful
daemon.log:Nov  7 15:35:30 freenas upsd[50780]: User apc@127.0.0.1 logged into UPS [APC]
daemon.log:Nov  7 15:35:30 freenas upslog[50810]: Startup successful


Code:
root@freenas:/var/log # upsc ups@10.0.1.41
Error: Connection failure: Connection refused


Searched around and found this site which seems to be what you are suggesting
https://nefaria.com/2016/05/configu...municate-with-an-apc-network-management-card/
That test at the end seems to indicate I'm not working yet. I have an APC AP9617 card and I selected the AP9618 SNMP UPS. I didn't have to tell pfSense what UPS it was, it seemed to gather that all over SNMP.

Code:
root@freenas:/var/log # upsc APCNMC
Error: Unknown UPS


Full messages log. Not sure how upsshut could be set incorrectly. I originally had 300 seconds but changed it to 120 seconds and it still didn't like it. Anyway, still not connecting to the UPS.

Code:
Nov  7 16:04:08 freenas upsmon[57782]: upsmon parent: read
Nov  7 16:07:18 freenas upsd[58599]: mainloop: Interrupted system call
Nov  7 16:07:18 freenas root: /usr/local/etc/rc.d/nut: WARNING: $nut_upsshut is not set properly - see rc.conf(5).
Nov  7 16:07:18 freenas upsmon[58622]: upsmon parent: read
Nov  7 16:07:26 freenas upsmon[59518]: upsmon parent: read
Nov  7 16:07:26 freenas upsd[59495]: mainloop: Interrupted system call
Nov  7 16:07:27 freenas root: /usr/local/etc/rc.d/nut: WARNING: $nut_upsshut is not set properly - see rc.conf(5).
Nov  7 16:12:57 freenas upsd[59826]: mainloop: Interrupted system call
Nov  7 16:12:57 freenas root: /usr/local/etc/rc.d/nut: WARNING: $nut_upsshut is not set properly - see rc.conf(5).
Nov  7 16:12:57 freenas upsmon[59840]: upsmon parent: read
Nov  7 16:15:08 freenas upsd[61095]: mainloop: Interrupted system call
Nov  7 16:15:08 freenas root: /usr/local/etc/rc.d/nut: WARNING: $nut_upsshut is not set properly - see rc.conf(5).
Nov  7 16:15:08 freenas upsmon[61118]: upsmon parent: read
 

Maxburn

Explorer
Joined
Oct 26, 2018
Messages
60
AH, reading that linked article a little more closely APCNMC isn't a command it was the name of his device, changing it to my device I now get this below. It would be really nice if this was revealed in the web UI like it is in pfSense!


Code:
root@freenas:/var/log # upsc APCNMC
Error: Unknown UPS
root@freenas:/var/log # upsc APC
ambient.1.humidity.alarm.high: 60.00
ambient.1.humidity.alarm.low: 30.00
ambient.1.temperature.alarm.high: 104.00
ambient.1.temperature.alarm.low: 50.00
battery.charge: 100.00
battery.charge.restart: 0
battery.current: 0.00
battery.date: 08/30/08
battery.packs: 0.00
battery.packs.bad: -1.00
battery.runtime: 3780.00
battery.runtime.low: 480
battery.voltage: 27.50
battery.voltage.nominal: -1.00
device.mfr: APC
device.model: Smart-UPS 1500
device.serial: AS083asdf957
device.type: ups
driver.name: snmp-ups
driver.parameter.pollinterval: 2
driver.parameter.port: 10.0.1.41
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: apcc MIB 1.2
driver.version.internal: 0.97
input.frequency: 60.00
input.sensitivity: medium
input.transfer.high: 127
input.transfer.low: 106
input.transfer.reason: selfTest
input.voltage: 120.90
input.voltage.maximum: 120.90
input.voltage.minimum: 118.00
output.current: 1.70
output.frequency: 60.00
output.voltage: 120.90
output.voltage.nominal: 120
ups.delay.shutdown: 90
ups.delay.start: 0
ups.firmware: 653.18.D
ups.id: UPS_IDEN
ups.load: 20.10
ups.mfr: APC
ups.mfr.date: 08/30/08
ups.model: Smart-UPS 1500
ups.serial: AS0835141957
ups.status: OL
ups.temperature: 27.40
ups.test.date: 10/28/2018
ups.test.result: Ok
root@freenas:/var/log #

 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It would be really nice if this was revealed in the web UI like it is in pfSense!
Agreed. There's much about the pfSense web GUI that's simply awful, but with respect to UPSs it has FreeNAS beat handily.
 

Maxburn

Explorer
Joined
Oct 26, 2018
Messages
60
Any idea what I need to do about the warning sbout upsshut in the log? Or does it not matter?
 
Status
Not open for further replies.
Top