apcupsdの異常終了

「/etc/rc.d/init.d/apcupsd start」を実行した直後は[OK]になり、「ps ax」でプロセスを確認したときもapcupsdが起動していることが確認できるが、しばらくするとプロセスが異常終了していることがある。この場合、終了するときに

# /etc/rc.d/init.d/apcupsd stop
Shutting down UPS monitoring:                              [失敗]

と失敗する。またiptablesなどのファイアウォールの設定に誤りがないにもかかわらず、「apcaccess status」で次のようなエラーが出る。

# /sbin/apcaccess status
Error contacting apcupsd @ localhost:3551: Connection refused

同様にしてapctestコマンドで次のようなエラーが出た場合も同様である。

# /sbin/apctest
2011-03-28 10:24:09 apctest 3.14.8 (16 January 2010) redhat
Checking configuration ...
Attached to driver: apcsmart
sharenet.type = DISABLE
cable.type = CUSTOM_SMART

You are using a SMART cable type, so I'm entering SMART test mode
mode.type = APCSMART_UPS
Setting up the port ...
apctest FATAL ERROR in device.c at line 71
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

いずれの場合もapcupsdが正常に起動していない可能性がある。この場合、「/var/log/messages」などに以下のようなログが出力されていることで確認することができる。プロセスで確認するときは、しばらく(20秒ほど)経過してから確認してみると起動したままになっているかどうか確認できる。

Mar 28 14:33:52 ns apcupsd: apcupsd 起動 succeeded
Mar 28 14:34:03 ns apcupsd[6126]: apcupsd FATAL ERROR in smartsetup.c at line 18
4 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.
Mar 28 14:34:03 ns apcupsd[6126]: apcupsd error shutdown completed