我在一台有 2 个物理串行端口的计算机上安装了 APCUPSD。UPS 是带有串行端口的 APC SUA1000。我将 APC 智能串行电缆连接到 COM1,将 COM2 连接到另一台计算机。
ls -l /dev/ttyS*
报告 ttyS0 一直到 ttyS31。我几乎尝试了每一个端口,但都无济于事。
/etc/default/apcupsd
# Defaults for apcupsd initscript
# Apcupsd-devel internal configuration
APCACCESS=/sbin/apcaccess
ISCONFIGURED=yes
UPSCABLE=smart
UPSTYPE=smartups
UPSMODE=disable
DEVICE=/dev/ttyS1
ACCESS=false
ANNOY=240
PROCFS=1
LOGGING=1
BATTERYLEVEL=15
SENSITIVITY=M
WAKEUP=60
LOTRANSFER=100
HITRANSFER=130
RETURNCHARGE=10
BEEPSTATE=L
UPSNAME=TechRm
/var/log/apcupsd.events:
2018-01-14 12:47:38 -0600 apcupsd error shutdown completed
2018-01-14 12:48:00 -0600 apcupsd 3.14.12 (29 March 2014) debian startup succeeded
2018-01-14 12:48:11 -0600 apcupsd FATAL ERROR in smartsetup.c at line 155
PANIC! Cannot communicate with UPS via serial port.
Please make sure the port specified on the DEVICE directive is correct,
and that your cable specification on the UPSCABLE directive is correct.
2018-01-14 12:48:11 -0600 apcupsd error shutdown completed
2018-01-14 12:48:27 -0600 apcupsd 3.14.12 (29 March 2014) debian startup succeeded
2018-01-14 12:48:38 -0600 apcupsd FATAL ERROR in smartsetup.c at line 155
PANIC! Cannot communicate with UPS via serial port.
Please make sure the port specified on the DEVICE directive is correct,
and that your cable specification on the UPSCABLE directive is correct.
2018-01-14 12:48:38 -0600 apcupsd error shutdown completed
/etc/apcupsd.conf:
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS2
POLLTIME 10
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 15
MINUTES 3
TIMEOUT 0
ANNOY 120
ANNOYDELAY 0
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
UPSCLASS standalone
UPSMODE disable
STATTIME 5
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
BATTDATE 01/12/18
SENSITIVITY M
WAKEUP 60
LOTRANSFER 100
HITRANSFER 130
RETURNCHARGE 10
BEEPSTATE L
LOWBATT 0
OUTPUTVOLTS 120
SELFTEST 336
运行apcaccess
也失败,出现“连接被拒绝”错误。是的,我已编辑/etc/hosts
文件以更正 localhost... 问题。
我被难住了。有人能帮忙吗?
操作系统:Ubuntu Server 16.04.3 i386。
答案1
提醒自己:不要指望 RS232 电缆可以与 RS422 端口兼容。
通过使用 RS232 端口解决。