Apcupsd bajo Gentoo

From Luniwiki
Jump to: navigation, search

Preliminares

Se va instalar una UPS APC Back-UPS 1500 que va a proteger 3 servidores. Uno de ellos sera el Master y los otros 2 serán esclavos.

Software

Añadimos una variable para poder acceder por web a la información de la UPS.

echo "sys-power/apcupsd cgi" >> /etc/portage/package.use
emerge -av apcupsd

Instalamos el software en los 3 servidores.

Configuración del servidor mastero

El fichero del master localizado en /etc/apcupsd/apcupsd.conf

UPSNAME LUNIEL
UPSCABLE usb
UPSTYPE usb
LOCKFILE /var/lock
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
NETTIME 100
UPSCLASS netmaster
UPSMODE net
NETPORT 6666
SLAVE slave1.luniel.com
SLAVE slave2.luniel.com
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0

Configuración de los servidores esclavos

La configuración de los esclavos es la siguiente:

UPSNAME LUNIEL
UPSCABLE ether
UPSTYPE net
DEVICE master.luniel.com
LOCKFILE /var/lock
ONBATTERYDELAY 6
BATTERYLEVEL 10
MINUTES 5
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
NETSERVER on
NISIP 0.0.0.0
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
NETTIME 100
UPSCLASS netslave
UPSMODE net
NETPORT 6666
MASTER master.luniel.com
USERMAGIC slave1
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0

apcupsd-3.14.8-r2

Hay que aplicar el partche: Error de compilación apcupsd-3.14.8-r1 En la version 3.14, el mode maestro y esclavo ha cambiado.

Configuración del maestro

UPSNAME LUNIEL
UPSCABLE usb
UPSTYPE usb
DEVICE
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
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 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0

Configuración de los esclavos

UPSCABLE ether
UPSTYPE net
DEVICE 192.168.1.1:3551
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
ONBATTERYDELAY 6
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
ANNOY 300
ANNOYDELAY 60
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 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0

Referencias

--Daniel Simao 13:51 16 mar 2007 (CET)