Manuel utilisateur APCUPSD – Serveur d’impression
Apcupsd est un système de contrôle UPS qui permet l’arrêt méthodique de votre
ordinateur en cas de panne de courant.
Copie et distribution de ce fichier, avec ou sans modification,
sont autorisés sur n'importe quel support sans redevance à condition d'appeler le nom Apcupsd,
la notice de copyright, et cette notice sont préservées.
Le code source d'Apcupsd est publié sous licence GNU General Public License
version 2. Veuillez voir le fichier COPYING dans le répertoire source principal.
Pour plus d'informations sur le projet, veuillez visiter le site web principal
au http://www.apcupsd.com
Personne ne devrait s’appuyer sur le contenu du manuel de l’APCUPSD («le manuel»)
sans avoir au préalable obtenu l’avis du support technique APC.
Le manuel est fourni sur les termes et comprendre que:
- les auteurs, contributeurs et éditeurs ne sont pas responsables de la
les résultats des actions entreprises sur la base des informations contenues dans le manuel,
ni pour toute erreur ou omission dans le manuel; et- les auteurs, contributeurs et éditeurs ne sont pas impliqués dans le rendu
conseils ou services techniques ou autres.
Les auteurs, contributeurs et éditeurs, déclinent expressément tout et tout
responsabilité envers toute personne, que ce soit un lecteur du manuel
ou non, à l'égard de quoi que ce soit, et des conséquences de quoi que ce soit, fait ou
omis par une telle personne en toute confiance, en tout ou en partie,
sur tout ou partie du contenu du manuel. Sans limiter le
la généralité de ce qui précède, aucun auteur, contributeur ou éditeur ne doit avoir
responsabilité pour tout acte ou omission de tout autre auteur, contributeur ou
éditeur.
Ceci est le manuel pour apcupsd, un
démon pour la communication avec les UPS (Uninterruptible Power
Fournitures) fabriquées par American Power Conversion Corporation (APC). Si vous avez un
Les onduleurs fabriqués par APC, qu’ils soient vendus sous la plaque signalétique APC ou OEM (par exemple, le
PowerTrust 2997A), et vous voulez le faire fonctionner avec un ordinateur en marche
Linux, Unix ou Windows, vous lisez le bon document.
Ce manuel est divisé en parties qui augmentent en profondeur technique
comme ils vont. Si vous venez d'acheter un onduleur à la pointe de la technologie
avec une interface USB ou Ethernet, et vous exécutez un courant
version de Red Hat ou SUSE Linux, alors apcupsd est
presque plug-and-play et vous devrez lire que le De base
Guide de l'utilisateur.
Si votre système d’exploitation est plus ancien ou si vous avez un système démodé
l’onduleur série, vous devrez vous renseigner sur l’installation en série (voir
Installation: Onduleurs de ligne série). Si vous avez besoin de plus
des détails sur l’administration dans des situations inhabituelles (comme un
configuration maître / esclave ou multi-UPS), vous devez lire les sections sur
ces sujets aussi. Finalement,
il existe un certain nombre de sections de référence techniques qui
donne des détails complets sur des choses comme les directives de fichier de configuration et
formats de journalisation des événements.
Vous devriez commencer par lire le guide de démarrage rapide (voir Démarrage rapide pour
Débutants) instructions.
Sommaire
Démarrage rapide pour les débutants
apcupsd est un logiciel complexe, mais
la plupart de ses complexités sont destinées à traiter avec du matériel ancien
et systèmes d'exploitation. Obtention du matériel et des logiciels actuels
courir ne devrait pas être très compliqué.
Ce qui suit est un guide d’aide sur les étapes à suivre pour obtenir apcupsd
mis en place et en cours d'exécution aussi indolore que possible.
- Vérifiez si apcupsd prend en charge votre UPS et votre câble (voir
UPS et câbles pris en charge). - Vérifiez si apcupsd prend en charge votre système d’exploitation (voir
Systèmes d'exploitation pris en charge). - Planifiez votre type de configuration (voir Choisir une configuration
Type). Si vous avez juste un UPS et
un ordinateur, c'est facile. Si vous avez plus d’une machine en cours de
desservi par le même UPS, ou par plus d’un UPS alimentant
ordinateurs qui sont sur le même réseau local, vous avez plus de choix
faire. - Déterminez si vous avez l'une des configurations faciles. Si vous avez une clé USB
UPS, et un système d'exploitation pris en charge et que vous souhaitez utiliser un UPS
avec un ordinateur, la configuration est simple. APC fournit le câble
besoin de parler avec cet UPS avec l'onduleur. Tout ce que vous devez faire
vérifiez que votre sous-système USB fonctionne (voir USB
Configuration) si oui, vous pouvez aller à la construction
et installez l'étape. - Si vous avez un onduleur conçu pour communiquer via SNMP via
Ethernet, c'est aussi une installation relativement facile. Détails
sont fournis dans Assistance pour les onduleurs SNMP. - Si vous avez un UPS qui communique via un port série RS232C
l'interface et c'est un SmartUPS, alors les choses sont relativement simples,
sinon, votre vie est sur le point de devenir intéressante.- Si vous avez un câble fourni par le fournisseur, déterminez quel type de câble
vous avez un numéro sur les extrémités plates du câble,
comme le 940-0020A, estampé dans le plastique. - Si vous n'avez pas de câble fourni par le fournisseur ou si votre type n'est pas
vous devrez peut-être en construire un vous-même (voir
Câbles). Voici en espérant que tu es bon avec une soudure
le fer!
- Si vous avez un câble fourni par le fournisseur, déterminez quel type de câble
- Vous êtes maintenant prêt à lire le document Building and Install (voir
Construire et installer apcupsd)
section du manuel et suivez ces instructions. Si vous êtes
l’installation à partir d’un RPM ou d’une autre forme de paquet binaire, cette
L’étape consistera probablement à exécuter une seule commande. - Modifiez votre fichier /etc/apcupsd/apcupsd.conf si nécessaire. Souvent il
ne sera pas. - Modifiez les paramètres du BIOS (voir Organiser le redémarrage sur
Power-Up) sur ton ordinateur
de sorte que chaque démarrage, il démarre. (Ce n'est pas la valeur par défaut
sur la plupart des systèmes.) - Pour vérifier que votre UPS communique avec votre ordinateur et
va faire la bonne chose quand le courant est coupé, lire et suivre
les instructions du test (voir Essai
Apcupsd) section. - Si vous rencontrez des problèmes, consultez la liste de messagerie des utilisateurs d'apcupsd
archive pour des problèmes similaires. C’est une excellente ressource avec
réponses à toutes sortes de questions. Voir
http://sourceforge.net/mailarchive/forum.php?forum_name=apcupsd-users. - Si vous avez toujours besoin d'aide, envoyez un message au courrier électronique des utilisateurs d'apcupsd.
liste (apcupsd-users@lists.sourceforge.net) décrivant votre
problème, quelle version de
apcupsd que vous utilisez, quel système d'exploitation vous utilisez et
tout ce que vous pensez pourrait être utile. - Lisez la section du manuel sur la surveillance et le réglage de votre onduleur.
Systèmes d'exploitation supportés
apcupsd prend en charge de nombreux systèmes d’exploitation de type UNIX, ainsi que plusieurs
variantes de Windows. En raison du manque de normalisation des API, la prise en charge USB n’est pas prise en charge.
disponible sur toutes les plateformes. Voir Support de la plateforme ci-dessous pour plus de détails.
En général, il est recommandé d’obtenir un paquet pré-construit pour votre plate-forme.
Compte tenu de la manière dont apcupsd doit s’intégrer au mécanisme d’arrêt du
système d’exploitation et la vitesse à laquelle ces mécanismes sont modifiés par
fournisseurs, les ports de plate-forme de l’arborescence apcupsd peuvent devenir obsolètes. Dans
Dans certains cas, les paquets binaires sont fournis par l’équipe apcupsd (RedHat,
Mandriva, SuSE, Windows, Mac OS X). Pour les autres plateformes, il est recommandé de
vérifier les référentiels de paquets de votre fournisseur et les référentiels tiers pour
paquets binaires récents. Notez que certains fournisseurs continuent à distribuer
anciennes versions de apcupsd avec des défauts connus. Ces paquets devraient ne pas être
utilisé.
Support de plate-forme
LINUX
- Chapeau rouge
- SuSE
- Mandriva / Mandrake
- Debian
- Slackware
- Engarde
- Chien jaune
- Gentoo
LES FENÊTRES
- Windows NT 4
- Windows 98 / ME / 2000
- Windows XP / Vista (y compris 64 bits)
- Windows Server 2003/2008 (64 bits inclus)
- Windows 7
AUTRES
- Mac OS X Darwin
- Solaris 8/9
- Solaris 10
- NetBSD
- FreeBSD
- OpenBSD
- HPUX
- Unifix
- QNX
UPS et câbles pris en charge
apcupsd prend en charge presque tous les modèles d'onduleurs APC existants et suffisamment
différents types de câbles à connecter à chacun d’eux.
le UPSTYPE
votre fichier /etc/apcupsd/apcupsd.conf pour indiquer à apcupsd quel type d'onduleur
tu as. Nous allons décrire les valeurs possibles ici, car ils sont
un bon moyen d'expliquer l'interface la plus importante de votre UPS
propriété: le type de protocole utilisé pour parler avec ses
ordinateur.
- apcsmart
- Le protocole 'apcsmart' utilise une connexion série RS232 pour passer
commandes dans un langage primitif ressemblant à
codes de contrôle du modem. APC appelle cette langue "UPS-Link". À l'origine
introduit pour les modèles Smart-UPS (d'où le nom «apcsmart»), cette
la classe d'onduleurs est en déclin, elle est rapidement remplacée par le produit d'APC
ligne par UPS et MODBUS. - USB
- Un onduleur USB parle un contrôle universel bien défini
la langue sur un fil USB. La plupart des membres d'APC utilisent maintenant cette méthode
à la fin de 2003, et il semble probable qu’il prendra complètement le relais
leur gamme basse et moyenne. Les derniers onduleurs APC ne prennent en charge qu’une
ensemble limité de données sur l'interface USB. MODBUS (voir ci-dessous) est requis
afin d'accéder aux données avancées. - net
- C’est le mot clé pour spécifier si vous utilisez votre
UPS en mode esclave (c’est-à-dire que la machine n’est pas directement connectée à
l'onduleur, mais à une autre machine qui est), et il est connecté à
le maître via une connexion ethernet. Vous devez avoir apcupsd's
Network Information Services NIS activé pour que ce mode fonctionne. - snmp
- Les onduleurs SNMP communiquent via une carte réseau Ethernet et
firmware qui parle Simple Network Management Protocol. - stupide
- Un onduleur muet ou à signalisation de tension et son ordinateur
communiquer via les lignes de contrôle (pas les lignes de données) sur un RS232C
connexion série. Pas grand-chose ne peut être réellement transmis de cette façon autre que
un ordre de fermeture. Les UPS de signalisation de tension sont obsolètes. toi
sont peu susceptibles de rencontrer un autre que comme matériel hérité. Si vous
Si vous avez le choix, nous vous recommandons d’éviter les simples UPS de signalisation. - pcnet
- PCNET est une alternative au SNMP disponible sur APC
Famille AP9617 de modules de logement intelligent. Le protocole est beaucoup plus simple
et potentiellement plus sécurisé que SNMP. - modbus
- MODBUS est le dernier protocole APC et fonctionne sur des liaisons série RS232 ou
USB. MODBUS est le remplacement d'APC pour le 'apcsmart' (UPS-Link)
protocole. MODBUS est le seul moyen d'accéder à un contrôle et à un statut détaillés
informations sur les onduleurs les plus récents (en particulier ceux de la série SMT).
Choisir un type de configuration
Il y a trois principaux
manières de faire fonctionner apcupsd sur votre système. Le premier est un autonome
configuration où apcupsd contrôle un seul onduleur, qui alimente un
ordinateur unique. C'est la configuration la plus courante. Si vous êtes
travaillant avec une seule machine et un onduleur, ignorez le reste de cette
section.
Vos choix deviennent plus intéressants si vous utilisez un petit
cluster ou une grande batterie de serveurs. Dans ces circonstances, il se peut que
être possible ou même souhaitable de coupler un onduleur à chaque
machine. apcupsd prend en charge certains arrangements alternatifs.
Le second type de configuration est le NIS (Network Information Information Network).
Serveur) serveur et client. Dans cette configuration, où un UPS
alimente plusieurs ordinateurs, une copie d’apcupsd en exécutant un
l'ordinateur agira en tant que serveur, tandis que les autres agiront en tant que
clients du réseau qui interrogent le serveur pour obtenir des informations sur la
UPS. Notez que "NIS" est ne pas liés au service d'annuaire de Sun
également appelé "NIS" ou "Pages Jaunes".
La troisième configuration est celle où un seul
l'ordinateur contrôle plusieurs UPS. Dans ce cas, il y a plusieurs
cas d’apcupsd sur le même ordinateur, chacun contrôlant un
différent UPS. Une instance d’apcupsd s’exécutera en mode autonome, et
l'autre instance fonctionnera normalement en mode réseau.
Ce type de configuration peut convenir aux gros serveurs
exploitations utilisant une seule machine dédiée à la surveillance et à
Diagnostique
Voici un schéma qui résume les possibilités:
Types de configuration
Apcupsd prend en charge les connexions USB sur tous les principaux systèmes d'exploitation:
Linux, FreeBSD, OpenBSD, NetBSD, Windows, Solaris et Mac OS X
Darwin. Si vous envisagez d’utiliser une connexion USB, veuillez lire le
sous-section appropriée dans son intégralité. Vous pouvez ignorer cette section
si votre UPS a une interface série (RS232-C) ou Ethernet ou si vous
n’exécutez pas l’une des plateformes énumérées ci-dessus.
Configuration USB sous Linux
Problèmes connus liés à Linux USB
- Problème
- Noyaux Linux 2.4 de plus de 2.4.22 (RH 9, RHEL 3)
ne liez pas le périphérique USB au pilote approprié. Ceci est démontré
par / proc / bus / usb / devices listant correctement l’onduleur, mais il aura
"driver = (aucun)" au lieu de "driver = (caché)". Cela affecte RHEL3,
parmi d'autres. - solution de contournement
- Mettez à niveau le noyau Linux vers la version 2.4.22 ou supérieure. Alternativement,
vous appliquez le linux-2.4.20-killpower.patch et
linux-2.4.20-USB-rejet.patch corrige votre noyau et reconstruit
il. Ces correctifs peuvent être trouvés dans le répertoire examples / du répertoire
Distribution de source apcupsd. - Problème
- Systèmes Mandrake 10.0 et 10.1 avec mode haute sécurité
activé (exécution du noyau sécurisé par le noyau), utilisez des nœuds de périphériques statiques, mais
attribue toujours les numéros mineurs USB de manière dynamique. Ceci est démontré par
hiddev0: Périphérique USB HID v1.10 [...] au lieu de hiddev96: ... dans
dmesg log. - solution de contournement
- Amorcez le noyau standard au lieu de kernel-secure ou
désactivez CONFIG_USB_DYNAMIC_MINORS et reconstruisez le noyau de manière sécurisée. - Problème
- Echec de la compilation du pilote USB linux-usb.c
sur HID_MAX_USAGES undefined. Ceci est dû à un défaut du
Fichier d'en-tête hiddev.h du noyau linux sur les noyaux 2.6.5 et supérieurs. - solution de contournement
- Mettez à niveau vers apcupsd-3.10.14 ou supérieur. Ces versions
contenir une solution de contournement pour le défaut. - Problème
- Sur certains systèmes tels que Slackware 10.0, aucun périphérique USB
apparaîtra (voir la section suivante). - solution de contournement
-
Ajouter ce qui suit à rc.local
mount -t usbdevfs none / proc / bus / usb
- Problème
- Les noyaux 2.6 utilisent udev et certaines distributions pour ne pas
configurez-le pour créer automatiquement / dev / usb / hiddev ?? comme ils
devrait empêcher apcupsd de localiser l’onduleur. - solution de contournement
-
Editez le fichier /etc/udev/rules.d/50-udev.rules et ajoutez
le suivant:KERNEL = "hiddev *", NAME = "usb / hiddev% n"
Plus de détails sont fournis dans la section suivante …
Vérification de la détection de périphérique et du pilote
Pour vous assurer que votre sous-système USB peut voir l’onduleur, procédez comme suit.
à partir d'une invite du shell:
cat / proc / bus / usb / devices
Cette information est mise à jour par le noyau chaque fois qu’un périphérique est
branché ou débranché, que apcupsd soit en cours d'exécution
ou pas. Il contient des détails sur tous les périphériques USB de votre système.
y compris les concentrateurs (internes et externes), les périphériques d’entrée et les onduleurs.
Vous devriez obtenir une sortie contenant quelque chose comme ça,
comportant un BackUPS RS 1000:
T: Bus = 02 Lev = 01 Prnt = 01 Port = 00 Cnt = 01 Dev # = 3 Spd = 1,5 MxCh = 0 D: Ver = 1,10 Cls = 00 (> ifc) Sub = 00 Prot = 00 MxPS = 8 # Cfgs = 1 P: Vendeur = 051d ProdID = 0002 Rev = 1.06 S: Fabricant = Conversion de puissance américaine S: Produit = Back-UPS RS 1000 FW: 7.g3 .D USB FW: g3 S: numéro de série = JB0308036505 C: * # Ifs = 1 Cfg # = 1 Atr = a0 MxPwr = 24mA I: Si # = 0 Alt = 0 # EPs = 1 Cls = 03 (HID) Sub = 00 Prot = 00 Pilote = caché
Les choses importantes à vérifier sont les S: lignes décrivant
votre UPS et et JE: ligne indiquant quel pilote le gère.
Si sur le JE: ligne, Chauffeur est répertorié comme Pilote = aucun ensuite
le pilote HID n'est pas chargé ou le pilote ne s'est pas connecté
à l'onduleur. Une cause commune est d'avoir un noyau Linux plus ancien que
2.4.22 (comme un noyau RedHat 9 ou RHEL 3). Si tel est le
cas pour votre système, veuillez mettre à niveau au moins la version du noyau
2.4.22 et essayez à nouveau. Si vous utilisez déjà une version 2.4.22 ou supérieure
noyau, veuillez lire plus loin pour des instructions concernant d’autres
plans d'action.
Voici un autre exemple, avec cette fois un Back-UPS 350:
T: Bus = 01 Lev = 01 Prnt = 01 Port = 00 Cnt = 01 Dev # = 2 Spd = 1,5 MxCh = 0 D: Ver = 1,10 Cls = 00 (> ifc) Sub = 00 Prot = 00 MxPS = 8 # Cfgs = 1 P: Vendeur = 051d ProdID = 0002 Rev = 1.00 S: Fabricant = Conversion de puissance américaine S: Produit = Back-UPS 350 FW: 5.2.I USB FW: c1 S: numéro de série = BB0115017954 C: * # Ifs = 1 Cfg # = 1 Atr = a0 MxPwr = 30mA I: Si # = 0 Alt = 0 # EPs = 1 Cls = 03 (HID) Sub = 00 Prot = 00 Pilote = caché E: Ad = 81 (I) Atr = 03 (Int.) MxPS = 8 Ivl = 10ms
En général, si vous voyez votre modèle d’onduleur dans le S: domaine, qui
veux dire Fabricant =, Produit =, et Numéro de série =, et toi
voir Pilote = caché dans le JE: terrain, vous savez que l’UPS a été
reconnu et lié au bon pilote.
Si votre UPS n’apparaît pas du tout dans la liste, vérifiez l’évident.
choses: L’onduleur doit être sous tension et un câble doit être correctement
assis à la fois sur le port de données de l’onduleur et sur l’un des ports de votre machine
Ports USB. De nombreux UPS disposent de ports téléphoniques pour fournir une protection contre les surtensions
pour les téléphones ou les modems – assurez-vous de ne pas avoir branché votre clé USB
câble dans l'un de ceux-ci plutôt que le port de données (qui
généralement près du bord supérieur du boîtier.)
Assurez-vous également que les bons pilotes sont chargés. Sous
Linux-2.4.x, vous pouvez le vérifier facilement en examinant la
Fichier / proc / bus / usb / drivers. Voici comment vous pouvez faire cela:
cat / proc / bus / usb / drivers
… et vous devriez obtenir:
usbdevfs centre 96-111: hiddev caché
Sur Linux-2.6.x, assurez-vous que le système de fichiers sysfs est monté sur / sys
et fait:
ls -l / sys / bus / usb / drivers /
… où vous devriez obtenir:
total 0 drwxr-xr-x 2 racine racine 0 1 mai 18:55 caché drwxr-xr-x 2 racine racine 0 1 mai 18:55 hiddev drwxr-xr-x 2 racine racine 0 1 mai 18:55 moyeu drwxr-xr-x 2 racine racine 0 1 mai 18:55 usb drwxr-xr-x 2 racine racine 0 1 mai 18:55 usbfs
… ou peut-être quelque chose comme:
total 0 drwxr-xr-x 2 racine racine 0 6 janvier 15:27 hiddev drwxr-xr-x 2 racine racine 0 6 janvier 15:28 hub drwxr-xr-x 2 racine racine 0 6 janvier 15:28 usb drwxr-xr-x 2 racine racine 0 6 janvier 15:27 usbfs drwxr-xr-x 2 racine racine 0 6 janvier 15:28 usbhid
Si votre système 2.6.x ne possède pas le répertoire / sys / bus / usb,
soit vous n'avez pas de sysfs monté sur / sys ou le (s) module (s) USB
n'ont pas été chargés. (Vérifiez / proc / mounts pour vous assurer que sysfs est
monté.)
Un onduleur USB a besoin de tous ces pilotes – le système de fichiers du périphérique USB,
le concentrateur USB, le pilote du sous-système de périphérique d’interface humaine et le
Pilote de périphérique d'interface humaine. Si vous compilez le vôtre
noyau, vous voulez activer
CONFIG_USB CONFIG_USB_HID CONFIG_USB_HIDDEV CONFIG_USB_DEVICEFS
… ainsi qu'au moins un pilote de contrôleur hôte USB …
CONFIG_USB_UHCI_HCD (linux-2.6.x) CONFIG_USB_OHCI_HCD (linux-2.6.x) CONFIG_USB_UHCI (linux-2.4.x) CONFIG_USB_OHCI (linux-2.4.x)
Nœuds de périphérique
Apcupsd accède aux onduleurs USB via les nœuds de périphériques hiddev. Typiquement
ceux-ci sont situés dans / dev / hiddevN, / dev / usb / hiddevN ou
/ dev / usb / hiddev / hiddevN (où N est un chiffre compris entre 0 et 9). Certains
distributions (certaines versions de Debian, éventuellement d’autres) ne
fournit ces nœuds de périphérique pour vous, de sorte que vous devrez les faire
toi même. Vérifier / dev, / dev / usb, et / dev / usb / hiddev et si tu
ne trouve pas le hiddevN nœuds, exécutez (en tant que root) le
exemples / make-hiddev script de la distribution source apcupsd.
Les distributions Linux modernes utilisant le noyau 2.6 créent des nœuds de périphériques
dynamiquement à la volée, au besoin. C'est fondamentalement un
système hotplug, donnant beaucoup plus de pouvoir à l'utilisateur pour déterminer
Que se passe-t-il lorsqu'un appareil est détecté ou ouvert? C'est aussi beaucoup
plus compliqué.
Certaines premières distributions 2.6 (Fedora Core 3, par exemple) ne le permettent pas.
inclure les règles hiddev dans leur ensemble de règles udev par défaut. Le fond
ligne pour apcupsd sur un tel système est que si le hiddevN n'est pas
créé lorsque vous branchez votre UPS, apcupsd se terminera par un
Erreur. La solution au problème consiste à ajouter une règle à udev
fichier de règles. Sur Fedora FC3, ce fichier se trouve dans
/etc/udev/rules.d/50-udev.rules. Commencez par ajouter ce qui suit
ligne:
BUS = "usb", SYSFS idVendor = "051d", NAME = "usb / hiddev% n"
Notez que cette règle utilise la syntaxe obsolète udev et est spécifique à
FC3 et autres distributions de millésimes similaires.
Ensuite, redémarrez votre système ou débranchez et rebranchez votre UPS et
puis redémarrez apcupsd. À ce point un / dev / usb / hiddevN nœud
devrait apparaître et apcupsd devrait fonctionner correctement.
Si vous avez plusieurs UPS ou si vous voulez simplement donner à votre UPS un
nom, vous pouvez utiliser des règles telles que:
KERNEL == "hiddev *", SYSFS série == "JB0319033692", SYMLINK = "ups0" KERNEL == "hiddev *", SYSFS série == "JB0320004845", SYMLINK = "ups1"
Notez que cette règle utilise la syntaxe udev appropriée.
uniquement pour les distributions telles que RHEL4 et FC4 et d’autres du même millésime.
Des distributions plus récentes telles que FC15 devraient utiliser quelque chose comme ceci:
KERNEL == "hiddev *", ATTRS fabricant == "Conversion de l'énergie américaine", ATTRS série == "BB0100009999", OWNER = "racine", SYMLINK + = "ups0"
Remplacez le numéro de série entre guillemets par celui qui correspond
à votre UPS. Ensuite, chaque fois que vous branchez votre UPS, un lien symbolique appelé
ups0, ups1, etc. seront créés en indiquant le bon hiddev
nœud. Cette technique est fortement recommandée si vous avez plus de
un onduleur connecté au même serveur depuis la réorganisation de votre clé USB
câbles ou même la mise à niveau du noyau peut affecter l'ordre dans lequel
les périphériques sont détectés et changent ainsi le nœud hiddev correspondant
à quel UPS. Si vous utilisez l'approche par lien symbolique par numéro de série,
lien pointe toujours vers le bon nœud de périphérique.
Vous pouvez utiliser…
udevinfo -a -p / sys / classe / usb / hiddev0 /
… pour obtenir plus d'informations sur les champs pouvant être associés
en plus du numéro de série.
Pour rechercher les attributs disponibles à rechercher (notez que la série n'est PAS toujours
l’onduleur série sur le boîtier ou dans le message de connexion USB dans / var / log / messages),
utilisation:
Informations udevadm --attribute-walk --name = / dev / usb / hiddev0
Un autre problème lié aux nœuds de périphérique est l’utilisation de
mineurs. Certaines distributions, telles que Mandrake 10, sont livrées avec un noyau
ayant CONFIG_USB_DYNAMIC_MINORS allumé. Ce n'est pas idéal
pour courir avec apcupsd, et la solution la plus simple est de tourner
CONFIG_USB_DYNAMIC_MINORS éteindre et reconstruire votre noyau, ou trouver un
noyau pré-construit avec ce off. Pour un noyau avec
CONFIG_USB_DYNAMIC_MINORS allumé pour travailler avec apcupsd, vous
doit permettre devfs. Ce qui suit vous dira si devfs est
activée:
$ ps ax | grep devs
… qui devrait donner quelque chose comme ceci:
533? S 0:00 devfsd / dev
Ce qui complique beaucoup plus la situation des noyaux de courgettes, c’est
leur niveau de sécurité depuis CONFIG_DYNAMIC_USB_MINORS est tourné
sur, mais sur des niveaux de sécurité supérieurs, devfs est désactivé. Le net
Le résultat est que, dans ces situations, Hiddev est complètement inutilisable.
alors apcupsd ne fonctionnera pas. Donc, dans ces cas, les choix sont les suivants:
- Réduisez le niveau de sécurité du système (ne savez pas si
c'est possible après l'installation initiale). - Construisez sur mesure un noyau haute sécurité avec devfs activé et faites
que devfs est monté et que devfsd est en cours d'exécution. - Construire sur mesure un noyau de haute sécurité avec des mineurs dynamiques
désactivé - Utilisez udev
Divers
Si toutes ces choses sont vérifiées et que vous ne voyez toujours pas l’onduleur,
quelque chose est plus grave que ce que ce manuel peut couvrir –
trouver l'aide d'un expert. Si vous ne parvenez pas à répertorier les périphériques ou pilotes USB,
votre noyau peut ne pas être compatible USB et cela doit être corrigé.
Configuration BSD USB
Problèmes BSD USB connus
- Problème
- Blocages FreeBSD: certains utilisateurs ont connu des blocages
(apcupsd cesse de répondre) sur les systèmes FreeBSD. - Solution
- Les versions récentes d'Apcupsd ont résolu ce problème.
Veuillez mettre à niveau vers apcupsd-3.10.18 ou une version ultérieure. - Problème
- Le noyau FreeBSD panique si le câble USB est débranché pendant
apcupsd est en cours d'exécution. - Solution
- C’est un bogue dans le noyau et il est très facile à résoudre
ne pas débrancher l’onduleur à chaud pendant le fonctionnement d’apcupsd. Ce problème
peut être corrigé dans les noyaux FreeBSD récents.
Plateformes et versions
Le pilote * BSD USB prend en charge FreeBSD, OpenBSD et NetBSD. (Merci
aller aux * développeurs BSD qui ont gardé une interface presque identique
sur les trois plates-formes.)
Configuration du noyau
Les utilisateurs d’OpenBSD, de NetBSD et de certaines versions de FreeBSD devront
reconstruire le noyau afin de activer le pilote ugen et
désactiver le pilote uhid. uhid n'est pas suffisant pour apcupsd à
cette fois et nous devons l’empêcher de saisir l’onduleur.
Vous devriez apporter les modifications suivantes à la configuration de votre noyau
fichier:
- FreeBSD (v5.4 et moins, v6.0)
-
(toi Ne fera pas perdre l’utilisation du clavier et de la souris USB)
Désactiver: uhid
Activer: ugen
- FreeBSD (v5.5, v6.1 et supérieur)
-
(toi Ne fera pas perdre l’utilisation du clavier et de la souris USB)
Désactiver: (rien)
Activer: ugen
C’est la configuration par défaut d’un noyau GENERIC sur de nombreux
plates-formes afin que vous n'aurez probablement pas besoin de recompiler. - NetBSD (v3.x et inférieur)
-
(toi volonté perdre l’utilisation du clavier et de la souris USB)
Désactiver: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Activer: ugen
- NetBSD (v4.0 et supérieur)
-
Vous pouvez utiliser apcupsd sur un seul port USB
sans désactiver le clavier et la souris USB sur les autres ports, bien que
tous les autres appareils seront désactivés sur le port que vous choisissez pour votre
UPS.Tout d’abord, choisissez le hub et le port que vous souhaitez utiliser. Vous pouvez trouver
les numéros de hub et de port pour tout connecteur physique particulier en
brancher un périphérique USB et regarder les messages imprimés
par le noyau; vous devriez envoyer des messages comme ceci:uxx0 sur le port uhub0 1 uxx0:
Pour utiliser votre onduleur APC sur ce port, configurez le noyau de préférence
attachement du pilote ugen à d’autres pilotes sur ce hub et
port uniquement, en ajoutant une ligne comme celle-ci à votre fichier de configuration du noyau:ugen * sur le port uhub0 1 drapeaux 1
(Les "drapeaux 1" obligent l'ugen à se joindre au lieu de rien d'autre
détecté là-bas.)Configurez et construisez ce noyau conformément aux références ci-dessous, et
votre onduleur va maintenant se connecter en tant que périphérique ugen une fois branché à
Port.N'oublie pas decd / dev' et './MAKEDEV ugen1'(et 2 et ainsi de suite)
si vous avez plusieurs périphériques USB génériques sur votre système. - OpenBSD
-
(toi volonté perdre l’utilisation du clavier et de la souris USB):
Désactiver: uhidev, ums, wsmouse, ukbd, wskbd, uhid
Activer: ugen
Pour des informations détaillées sur la reconstruction de votre noyau, consultez ces
références:
- FreeBSD
- http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
- NetBSD
- http://www.netbsd.org/guide/en/chap-kernel.html
- OpenBSD
- http://www.openbsd.org/faq/faq5.html#Building
Vérification de la détection de périphérique et du pilote
Après avoir construit un noyau correctement configuré, redémarrez-le.
Noyau et branchez votre câble USB UPS. Vous devriez voir un journal dmesg
message comme celui-ci:
ugen0: Back-UPS de conversion American Power RS 1500 FW: 8.g6 .D FW USB: g6, rév 1.10 / 1.06, addr 2
Notez que le ugen le conducteur est appelé. Si tu vois uhid
à la place, cela signifie probablement que vous n'avez pas correctement désactivé l'uhid
pilote lorsque vous avez compilé votre noyau ou peut-être que vous n'êtes pas en cours d'exécution
le nouveau noyau.
Vous pouvez aussi vérifier avec 'usbdevs -ré'obtenir une liste de périphériques USB
reconnu par le système ainsi que les pilotes auxquels ils sont associés
avec. Par exemple:
# usbdevs -d addr 1: concentrateur racine UHCI, VIA uhub0 addr 2: Back-UPS RS 1500 FW: 8.g6 .D USB FW: g6, Conversion de l'alimentation américaine ugen0
Nœuds de périphérique
Apcupsd communique avec l'onduleur via le périphérique générique USB,
ugen. Vous pouvez ou non avoir besoin de faire manuellement ugen dispositif
noeuds dans / dev, selon le système d'exploitation que vous utilisez.
- FreeBSD
- Aucune intervention manuelle nécessaire. FreeBSD automatiquement
crée les nœuds ugen à la demande. - NetBSD
- Par défaut, NetBSD crée uniquement des nœuds pour le premier ugen
dispositif, ugen0. Vérifier usbdevs -ré pour voir quel appareil votre
UPS était lié à puis créer le nœud approprié en exécutant
'cd / dev; ./MAKEDEV ugenN', où ugenN est le nom de l'appareil ugen
montré par usbdevs. C'est probablement une bonne idée de créer plusieurs ensembles.
de nœuds ugen au cas où vous ajoutez plus de périphériques USB. - OpenBSD
- Semblable à NetBSD, OpenBSD crée des nœuds pour ugen0 et
ugen1. Vérifier usbdevs -ré pour voir quel appareil était votre UPS
lié à puis créer le nœud approprié en exécutant 'cd / dev
; ./MAKEDEV ugenN', où ugenN est le nom de l'appareil ugen affiché
par usbdevs. C’est probablement une bonne idée de créer plusieurs ensembles de
ugen noeuds au cas où vous ajoutez plus de périphériques USB.
Configuration USB Windows
Installation du pilote USB
Les UPS connectés à Windows sous Windows nécessitent un pilote spécial. Dans la plupart
cas, ce pilote est automatiquement installé lorsque vous installez
Apcupsd. Toutefois, dans certains cas, vous devrez peut-être installer le pilote manuellement.
Pour des instructions détaillées, veuillez consulter le install.txt fichier localisé
dans le dossier des pilotes de votre installation Apcupsd.
Vérification de la détection de périphérique et du pilote
Après avoir installé Apcupsd (et le pilote USB Apcupsd, si
nécessaire), branchez votre câble USB UPS et ouvrez le périphérique Windows
Directeur. Vous devriez voir un American Power Conversion USB UPS (Apcupsd)
énumérés sous le Piles section. Si un appareil de ce nom ne fonctionne pas
s'affiche, vérifiez que votre UPS est sous tension et que le câble USB est connecté
aux deux bouts. Réinstallez le pilote comme indiqué ci-dessus si nécessaire.
Configuration USB Solaris
Plateformes et versions
Apcupsd prend en charge les onduleurs USB sous Solaris 10 et versions ultérieures. X86 et
Les plates-formes SPARC sont prises en charge.
Construire Apcupsd avec USB
Certains packages spécifiques sont nécessaires lors de la construction d’Apcupsd avec USB
support sur Solaris. Vous devez installer le SUNWlibusb et
SUNWlibusbugen paquets AVANT tenter de construire Apcupsd.
Ces packages se trouvent sur les CD-ROM d’installation Solaris et
devrait être installé avec le pkgadd utilitaire.
Vous devriez aussi compiler en utilisant le compilateur gcc et ccs make, pas
Le compilateur de Sun L’utilitaire make approprié est disponible dans
/ usr / ccs / bin. gcc peut être installé à partir des paquets inclus dans
CD-ROM d'installation Solaris.
Configurez et construisez Apcupsd normalement, comme décrit dans Bâtiment et
Installer Apcupsd. Assurez-vous de
inclure le --enable-usb drapeau à configurer.
Après la construction, installez Apcupsd en tant que root en utilisant 'faire installer',
ensuite effectuer un démarrage de reconfiguration ('redémarrer - -r'). Pendant
Apcupsd configurera automatiquement votre clé USB.
sous-système pour connecter des périphériques USB APC au ugen chauffeur. C'est
une étape critique et doit être complétée par un démarrage de reconfiguration. Remarque
que les modifications de configuration USB seront inversées si vous supprimez Apcupsd
en utilisant 'faire désinstaller'.
Vérification de la détection de périphérique et du pilote
Après avoir installé Apcupsd comme décrit ci-dessus et effectué une
reconfigurer le démarrage, branchez votre câble USB UPS. Vous devriez voir un
série de messages de journal dmesg similaires aux suivants:
Déc 5 17:50:50 sunblade usba: [ID 912658 kern.info] Périphérique USB 1.10 (usb51d, 2) fonctionnant à faible vitesse (USB 1.x) sur concentrateur racine USB 1.10: entrée @ 4, ugen0 à l'adresse de bus 3 Déc 5 17:50:50 sunblade usba: [ID 349649 kern.info] Conversion américaine Power Smart-UPS 1000 FW: 600.1.D USB FW: 1.2 AS0127232356 5 déc 17:50:50 sunblade genunix: [ID 936769 kern.info] ugen0 est / pci @ 1f, 0 / usb @ c, 3 / input @ 4 5 déc 17:50:50 sunblade genunix: [ID 408114 kern.info] / pci @ 1f, 0 / usb @ c, 3 / input @ 4 (ugen0) en ligne
Notez que le ugen le conducteur est appelé. Si vous ne voyez pas
entrées Dmesg liées à votre UPS, assurez-vous qu’il est allumé et
que le câble USB est connecté aux deux extrémités. Vérifiez également que vous
installé Apcupsd en tant que root en utilisant le 'faire installer'commande et
que vous avez ensuite effectué une reconfiguration du démarrage.
Nœuds de périphérique
Apcupsd communique avec l'onduleur via le périphérique générique USB, ugen.
Le démarrage de reconfiguration effectué après l'installation d'Apcupsd
s'assurera que les nœuds de périphérique appropriés sont créés. Une fois que votre UPS a
comme indiqué ci-dessus, vous pouvez vérifier / dev / usb
voir si les nœuds de périphériques sont apparus:
[user@sunblade /]$ ls /dev/usb/51d.2/* cntrl0 cntrl0stat devstat if0in1 if0in1stat
(51d.2 est l'ID de fournisseur / produit pour les onduleurs APC.)
Mac OS X (Darwin) Configuration USB
Plateformes et versions
Apcupsd prend en charge les onduleurs USB sous Mac OS X (Darwin) 10.4.x et versions ultérieures.
Les plates-formes Intel et PowerPC sont prises en charge.
Construire Apcupsd avec USB
Certains packages spécifiques sont nécessaires lors de la construction d’Apcupsd avec USB
soutien sur Darwin. Vous devez installer libusb-0.1.12 qui
peut être obtenu auprès de MacPorts (http://www.macports.org) (anciennement
DarwinPorts) ou Fink (http://fink.sourceforge.net) ou téléchargés et construits
à la main (http://www.libusb.org). Vous ne devez pas utiliser
libusb-1.x ou supérieur (apcupsd ne prend pas en charge les nouvelles API 1.0) ni
toute version antérieure à 0.1.12 (les versions antérieures ont un bogue qui apcupsd
déclencheurs). Généralement, cela signifie que vous devez utiliser exactement 0.1.12. Notez que
Apcupsd est sensible à l’emplacement d’installation de libusb, alors méfiez-vous si vous
changez-le de la valeur par défaut.
Apcupsd devrait être construit en utilisant gcc, de préférence à partir du XCode
outils de développement. Actuellement, le mainteneur utilise gcc-4.0.1 à partir de
XCode 2.4. D'autres versions de gcc provenant d'autres sources peuvent également fonctionner.
Configurez et construisez Apcupsd normalement, comme décrit dans Bâtiment et
Installer Apcupsd. Assurez-vous de
inclure le --enable-usb drapeau à configurer.
Après la construction, installez Apcupsd en tant que root en utilisant 'faire installer'
puis redémarrez. Lors de l'installation, Apcupsd va automatiquement
installer un pilote factice kext simple conçu pour empêcher Apple
logiciel de surveillance de la prise en charge de l'onduleur. Il est nécessaire de
redémarrez pour activer le kext. Note that this kext will be
automatically removed if you uninstall Apcupsd using
'make uninstall', allowing Apple's monitoring tool to once
again access the UPS.
Verifying Device Detection and Driver
After installing Apcupsd as described above and rebooting, plug in
your UPS USB cable. You should notice that Darwin does NE PAS
display the battery monitor tool in the menu bar. Vous pouvez aussi
check Apple Menu -> About This Mac -> More Info… -> USB to ensure
that your UPS appears in the list of USB devices.
In general it is recommended to obtain a prebuilt binary package for your
Plate-forme. Given how apcupsd must integrate into the shutdown mechanism of the
operating system and the rate at which such mechanisms are changed by
vendors, the platform ports in the apcupsd tree may become out of date. Dans
some cases, binary packages are provided by the apcupsd team (RedHat,
Mandriva, SuSE, Windows, Mac OS X). For other platforms it is recommended to
check your vendor's package repository and third party repositories for
recent binary packages before resorting to building apcupsd from scratch.
Note that some vendors continue to distribute ancient versions of apcupsd
with known defects. These packages should ne pas be used.
Installation from Binary Packages
RPMS
For systems based on RPM packages, such as Red Hat and SuSE, apcupsd is
available in binary RPM format. This is the simplest way to
install. If you have no previous version of apcupsd on your machine
and are creating a standalone configuration, simply install the RPM
with a normal 'rpm -ihv' command. You're done, and can now skip
the rest of this chapter and go straight to tweaking your run-time
configuration file. (see After Installation)
If you have a previous installation, you can upgrade with a normal
'rpm -Uhv', but this may not upgrade the halt script. It may be
better to do the upgrade as a remove 'rpm -e' followed by a
fresh install 'rpm -ihv'.
After installation of the binary RPM, please verify carefully that
/etc/rc.d/init.d/halt was properly updated and contains new script
lines flagged with ***APCUPSD***.
Since there is no standard location for cgi-bin, the rpm will place
the binary CGI programs in the directory /etc/apcupsd/cgi. À
actually use them, you must copy or move them to your actual
cgi-bin directory, which on many systems is located in
/home/httpd/cgi-bin.
Microsoft Windows
The Windows version of apcupsd is distributed as a simple double-click
installer. Installation is very simple and straight-forward: Simply
double-click the installer executable and follow the instructions. Voir
The Windows Version of apcupsd for further details.
Installation from Source
Installation from source might have to be be done different ways
depending on what system you are running. The basic procedure
involves getting a source distribution, running the configuration,
rebuilding, and installing.
For building the system, we suggest that you run the configure and
make processes as your normal UNIX user ID. The 'make install'
must be run as root. But if your normal ID has an environment setup
for using the C compiler, it's simpler to do that than to set up
root to have the correct environment.
apcupsd requires gcc et g++ compilers as well as GNU make.
Other compilers or BSD make volonté ne pas work. GNU make is sometimes
installed as gmake. The configure script will check for this and will
inform you of what command to use to invoke GNU make.
The basic installation from a tar source file is rather simple:
- Unpack the source code from its tar archive.
- Go into the directory containing the source code.
- Run './configure' (with appropriate options as described
below) - 'make' or 'gmake'' as instructed by configure
- 'su' (i.e. become root)
- Stop any running instance of apcupsd. The command to do this
will look like 'system-dependent-path/apcupsd Arrêtez' - uninstall any old apcupsd This is important since the default
install locations may have changed. - 'make install' or 'gmake install'
- edit your /etc/apcupsd/apcupsd.conf file if necessary
- ensure that your halt script is properly updated
- Start the new apcupsd with: 'system-dependent-path/apcupsd
début'
If all goes well, the './configure' will correctly determine which
operating system you are running and configure the source code
appropriately. configure currently recognizes the systems listed
below in the Operating System Specifics section of this chapter and
adapts the configuration appropriately. Check that the
configuration report printed at the end of the configure processus
corresponds to your choice of directories, options, and that it has
correctly detected your operating system. If not, redo the
configure with the appropriate options until your configuration is
correct.
Please note that a number of the configure options preset
apcupsd.conf directive values in an attempt to automatically adapt
apcupsd as best possible to your system. You can change the values
in apcupsd.conf at a later time without redoing the configuration
process by simply editing the apcupsd.conf file.
Other configuration options can be used to set up the installation
of HTML documentation and optional modules, notably the CGI
interface that enables the UPS state to be queried via the Web. Toi
will find a complete reference later in this chapter.
In general, you will probably want to supply a more elaborate
configure statement to ensure that the modules you want are built
and that everything is placed into the correct directories.
On Red Hat, a fairly typical configuration command would look like
the following:
CFLAGS="-g -O2" LDFLAGS="-g" ./configure --enable-usb --with-upstype=usb --with-upscable=usb --prefix=/usr --sbindir=/sbin --with-cgi-bin=/var/www/cgi-bin --enable-cgi --with-log-dir=/etc/apcupsd
By default, 'make install' will install the executable files in
/sbin, the manuals in /usr/man, and the configuration and script
files in /etc/apcupsd. In addition, if your system is recognized,
certain files such as the startup script and the system halt script
will be placed in appropriate system directories (usually
subdirectories of /etc/rc.d).
Verifying a Source Installation
There are a number of things that you can do to check if the
installation (make install) went well. The fist is to check where
the system has installed apcupsd using 'lequel' and 'whereis'. Sur
my Red Hat system, you should get the following (lines preceded
with a $ indicate what you type):
$ which apcupsd /sbin/apcupsd $ whereis apcupsd apcupsd: /sbin/apcupsd /etc/apcupsd /etc/apcupsd.conf /etc/apcupsd.status /usr/man/man8/apcupsd.8.gz /usr/man/man8/apcupsd.8
If you find an apcupsd in /usr/sbin, /usr/local/sbin, /usr/lib, or
another such directory, it is probably a piece of an old version of
apcupsd that you can delete. If you are in doubt, delete it, then
rerun the 'make install' to ensure that you haven't deleted
anything needed by the new apcupsd. Please note that the files
specified above assume the default installation locations.
As a final check that the 'make install' went well, you should
check your halt script (in /etc/rc.d on SUSE systems, and in
/etc/rc.d/init.d on Red Hat systems) to see that the appropriate
lines have been inserted in the correct place. Modification of the
halt script is important so that at the end of the shutdown
procedure, apcupsd will be called again to command the UPS to turn
off the power. This should only be done in a power failure
situation as indicated by the presence of the /etc/powerfail file,
and is necessary if you want your machine to automatically be
restarted when the power returns. On a Red Hat system, the lines
containing the # ***apcupsd*** should be inserted just
before the final halt command:
# Remount read only anything that's left mounted. #echo "Remounting remaining filesystems (if any) readonly" mount | awk '/ext2/ print $3 ' | while read line; faire mount -n -o ro,remount $line terminé # See if this is a powerfail situation. # ***apcupsd*** if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd*** echo # ***apcupsd*** echo "APCUPSD will now power off the UPS" # ***apcupsd*** echo # ***apcupsd*** /etc/apcupsd/apccontrol killpower # ***apcupsd*** echo # ***apcupsd*** echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd*** echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd*** echo # ***apcupsd*** fi # ***apcupsd*** # Now halt or reboot. echo "$message" if [ -f /fastboot ]; ensuite echo "On the next boot fsck will be skipped." elif [ -f /forcefsck ]; ensuite echo "On the next boot fsck will be forced." fi
The purpose of modifying the system halt files is so that apcupsd
will be recalled after the system is in a stable state. At that
point, apcupsd will instruct the UPS to shut off the power. This is
necessary if you wish your system to automatically reboot when the
mains power is restored. If you prefer to manually reboot your
system, you can skip this final system dependent installation step
by specifying the disable-install-distdir option on the
'./configure' command (see below for more details).
The above pertains to Red Hat systems only. There are significant
differences in the procedures on each system, as well as the
location of the halt script. Also, the information that is inserted
in your halt script varies from system to system. Other systems
such as Solaris require you the make the changes manually, which
has the advantage that you won't have any unpleasant surprises in
your halt script should things go wrong. Please consult the
specific system dependent README files for more details.
Please note that if you install from RPMs for a slave machine, you
will need to remove the changes that the RPM install script made
(similar to what is noted above) to the halt script. This is
because on a slave machine there is no connection to the UPS, so
there is no need to attempt to power off the UPS. That will be done
by the master.
Configure Options
All the available configure options can be printed by entering:
./configure --help
When specifying options for './configure', if in doubt, don't put
anything, since normally the configuration process will determine
the proper settings for your system. The advantage of these options
is that it permits you to customize your version of apcupsd. Si vous
save the './configure' command that you use to create apcupsd, you
can quickly reset the same customization in the next version of
apcupsd by simply re-using the same command.
The following command line options are available for configure
to customize your installation.
--prefix=path | This defines the directory for the non-executable files such as the manuals. The default is /usr. |
--sbindir=path | This defines the directory for the executable files such as apcupsd. The default is /sbin. You may be tempted to place the executable files in /usr/sbin or /usr/local/sbin. Please use caution here as these directories may be unmounted during a shutdown and thus may prevent the halt script from calling apcupsd to turn off the UPS power. Though your data will be protected, in this case, your system will probably not be automatically rebooted when the power returns |
--enable-cgi | This enables the building of the CGI programs that permit Web browser access to apcupsd data. Cette option is not necessary for the proper execution of apcupsd. |
--with-cgi-bin=path | |
The with-cgi-bin configuration option allows you to define the directory where the CGI programs will be installed. The default is /etc/apcupsd, which is probably not what you want. |
|
--enable-apcsmart | |
Turns on generation of the APC Smart driver (default). | |
--enable-dumb | Turns on generation of the dumb signalling driver code (default). |
--enable-usb | Turns on generation of the USB driver code. By default this is disabled. |
--enable-net | Turns on generation of the NIS network driver for slaves. For each slave, this is the only driver needed. This driver works by reading the information from the the configured master using the NIS (Network Information Services) interface. |
--enable-snmp | Turns on generation of the SNMP driver. This driver accesses the UPS over the network using SNMP. This is compatible only with UPSes equipped with an SNMP or Web/SNMP management card. By default this is enabled. |
--enable-pcnet | Turns on generation of the PCNET (PowerChute Network Shutdown) driver. This driver accesses the UPS over the network using APC's custom protocol. This driver can be used as an alternative to SNMP for UPSes equipped with a modern Web/SNMP management card. |
--enable-modbus | |
Turns on generation of the MODBUS/RS232 driver (default) | |
--enable-modbus-usb | |
Turns on generation of the MODBUS/USB driver | |
--enable-test | This turns on a test driver that is used only for debugging. By default it is disabled. |
--enable-gapcmon | |
This option enables building the GTK GUI front-end for apcupsd. Building this package requires numerous GNOME libraries. le default is disabled. |
|
--enable-apcagent | |
This option enables building the apcagent menubar application on Mac OS X platforms. The default is disabled. |
|
--with-libwrap=path, --with-libwrap | |
This option when enabled causes apcupsd to be built with the TCP WRAPPER library for enhanced security. In most cases, the path is optional since configure will determine where the libraries are on most systems. |
|
--with-nologin=path | |
This option allows you to specify where apcupsd will create the nologin file when logins are prohibited. The default is /etc |
|
--with-pid-dir=path | |
This option allows you to specify where apcupsd will create the process id (PID) file to prevent multiple copies from running. The default is system dependent but usually /var/run. |
|
--with-log-dir=path | |
This option allows you to specify where apcupsd will create the EVENTS and STATUS log files. The default is /etc/apcupsd. This option simply sets the default of the appropriate path in the apcupsd.conf file, which can be changed at any later time. |
|
--with-lock-dir=path | |
This option allows you to specify where apcupsd will create the serial port lock file. The default is system-dependent but usually /var/lock. This option simply sets the appropriate path in the apcupsd.conf file, which can be changed at any later time. |
|
--with-pwrfail-dir=path | |
This option allows you to specify where apcupsd will create the powerfail file when a power failure occurs. The default is system dependent but usually /etc. |
|
--with-serial-dev=device-name | |
Cette option allows you to specify where apcupsd will look for the serial device that talks to the UPS. The default is system dependent, but often /dev/ttyS0. This option simply sets the appropriate device name in the apcupsd.conf file, which can be changed at any later temps. |
|
--with-nis-port=port | |
This option allows you to specify what port apcupsd will use for the Network Information Server (the CGI programs). The default is system dependent but usually 3551 because that port has been officially assigned to apcupsd by the IANA. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time. |
|
--with-nisip=ip-address | |
This option allows you to specify the value that will be placed on then NISIP directive in the configuration file. The default is 0.0.0.0. Non checking is done on the value entered, so you must ensure that it is a valid IP address. |
|
--with-net-port=port | |
This option allows you to specify what port apcupsd will use for Master and Slave communications. The default is system dependent but usually 6666. This option simply sets the appropriate port in the apcupsd.conf file, which can be changed at any later time. |
|
--with-upstype=type | |
This option allows you to specify the type of UPS that will be connected to your computer. The default is: smartups. This option simply sets the appropriate UPS type in the apcupsd.conf file, which can be changed at any later time. |
|
--with-upscable=cable | |
This option allows you to specify what cable you are using to connect to the UPS. le default is: smart. This option simply sets the appropriate UPS cable in the apcupsd.conf file, which can be changed at any later temps. |
|
--disable-install-distdir | |
Cette option modifies the apcupsd Makefiles disable installation of the distribution (platform) directory. Generally, this used to do a full installation of apcupsd except the final modification of the operating system files (normally /etc/rc.d/halt, etc.). This is useful if your operating system is not directly supported by apcupsd or if you want to run two copies of apcupsd on the same système. This option can also be used by those of you who prefer to manually reboot your system after a power failure or who do not want to modify your system halt files. |
Recommended Options for most Systems
For most systems, we recommend the following options:
./configure --prefix=/usr --sbindir=/sbin --enable-usb
and you can optionally build and install the CGI programs as
follows:
./configure --prefix=/usr --sbindir=/sbin --enable-usb --enable-cgi --with-cgi-bin=/home/httpd/cgi-bin
Compilers and Options
Some systems require unusual options
for compilation or linking that the './configure' script does not
know about. You can specify initial values for variables by setting
them in the environment. Using a Bourne-compatible shell, you can
do that on the command line like this:
CFLAGS="-O2 -Wall" LDFLAGS= ./configure
Or on systems that have the env program, you can do it like
this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Or for example on the Sun Solaris system, you can use:
setenv CFLAGS -O2 setenv LDFLAGS -O ./configure
You can get a listing of all available options by doing:
./configure --help
or simply see the previous section of this manual.
Operating System Specifics
With the exception of Linux SUSE and Linux Red Hat
systems used by the developers, we rely on users to help create
installation scripts and instructions as well as to test that
apcupsd runs correctly on their system. As you can imagine, most of
these people are system administrators rather than developers so
they are very busy and don't always have time to test the latest
releases. With that in mind, we believe that you will find that a
lot of very valuable work has been already done to make your
installation much easier (and probably totally automatic).
Below, you will find a list of operating systems for which we have
received installation files:
Debian
This port is complete and is being used by several users. Since Debian
build and install procedures are somewhat particular, we have put the extra
Debian information into the following two subdirectories:
platforms/debian/examples et platforms/debian/packageinfo
You can also find the official Debian packages on the Debian site
at:
FreeBSD
This port is complete and is being used by several users.
You will need to install and use GNU make (aka gmake) instead of the
BSD make supplied with the system.
On the FreeBSD OS, there is no known way for a user program to get
control when all the disks are synced. This is needed for apcupsd
to be able to issue the killpower command to the UPS so that the
UPS shuts off the power. To accomplish the same thing on FreeBSD
systems, make sure you have a SmartUPS and that your UPS shutdown
grace period is set sufficiently long so that you system will power
down (usually 2 minutes), the use the --kill-on-powerfail option
on the apcupsd command line.
HPUX
Status of this port is unknown.
NetBSD
You will need to install and use GNU make (aka gmake) instead of the
BSD make supplied with the system.
Mac OS X Darwin
On OS X (Darwin), apcupsd can be built with configure defaults.
The USB driver can be enabled, as per the directions on Mac OS X (Darwin)
USB Configuration Apcupsd may be usable
on OS X with a smart serial device, but certainly does work as a
NIS client or using a USB interface.
The startup information will be installed in
/Library/StartupItems/apcupsd which is part of darwin's
SystemStartup.
OpenBSD
You will need to install and use GNU make (aka gmake) instead of the
BSD make supplied with the system.
Ensure that you read
the distributions/openbsd/README file before running apcupsd. Là
are some critical differences in how the OpenBSD implementation
operates when the UPS batteries are exhausted. Failure to take this
into account may result in the system not being fully halted when
power is lost.
Red Hat Systems
Red Hat systems are
fully supported, and by following the standard installation
instructions given above, you should experience few or no
problems.
Slackware
Slackware
systems are fully supported, and by following the standard
installation instructions given above, you should experience few or
no problems.
SUSE
SUSE systems are fully
supported, and by following the standard installation instructions
given above, you should experience few or no problems.
Sun Solaris
Please read this before attempting to compile or install the beta
software. It contains important information that will make your
efforts easier.
Before running './configure', please be sure that you do not have
/usr/ucb on your path. This may cause the configure to choose
the wrong shutdown program. Si configure detects that /usr/usb
is on your path, it will print a warning message. Please follow the
advice to avoid shutdown problems.
Your normal UNIX user ID must own the source tree directories, and
you must have the normal development tools in your path. Cette
includes make, the compiler, the M4 preprocessor, the linker, and
ar or ranlib. If the user you are logged in as can compile and link
a C program from a source file, then you have all the required
tools available.
You will want to install the executables in a directory that
remains mounted during the shutdown. Solaris will unmount almost
everything except the root directories. Since the ability to power
the UPS off requires access to the executable programs, they need
to be in a directory that will never be unmounted. And since they
should also be in a directory that normal users cannot get into,
/sbin is the default. However, please be aware that if you want to
follow Sun's filesystem conventions you would use the following:
./configure --prefix=/opt/apcupsd --sbindir=/etc/opt/apcupsd/sbin --sysconfdir=/etc/opt/apcupsd --with-cgi-bin=/opt/apcupsd/cgi-bin
The way to setup the /sbin directory as the executables directory
is to pass configure the --sbindir=/sbin option. No other
arguments should be required, and your setup and platform should be
detected automatically by configure.
Once you have run configure, you will need to do a 'gmake'. Une fois que
the make has completed with no errors, you must su to root to
complete the install. After the su, you may not have a path to the
make program anymore. In that case, you should do the 'gmake
install' step as:
gmake install
Once the install completes, you must edit the /sbin/rc0 script as
detailed below, then exit from the su'ed shell.
In order to support unattended operation and shutdown during a
power failure, it's important that the UPS remove power after the
shutdown completes. This allows the unattended UPS to reboot the
system when power returns by re-powering the system. Of course, you
need autoboot enabled for your system to do this, but all Solaris
systems have this by default. If you have disabled this on your
system, please re-enable it.
To get the UPS to remove power from the system at the correct time
during shutdown, i.e., after the disks have done their final sync,
we need to modify a system script. This script is /sbin/rc0.
We do not have access to every version of Solaris, but we believe
this file will be almost identical on every version. Please let us
know if this is not true.
At the very end of the /sbin/rc0 script, you should find lines just
like the following:
# unmount file systems. /usr, /var and /var/adm are not unmounted by umountall # because they are mounted by rcS (for single user mode) rather than # mountall. # If this is changed, mountall, umountall and rcS should also change. /sbin/umountall /sbin/umount /var/adm >/dev/null 2>&1 /sbin/umount /var >/dev/null 2>&1 /sbin/umount /usr >/dev/null 2>&1 echo 'The system is down.'
We need to insert the following lines just before the last 'echo':
#see if this is a powerfail situation if [ -f /etc/apcupsd/powerfail ]; ensuite echo echo "APCUPSD will power off the UPS" echo /etc/apcupsd/apccontrol killpower echo echo "Please ensure that the UPS has powered off before rebooting" echo "Otherwise, the UPS may cut the power during the reboot!!!" echo fi
We have included these lines in a file called rc0.solaris in the
distributions/sun subdirectory of the source tree. You can cut and
paste them into the /sbin/rc0 file at the correct place, or yank
and put them using vi or any other editor. Note that you must be
root to edit this file.
You must be absolutely sure you have them in the right place. Si
your /sbin/rc0 file does not look like the lines shown above, do
not modify the file. Instead, email a copy of the file to the
maintainers, and we will attempt to figure out what you should do.
If you mess up this file, the system will not shut down cleanly,
and you could lose data. Don't take the chance.
You will then need to make the normal changes to the
/etc/apcupsd/apcupsd.conf file. This file contains the
configuration settings for the package. It is important that you
set the values to match your UPS model and cable type, and the
serial port that you have attached the UPS to. People have used
both /dev/ttya and /dev/ttyb with no problems. You should be sure
that logins are disabled on the port you are going to use,
otherwise you will not be able to communicate with the UPS. Si vous
are not sure that logins are disabled for the port, run the
'admintool' program as root, and disable the port. The 'admintool'
program is a GUI administration program, and required that you are
running CDE, OpenWindows, or another XWindows program such as KDE.
Solaris probes the serial ports during boot, and during this
process, it toggles some handshaking lines used by dumb UPSes. As a
result, particularly for simple signalling "dumb" UPSes it seems to
kick it into a mode that makes the UPS think it's either in a
calibration run, or some self-test mode. Since at this point we are
really not communicating with the UPS, it's pretty hard to tell
what happened. But it's easy to prevent this, and you should.
Disconnect the UPS, and boot the system. When you get to a login
prompt, log in as root. Type the following command:
eeprom com1-noprobe=true
ou
eeprom com2-noprobe=true
depending on which com port your UPS is attached to. Then sync and
shutdown the system normally, reattach the UPS, and reboot. Cette
should solve the problem. However, we have some reports that recent
versions of Solaris (7 & 8) appear to have removed this eeprom
option and there seems to be no way to suppress the serial port
probing during boot.
At this point, you should have a complete installation. The daemon
will load automatically at the next boot. Watch for any error
messages during boot, and check the event logs in /etc/apcupsd. Si
everything looks OK, you can try testing the package by removing
power from the UPS. NOTE! if you have a voltage-signalling UPS,
please run the first power tests with your computer plugged into
the wall rather than into the UPS. This is because dumb serial-port
UPSes have a tendency to power off if your configuration or cable
are not correct.
As a user, your input is very helpful in solving problems with the
package, and providing suggestions and future directions for the
development of the package. We are striving to provide a useful
package that works across all platforms, and welcome your
retour d'information.
Unknown System
During the './configure', if apcupsd does not find one of the systems for
which it has specific installation programs, it will set the
Operating System to unknown and will use the incomplete
installation scripts that are in platforms/unknown. Toi
will be on your own, or you can ask the developers list
(apcupsd-users@lists.sourceforge.net) for installation
instructions. This directory also contains a hint file for Linux
From Scratch, which could be helpful for other systems as well.
Windows Systems
Appropriate scripts
(actually Windows batch files) are included with the Apcupsd Win32
installer package.
Checking Your Configuration File
Once you have installed apcupsd,
either from a binary package or by building from source, your next
step should be to inspect your /etc/apcupsd/apcupsd.conf file to
make sure it is valid.
You can read the complete reference on configuration directives
(Configuration Directive Reference), but if you are
setting up a normal standalone configuration you should only need
to check (and possibly fix) the first three items listed below.
Votre UPSTYPE should be the UPS's protocol type: dumb, apcsmart,
usb, net, pcnet, or snmp. Votre UPSCABLE should be the type of cable
vous utilisez.
DEVICE should be set to the path of the device node
(usually in /dev) to use to communicate with the UPS. This is used primarily
for serial port connections. If you have a USB device, it is better not to
specify a DEVICE directive by leaving it black or commenting it out.
Apcupsd will automatically search for your device in the standard places.
If you specify a DEVICE, it should be the name of the device that
apcupsd is to use to communicate with the UPS.
If the first time you execute apcupsd, you get a message to the
effect that the Apcupsd USB driver is missing, it means that you
most likely forgot to put --enable-usb on your './configure'
command line.
The Configuration Examples chapter of this manual provides
the essential characteristics of each main type of configuration
fichier. After those elements are correct, apcupsd should run, and
then it is only a matter of customization of your setup.
Arranging for Reboot on Power-Up
The final consideration for a automatic reboot after a full power down
is to ensure that your computer will automatically reboot when the
power is restored.
This is not the normal behavior of most computers as shipped from
the factory. Normally after the power is cut and restored, you must
explicitly press a button for the power to actually be turned on.
You can test your computer by powering it down; shutting off the
power (pull the plug); then plugging the cord back in. If your
computer immediately starts up, good. There is nothing more to do.
If your computer does not start up, manually turn on the power (by
pressing the power on button) and enter your computer's SETUP
program (often by pressing DEL during the power up sequence;
sometimes by pressing F10). You must then find and change the
appropriate configuration parameter to permit instant power on.
Normally, this is located under the BOOT menu item, and will be
called something such as Restore on AC/Power Loss ou Full-On.
The exact words will vary according to the ROM BIOS provider.
Generally you will have three options: Last State, Power On,
et Power Off. Although Last State should normally work, we
recommend setting your computers to Power On. Cela signifie que
whenever the power is applied they are on. The only way to shut
them off is to pull the plug or to have a special program that
powers them off (/sbin/poweroff on Linux systems).
If after making all the changes suggested above, you cannot get
your computer to automatically reboot, you might examine your halt
script (/etc/rc.d/init.d/halt in the case of Red Hat Linux) and see
if the final line that performs the halt or reboot contains the
-p option for powering down the computer. It should not with the
logic used by apcupsd, but if it does, the -p option could cause
your computer to power off while the UPS is still suppling power
(i.e. before the UPS kills the power). Depending on the setting of
your BIOS, it may prevent your computer from restarting when the
power returns. As already mentioned, this should not apply, but in
case of problems it is worth a try.
Making sure apcupsd Is Running
The simplest way to invoke apcupsd is from the command line by entering:
/sbin/apcupsd
To do so, you must be root. However, normally, you will want
apcupsd started automatically when your system boots. On some
systems with installation support (e.g. SUSE and Red Hat), the
installation procedure will create a script file that you will be
automatically invoked when your system reboots. On other systems,
you will have to invoke apcupsd from your rc.local script.
On Red Hat systems, this script file that automatically invokes
apcupsd on system start and stops is /etc/rc.d/init.d/apcupsd
To start apcupsd manually (as you will probably do immediately
following the installation), enter the following:
/etc/rc.d/init.d/apcupsd start
To understand how this file is automatically invoked at system
startup and shutdown, see the man pages for chkconfig(8).
On SUSE systems, the script file that automatically invokes apcupsd
on system start and stops is /etc/rc.d/apcupsd.
To start apcupsd manually (as you will probably do immediately
following the installation), enter the following:
/etc/rc.d/apcupsd start
Normally, when properly installed, apcupsd will be started and
stopped automatically by your system. Unfortunately, the details
are different for each system. Below, we give the commands for
selected systems. Alternatively, there are simple stopapcupsd and
startapcupsd scripts in the examples directory, or you can modify
one of the scripts in the distributions directory to meet your
needs.
To stop apcupsd you can do the following:
On Red Hat systems:
/etc/rc.d/init.d/apcupsd stop
On SUSE systems:
/etc/rc.d/apcupsd stop
Please see the Testing Apcupsd chapter for more details on insuring
that apcupsd is running properly.
A Simple USB Configuration
If you have a USB UPS, the essential elements of your apcupsd.conf file
should look like the following:
## apcupsd.conf v1.1 ## UPSCABLE usb UPSTYPE usb DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable
Notice that we have not specified a device. In doing so, apcupsd
will try all the well known USB ports. We strongly recommend you
use this (empty device address) form unless you have a good reason
to do otherwise.
Please use the explicit specifications of a device only if you know
exactly what you are doing. In general, it is much easier to let
apcupsd find the device itself.
Please see USB Configuration for detailed help
on setting up your system to work with a USB UPS.
A Simple Configuration for a Serial SmartUPS
If you have a Smart UPS
using the serial cable supplied by APC, or you build a CUSTOM SMART cable
outlined in the cables chapter, a very simple configuration file
would look like the following:
## apcupsd.conf v1.1 ## UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable
Normally you would have many more configuration directives to
completely customize your installation, but this example shows you
the minimum required.
A Simple Configuration for a Simple Signaling or Dumb
If you have a simple signaling
or dumb UPS such as a BackUPS, you will need to know exactly what
cable you have and specify it on the UPSCABLE directive. S'il te plait regarde
the list of UPSes versus cables in the beginning of this document
pour plus d'informations. The cable number is normally stamped in the
plastic at one end of the cable. If you specify the wrong cable, it
is very likely that at the first power failure, your computer will
be immediately shutdown. This is an unfortunate consequence of the
dumb signaling mode. To avoid this, first replace
/etc/apcupsd/apccontrol with safe.apccontrol found in the
examples directory, then test until everything works correctly.
Once you have the correct cable, be sure to remember to reinstall
the correct apccontrol file and test that your computer is
correctly shutdown during a power failure.
## apcupsd.conf v1.1 ## UPSCABLE (number of cable you have) UPSTYPE dumb DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable
If your cable does not have low battery detection, as is the case
with some older models, you will also need to define TIMEOUT nnn
where you set nn to be the number of seconds on a power failure
after which a shutdown is effected.
Normally you would have many more configuration directives to
completely customize your installation, but this example shows you
the minimum required.
NIS Server/Client Configuration Using the Net Driver
NIS (Network Information Server) mode allows for communication
between instances of apcupsd running on different hosts. Seulement un
of those hosts, the server, needs to talk to the UPS directly. le
others, clients, obtain information about the state of the UPS by
querying the server. NIS is ne pas related to Sun's NIS/YP
prestations de service.
NIS clients and servers require that apcupsd be compiled with the
Net Driver --enable-net. This is typically enabled by default.
The NIS server is connected to the UPS and should be configured
exactly as a standalone configuration, but with NETSERVER on.
In all other respects, the server should be configured in
standalone mode. You may also set the NIS server specific options
NISIP to restrict which IP address of the server which apcupsd
listens on. The default, 0.0.0.0, means to list on all of the
server host's IP addresses; NISPORT (default 3551) to set which
TCP port the server listens on; et EVENTSFILE et
EVENTSFILEMAX to provide information about the last few events
to clients. You may also need to modify your firewall rules on the
server's host to allow traffic to the NISPORT.
For the NIS client computer, you will have a configuration that
looks something like what follows. What is important is that you
get the information from an UPSCABLE ether avec UPSTYPE
net over the network and you must specify the address of
a NIS server using DEVICE. The client apcupsd will then poll
the NIS server specified in DEVICE chaque POLLTIME seconds
(formerly NETTIME).
## apcupsd.conf v1.1 ## UPSCABLE ether UPSTYPE net LOCKFILE /var/lock DEVICE server-network-address:3551 UPSCLASS standalone UPSMODE disable POLLTIME 10
le DEVICE is set to server-address:port, where
server-address is the fully qualified domain name or IP address
of the apcupsd NIS server, and port is the NISPORT que le
server is listening on. The default is 3551, but older versions of
apcupsd used port 7000.
If you set POLLTIME too large, your client may not see the
change in state of the NIS server before the server has shutdown.
Normally, you have at least 30 seconds of grace time between the
time the NIS server decides to shutdown and the time it no longer
responds. Your slave must poll during this interval.
Any client run using the Net driver will shutdown when its own
timers expire or when the NIS server shuts down, whichever occurs
première. This means that if you want the slave to shutdown before the
server, you need only set BATTERYLEVEL, MINUTES ou
TIMEOUT on the client for a faster shutdown than the values
defined on the NIS server. This can often be useful if the slave is
less important than the master and you wish to reduce battery power
consumption so that the master can remain up longer during a power
outage.
NIS clients work principally by reading the STATFLAG record that is
sent by the NIS server (present in the output of apcaccess). le
low 16 bits are the standard APC status flag, and the upper 16 bits
represent the internal state of apcupsd, so the slave can see when
the power fails and know when to shutdown.
It would be possible to have a client also work as a server, but
that would increase the delay of information getting from the UPS
to the secondary client.
Differences between NIS Client/Server and the old (now removed) Master/Slave modes
The difference between the NIS mode and the removed master/slave
mode is that the NIS server has no explicit knowledge of the
slaves. The NIS server makes its information available via the net
(NIS), and the NIS slaves read it. When the NIS server is going to
shutdown, it makes the information available to any NIS slave that
polls it, but the NIS server does not explicitly call each NIS
slave as is the case in the Master/Slave networking described
several sections above.
Think of the difference as push (Master/Slave) vs. pull
(NIS-based). In the case of M/S, the master makes all the shutdown
decisions and notifies the slaves when they are to shut down or
when some other interesting event happens. The slaves just do
whatever the master says, whenever the master says to. On the other
hand, with the NIS-based network config you basically "publish" the
UPS status from one server and then your clients view that status
and make their own decisions.
PowerChute Network Shutdown Driver (PCNET)
As of 3.14, Apcupsd supports the PowerChute Network Shutdown
protocole. This is an alternative to SNMP for use with APC's AP9617
family of network smartslot modules. Note that the older AP9606
modules do ne pas support PCNET.
To enable PCNET support, configure with the --enable-pcnet
flag. This is typically enabled by default.
The required apcupsd.conf settings are straightforward:
## apcupsd.conf v1.1 ## UPSCABLE ether UPSTYPE pcnet LOCKFILE /var/lock DEVICE ipaddr:user:passphrase UPSCLASS standalone UPSMODE disable
le DEVICE setting specifies the IP address of the UPS as well
as the username and authentication passphrase to use. Note that the
username and passphrase are ne pas the Web/SNMP login credentials.
They are separate settings. The default username on a new card is
"apc" and the default passphrase is "admin user phrase". To change
the passphrase, log in to the Web UI and go to the UPS tab, then to
PowerChute -> Configuration. (This assumes firmware v3.3.1. Other
versions may place the setting elsewhere.) The password must be a
minimum of 15 characters long. The web UI will silently ignore
shorter passwords and does not give an error message. There is no
apparent way to change the username.
Note that you may leave DEVICE blank and Apcupsd will accept
information from any PCNET UPS on the network,
however it will be very insecure since an attacker could easily send packets
crafted to cause your server to shut down.
En utilisant le ipaddr, utilisateur, et passphrase will prevent this behavior.
You may need to take steps to ensure networking stays active during
your OS's shutdown sequence in order for the PCNET driver to power
off the UPS (the so-called "killpower" operation). On a Linux
distro, you can use commands such as…
chkconfig --level 0 network on chkconfig --level 0 iptables on
…to make sure networking stays up.
MODBUS Driver
MODBUS is APC's replacement for the aging 'apcsmart' (aka UPS-Link)
protocole. It is recommended for modern (ex: SMT series) Smart-UPS models.
As of 3.14.11, apcupsd supports the MODBUS protocol over RS232 serial
interfaces. As of 3.14.13, apcupsd supports the MODBUS protocol over USB.
Not all APC UPSes support MODBUS. New 2013 year Smart-UPS models are likely to
support it out-of-the-box and firmware updates are available for some older
models. APC/Schneider tech support is your best point of contact for determining
if a certain model will support MODBUS. That said, APC knowledge base article
FA164737 indicates MODBUS support is available for the majority of the SMC,
SMT, and SMX model lines.
The required apcupsd.conf settings for MODBUS are straightforward.
For MODBUS serial RS232:
## apcupsd.conf v1.1 ## UPSCABLE smart UPSTYPE modbus DEVICE /dev/ttyS0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disablele DEVICE setting identifies the serial port to which the UPS is connected.
This can take the form of COM1, etc. on Windows or /dev/XXX on UNIX
systems.You should use the APC-supplied serial cable (P/N 940-0625A) that ships with
the UPS. Other 'smart' type cables may work, but only 940-0625A has been
formally tested at this time.
For MODBUS USB:
## apcupsd.conf v1.1 ## UPSCABLE usb UPSTYPE modbus DEVICE LOCKFILE /var/lock UPSCLASS standalone UPSMODE disablele DEVICE setting can be left blank or, optionally, set to the serial
number of the UPS. Si DEVICE is blank, apcupsd will attach to the first
APC UPS it finds, otherwise it will attach to the specific UPS identified by
the serial number.
Note that most UPSes ship with MODBUS support disabled by default. Vous devez
use the UPS's front panel menu to enable MODBUS protocol support before apcupsd
will be able to communicate with the UPS. You may need to enable the "Advanced"
menu option before the MODBUS protocol option will be visible.
The following testing procedures apply for the
most part to SmartUPSes, whether USB or serial. Si tu as un
dumb voltage-signalling UPS, your testing procedures will be
somewhat different, and you should see the section on Testing
Serial UPSes (see Testing Serial-Line UPSes).
Process-Status Test
After you start apcupsd, execute the following command:
ps fax
or the equivalent for your system. You should see something similar
to the following output.
632 ? S 0:00 /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf 841 ? S 0:00 _ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf 842 ? S 0:00 _ /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
This indicates that apcupsd is up and running and has started the
two standard threads in addition to the main thread.
If you see only one instance of apcupsd running, don't worry about
it as this is normal on most non-Linux systems, and on Linux 2.6.x
kernels.
If you do not find that apcupsd is in the above list, the most
likely problem is a configuration file glitch. If no messages were
printed, you should check your system log (normally
/var/log/messages) where you will find one or messages indicating
the nature of the problem.
Logging Test
Once you have established that the proper processes are running, do
a tail of the system log file, normally /var/log/messages:
tail /var/log/messages
You should see output that looks similar to the following:
Dec 5 17:01:05 matou apcupsd[5917]: apcupsd 3.7.2 startup succeeded
These messages should also appear in the temporary file
(/etc/apcupsd/apcupsd.events) if you are using the default
configuration file. If you have installed the RPM, they will
probably be in /var/log/apcupsd.events.
apcaccess Test
This test consists of running apcaccess to see if apcupsd is properly
updating its internal variables. Please note that you must enable
the apcupsd Network Information Server in your configuration file
for apcaccess travailler. This is done by setting:
NETSERVER on NISPORT 3551
in your apcupsd.conf fichier.
To run the apcaccess test, use the following command:
apcaccess status
Depending on the type of UPS you have, you will get slightly
different output, but an example For a Smart-UPS is as follows:
APC : 001,048,1088 DATE : Fri Dec 03 16:49:24 EST 1999 HOSTNAME : daughter RELEASE : 3.7.2 CABLE : APC Cable 940-0024C MODEL : APC Smart-UPS 600 UPSMODE : Stand Alone UPSNAME : SU600 LINEV : 122.1 Volts MAXLINEV : 123.3 Volts MINLINEV : 122.1 Volts LINEFREQ : 60.0 Hz OUTPUTV : 122.1 Volts LOADPCT : 32.7 Percent Load Capacity BATTV : 26.6 Volts BCHARGE : 095.0 Percent MBATTCHG : 15 Percent TIMELEFT : 19.0 Minutes MINTIMEL : 3 Minutes SENSE : Medium DWAKE : 000 Seconds DSHUTD : 020 Seconds LOTRANS : 106.0 Volts HITRANS : 129.0 Volts RETPCT : 010.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 34.6 C Internal ALARMDEL : Low Battery LASTXFER : Unacceptable Utility Voltage Change SELFTEST : NO STESTI : 336 DLOWBATT : 05 Minutes DIPSW : 0x00 Dip Switch REG1 : N/A REG2 : N/A REG3 : 0x00 Register 3 MANDATE : 03/30/95 SERIALNO : 13035861 BATTDATE : 05/05/98 NOMOUTV : 115.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : N/A BADBATTS : N/A FIRMWARE : N/A APCMODEL : 6TD END APC : Fri Dec 03 16:49:25 EST 1999
For a simple signaling or dumb UPS such as BackUPS, your output
will be very minimal as follows:
APC : 001,012,0319 DATE : Mon Feb 18 09:11:50 CST 2002 RELEASE : 3.8.5 UPSNAME : UPS_IDEN CABLE : APC Cable 940-0128A MODEL : BackUPS UPSMODE : Stand Alone STARTTIME: Mon Feb 18 09:11:45 CST 2002 LINEFAIL : OK BATTSTAT : OK STATFLAG : 0x008 Status Flag END APC : Mon Feb 18 09:15:01 CST 2002
If you see the above output, it is a good sign that apcupsd is
working. Assuming that the output looks reasonable, check the
following variables:
- LINEV
- This is the line voltage and it should be a value
that is appropriate for your equipment. In the USA, it is typically
about 120 Volts while in Europe, it is about 220 Volts. - BATTV
- Unless you have additional battery packs, this
should be near 24 Volts plus or minus 5 Volts. - STATUS
- This is the status of the UPS and it should
normally be ONLINE.
A very disturbing tendance is for some of the newer (Mar 2004) RS
and ES UPSes to have no Voltage information. This is an annoying bug,
but not serious. On the other hand, some of those UPSes now have no
battery charge information BCHARGE. Si BCHARGE is zero in your
listing and you are running a Smart or a USB UPS, then you will
have to set the BATTERYLEVEL directive in your apcupsd.conf file to
-1.
If you see a message to the effect of:
APCACCESS FATAL ERROR in apcaccess.c at line 336 tcp_open: cannot connect to server localhost on port 3551.
It means that you have probably not enabled the Network Information
Server in your configuration file for apcaccess travailler. This is
done by setting NETSERVER et NISPORT in your apcupsd.conf file
as shown above.
Communications Test
At this point, you should ensure
that apcupsd is handling the connection to the UPS correctly. Cette
test assumes you have a UPS that speaks apcsmart protocol, over
either USB or a serial port. If you have an old-style
voltage-signaling UPS, please skip to the next section (Simulated
Power Fail Test).
When apcupsd detects a problem, it generates an EVENT, which
consists of sending a message to the system log then invoking the
apccontrol script (normally in /etc/acpupsd/apccontrol) to handle
the event.
In order to create an event, remove the serial port plug from the
back of your computer or from the back of the UPS. Within 6
seconds, apcupsd should detect the lack of serial port
communications and broadcast a wall message indicating that the
serial port communications was lost:
Warning communications lost with UPS lost.
At the same time, it sends the same message to the system log and
to the temporary EVENTS file (/etc/apcupsd/apcupsd.events).
Plug the serial port plug back into your computer, and within about
12 seconds, apcupsd should reestablish communications and broadcast
and log the following message:
Communications with UPS restored.
If these messages are logged but not broadcast, either you have
your mesg permission set to non (see 'man wall' or 'man mesg'),
or there is a problem with apccontrol. If you are running a window
manager such as GNOME and don't have a console window open, you may
not receive the wall messages. However, you should find them in
your system log file (normally /var/log/messages) and in the
temporary EVENTS file, /etc/apcupsd/apcupsd.events. For example, to
observe these events in the temporary EVENTS file, you might do a
tail -f /etc/apcupsd/apcupsd.events
Note, if you have installed from the RPM, the proper events file
may be /var/log/apcupsd.events. You can find the actual filename by
checking your apcupsd.conf file before running the test.
If you do not observe these messages, you should correct this
problem before proceeding with additional tests.
Simulated Power Fail Test
At this point, you should
verify that in the event of a power fail apcupsd properly calls
apccontrol. This test is appropriate for all models of UPSes (smart
or dumb).
To avoid the possibility that apcupsd might shut down your system,
locate where apccontrol resides on your system (normally,
/etc/apcupsd/apccontrol. Move this script to another location e.g.
apccontrol.save and replace it with the script found in
examples/safe.apccontrol. When that is done, ensure that your UPS
battery is fully charged and that you have at least 5 minutes of
remaining runtime on the batteries. This can be done by examining
the values of the BATTCHG et TIMELEFT variables in the
printout of 'apcaccess status'.
Athough this should not be necessary, as an extra precaution, you
can shutdown your machine, remove the plug from the UPS you are
testing, and plug your machine into another UPS or directly into
the wall. Doing so, will ensure that the UPS doesn't cut the power
to your machine at a bad time. Remember at the end of the testing
to plug your machine back into the UPS.
You can also minimize the risk from an unexpected shutdown by using
a journaling filesystem such as Linux's EXT3. All modern disk
drives park themselves safely when they power down, rather than
ploughing up oxide on your disk's recording surface. Ainsi,
unexpected power less has to hit very narrow timing windows in
order to trash an EXT3 transaction.
To begin the test, pull the power plug from the UPS. The first time
that you do this, psychologically it won't be easy, but after you
have pulled the plug a few times, you may even come to enjoy it. Si
all goes well, apcupsd should detect the power failure and print
several warning messages. The first should appear after 5 to 6
seconds and read:
Warning power loss detected.
Then generally 6 seconds later, apcupsd is sure that it isn't a
transient effect, so it sends:
Power failure. Running on UPS batteries.
After a few more seconds (total around 15 seconds), plug the power
cord back in and ensure that apcupsd is aware that the power has
returned. It should print:
Power has returned...
If you do not observe the above messages, please correct the
situation before proceeding. The most likely cause of problems
are:
- apcupsd doesn't recognize the power failure because the
configuration directives are not correct. Par exemple. wrong cable. - The file /etc/apcupsd/apccontrol doesn't exist or is not marked
as executable.
System Shutdown Test
This is an intermediate
test that you can do, for all UPS models before doing the Full
Power Down Test. First modify the /etc/apcupsd/apccontrol file so
that in the killpower case, the line that re-executes apcupsd
avec le --killpower option is commented out. L'original
line probably looks something like:
$APCUPSD --killpower
when it is commented out, it looks like:
#$APCUPSD --killpower
Now when you pull the power plug, and either the timer expires or
the batteries are exhausted (see the next section for more
details), the system should be fully shutdown.
After performing this test, please be sure to restore
/etc/apcupsd/apccontrol to its previous state.
Full Power Down Test
To complete the testing, you should do a power fail shutdown of your
système. This test is applicable to all UPS models. Please do a
backup of your system or take other precautions before attempting
this to avoid the possibility of lost data due to a problem (I have
been through this at least 10 times and never once had problems,
but we all know that someday something will go wrong).
Before proceeding, please ensure that your halt script or the
equivalent has been properly updated by the install process to
contain the logic to call apcupsd --killpower ou apccontrol killpower
when it detects a power failure situation (the presence of a /etc/powerfail
file). See the Building and Installing apcupsd section of this manual,
or the README files for additional details about the halt modifications
necessary.
When you are ready to do the test, either simply pull the plug and
wait for the batteries to become exhausted, or set the TIMEOUT
configuration directive to something like 60 so that the system
will shutdown before the batteries are exhausted. We recommend
doing the full shutdown without using TIMEOUT to correctly
simulate a real power failure, but the choice is yours (I did it
once here, but now use TIMEOUT 30).
If all goes well, your system should be shutdown before the
batteries are completely exhausted and the UPS should be powered
off by apcupsd. Please be aware that if you do the full power down,
you must ensure that your UPS is totally powered off. Otherwise, it
may have been given the command to power off, but due to a long
grace period it is still waiting. If you were to reboot your
computer during the grace period, the UPS could then suddenly turn
off the power (this happened to me). To avoid this problem, always
wait for your UPS to power itself off, or power if off manually
before restarting your computer. On my system, the UPS is
configured as at the factory to have a 180 second grace period
before shutting off the power. During this type of testing, 180
seconds seems like an eternity, so please take care to either
wait or manually power off your UPS. To determine what grace period
is programmed into your UPS EEPROM, run 'apcaccess eprom' and look
at the "Shutdown grace delay".
If you experienced so problems with
the above testing procedures, or if you are porting apcupsd to
another system, or you are simply curious, you may want to know
exactly what is going on during the shutdown process. If so, please
see the Shutdown Sequence section of this manual.
apctest
apctest is a program that allows you to talk
directly to your UPS and run certain low-level tests, adjust various settings
such as the battery installation date and alarm behavior, and perform a
battery runtime calibration. Here we describe how to use it for a SmartUPS
utilizing the apcsmart driver and RS232 serial connection.
The menus and options for USB, MODBUS, and simple signaling UPSes are different
but mostly self-explanatory.
Shutdown apcupsd if it is running. This is important. Only one program can
communicate with the UPS at a time and if apcupsd is running, apctest will fail
to contact the UPS.
Run apctest by invoking it with no arguments.
It will read your installed apcupsd.conf configuration (so it knows
where to find the UPS) and then it will present you with the
following output:
2003-07-07 11:19:21 apctest 3.10.6 (07 July 2003) 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 = SMART Setting up serial port ... Creating serial port lock file ... Hello, this is the apcupsd Cable Test program. This part of apctest is for testing Smart UPSes. Please select the function you want to perform. 1) Query the UPS for all known values 2) Perform a Battery Runtime Calibration 3) Abort Battery Calibration 4) Monitor Battery Calibration progress 5) Program EEPROM 6) Enter TTY mode communicating with UPS 7) Quit Select function number: 1
Item 1 will probe the UPS for all values known to apcupsd and
present them in rather raw format. This output can be useful for
providing technical support if you are having problems with your
UPS.
Item 2 will perform a Battery Runtime Calibration. This test will
only be performed if your battery is 100% charged. Running the test
will cause the batteries to be discharged to approximately 30% of
capacité. The exact number depends on the UPS model. In any case,
apctest will abort the test if it detects that the battery charge
is 20% or less.
The advantage of doing this test is that the UPS will be able to
recalibrate the remaining runtime counter that it maintains in its
firmware. As your batteries age, they tend to hold less of a
charge, so the runtime calibration may not be accurate after
several years.
We recommend that perform a Battery Calibration about once a year.
You should not perform this calibration too often since discharging
the batteries tends to shorten their lifespan.
Item 3 can be used to abort a Battery Calibration in progress, if
you some how became disconnected.
Item 4 can be used to restart the monitoring of a Battery
Calibration if you should some how become disconnected during the
test.
Item 5 is used to program the EEPROM. Please see the Configuration
Directives Used to Set the UPS EEPROM chapter of this manual for the
details.
Item 6 will initiate a direct communication between your terminal
and the UPS, at which point you can enter raw UPS commands. S'il vous plaît
be aware that you should be careful what commands you enter because
you can cause your UPS to suddenly shutdown, or you can modify the
EEPROM in a way to disable your UPS. The details of the raw Smart
mode UPS commands can be found in the APC Smart Protocol
chapter of this manual.
Item 7 will terminate apctest.
After you have verified
that your UPS is working correctly, you will probably want to query
the state of its health occasionally. The tools apcupsd gives you
to do this include one command-line utility (apcaccess) and a GUI
you can use through a Web browser. You can also use apctest to tune
some parameters of the UPS itself.
apcaccess
apcaccess is a program (normally found in
/sbin/apcaccess) that permits you to print out the complete status
of your UPS.
apcaccess will use the Network Information Server to obtain the
necessary information. Toi
can specify a second optional argument to apcaccess in the form of
host:port where the :port is optional. The default is
localhost:3551. Please note that in versions prior to 3.10.6, the
default NIS port was 7000, so if you are mixing versions, you will
need to take a lot of care to ensure that all components are using
the same port.
To enable the apcupsd Network Information Server, which is normally
the default, you set:
NETSERVER on NISPORT 3551
in your apcupsd.conf fichier.
The full form of the apcaccess command is:
apcaccess status localhost:3551
where only apcaccess status should normally be needed. localhost
may be replaced by any machine name, fully qualified domain name,
or IP address, which means that apcaccess can access any UPS on the
network running the Network Information Server.
le statut command line option of apcaccess will produce a full
printout of all the STATUS variables used by apcupsd. This can
be very helpful for checking the condition of your UPS and to know
whether or not apcupsd is properly connected to it.
Please note that if you invoke apcaccess within the first 30
seconds of launching apcupsd, you will likely get an error message
such as:
APCACCESS FATAL ERROR in apcaccess.c at line 336 tcp_open: cannot connect to server localhost on port 3551.
This is because apcupsd is still in the process of initializing the
UPS. The solution is to wait at least 30 seconds after starting apcupsd
before launching apcaccess.
For a SmartUPS 1000 apcaccess will emit the following output:
DATE : Fri Dec 03 12:34:26 CET 1999 HOSTNAME : matou RELEASE : 3.7.0-beta-1 CABLE : Custom Cable Smart MODEL : SMART-UPS 1000 UPSMODE : Stand Alone UPSNAME : UPS_IDEN LINEV : 232.7 Volts MAXLINEV : 236.6 Volts MINLINEV : 231.4 Volts LINEFREQ : 50.0 Hz OUTPUTV : 232.7 Volts LOADPCT : 11.4 Percent Load Capacity BATTV : 27.7 Volts BCHARGE : 100.0 Percent MBATTCHG : 5 Percent TIMELEFT : 112.0 Minutes MINTIMEL : 3 Minutes SENSE : Low DWAKE : 060 Seconds DSHUTD : 180 Seconds LOTRANS : 204.0 Volts HITRANS : 253.0 Volts RETPCT : 050.0 Percent STATFLAG : 0x08 Status Flag STATUS : ONLINE ITEMP : 29.2 C Internal ALARMDEL : Low Battery LASTXFER : U command or Self Test SELFTEST : NO STESTI : 336 DLOWBATT : 02 Minutes DIPSW : 0x00 Dip Switch REG1 : 0x00 Register 1 REG2 : 0x00 Register 2 REG3 : 0x00 Register 3 MANDATE : 01/05/99 SERIALNO : GS9902009459 BATTDATE : 01/05/99 NOMOUTV : 230.0 NOMBATTV : 24.0 HUMIDITY : N/A AMBTEMP : N/A EXTBATTS : 0 BADBATTS : N/A FIRMWARE : 60.11.I APCMODEL : IWI END APC : Fri Dec 03 12:34:33 CET 1999
For the various smaller, cheaper APC USB UPSes, such as the CS, ES,
…, you will get much of the information that is presented above,
but not all of it. For example, you will not get MAXLINEV,
MINLINEV, LINEFREQ, … and in particular, the LOADPCT will be zero
when you are running on mains. LOADPCT will display when the UPS is
on batteries. You must remember that the non-SmartUPSes are much
simpler (and less expensive) and therefore produce less
information.
Apcupsd Notification and Events
When a major event is
generated within apcupsd, control is passed to the script
apccontrol normally found in /etc/apcupsd/apccontrol. The event
name, and a number of other important parameters are passed to the
script.
The major function of the apccontrol script is to perform a
shutdown of the system (as well as the killpower operation). Dans
addition, another major task for this script is to notify you by
email when certain events such as powerfail occur.
Since apccontrol is a script, you can customize it to your own
needs using any text editor. To do so, you must have a minimal
knowledge of Unix shell programming. In addition, another feature
is that you can write your own scripts that will be automatically
called by apccontrol before any of its own code is executed.
Details of the events and how to program them are contained in the
Advanced topics section entitled Customizing Event Handling.
apcupsd Network Monitoring (CGI) Programs
There are four CGI programs (multimon.cgi, upsstats.cgi, upsfstats.cgi, and
upsimage.cgi). To have them properly installed, you must run the
'./configure' command with --enable-cgi and you should
specify an installation directory with --with-cgi-bin= ou
load them manually. The default directory for installation of the
CGI programs is /etc/apcupsd, which is not really where you want
them if you are going to use them. Normally, they should go in the
cgi-bin of your Web server.
Once built and loaded, they will give you the status of your UPS or
UPSes via a web browser.
Normally only multimon.cgi is directly invoked by the user.
However, it is possible to directly invoke upsstats.cgi et
upsfstats.cgi. upsimage.cgi should never be directly invoked as it
is used by upsstats.cgi to produce the bar charts.
Setting up and Testing the CGI Programs
Before using multimon and the other CGI programs, first ensure that
apcupsd is configured to run the Network Information Server. Cette
is done by setting NETSERVER on in /etc/apcupsd/apcupsd.conf.
This switch is on by default.
Next you must edit the hosts file /etc/apcupsd/hosts.conf and at
the end, add the name of the hosts you want to monitor and a label
string for them. Par exemple:
MONITOR matou "Server" MONITOR polymatou "Backup server" MONITOR deuter "Disk server"
matou, polymatou, and deuter are the network names of the three
machines currently running apcupsd. Please note that the network
names may either be IP addresses or fully qualified domain names.
The network name (or IP address) may optionally be followed by
:port, where the port is the NIS port address you wish to use.
This is useful if you are running multiple copies of apcupsd on the
same system or if you are running in a mixed vendor environment
where the NIS port assignments differ. An example could be the
following:
MONITOR matou "Server" MONITOR polymatou "Backup server" MONITOR deuter "Disk server" MONITOR polymatou:7001 "APC USB UPS"
where the USB copy of apcupsd has been configured to use port 7001 by
modifying apcupsd.conf. Note, the default NIS port is 3551 on most
platforms.
To test multimon.cgi, you can execute it as non-root directly from
the source cgi build directory. To do so, enter at a shell prompt:
./multimon.cgi
If everything is set up correctly, it will print a bunch of HTML
with the values of the machines that you have put in the hosts.conf
fichier. It should look something like the following (note, only a
small portion of the output is reproduced here):
Content-type: text/htmlMultimon: UPS Status Page
It is important to note that under normal circumstances the user Overview of Serial-Interface UPSesIf you have a UPS that communicates via According to Bill Marr the Belkin F5U109, also sold as F5U409 also Connecting a Serial-Line UPS to a USB PortBy using a special adaptor, you can The device that Joe Acosta and Kern are using is IOgear GUC232A USB At Kern's site, running Red Hat 7.1 with kernel 2.4.9-12, he simply DEVICE /dev/ttyUSB0 Depending on whether or not you have hotplug working, you may Testing Serial-Line UPSesIf you have a serial-line UPS, there are some tests you should run To test your computer's connection with a serial-line UPS, you Because it is easy to configure a serial cable incorrectly in such Also note that if you launch the execution of apcupsd while your Finally, double-check the state of your cabling and UPS indicator Establishing Serial Port ConnectionOnce you have compiled, installed, If you see a message similar to the following about 30 seconds after starting apcupsd FATAL ERROR in apcserial.c at line 156 PANIC! Cannot communicate with UPS via serial port. it means that apcupsd tried for about 30 seconds to establish
The first thing to do is to look at your log file, usually If you have a UPS that uses apcsmart protocol, you can manually test the Once you are sure that serial port communications is working, Troubleshooting Serial Line communicationsThe most frequently encountered problem with voltage-signalling For simple signaling UPSes, you should ne pas use Facile dans le Bizarre Intermittent Behavior:In one case, a user reported that he received random incorrect You can either use the cable that came with your If you already have an APC cable, you can determine what kind it is To make your own cable you must first know whether you have a UPS If you have an smart UPS, and you build your own cable, build a Smart-Custom Smart-Custom Cable for SmartUPSesYou do not have this cable unless you built it yourself. SMART-CUSTOM CABLE Signal Computer UPS DB9F DB9M RxD 2 -------------------- 2 TxD Send TxD 3 -------------------- 1 RxD Receive GND 5 -------------------- 9 Ground When using this cable with apcupsd specify the following in UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 (or whatever your serial port is) If you have an OS that requires DCD or RTS to be set before you can Simple-Custom Voltage-Signalling Cable for "dumb" UPSesYou do not have this cable unless you built it yourself. For "dumb" UPSes using voltage signalling, if you are going to SIMPLE-CUSTOM CABLE Signal Computer UPS DB9F 4.7K ohm DB9M DTR 4 --[####]--* DTR set to +5V by Apcupsd | CTS 8 ----------*--------- 5 Low Battery GND 5 -------------------- 4 Ground DCD 1 -------------------- 2 On Battery RTS 7 -------------------- 1 Kill UPS Power List of components one needs to make the Simple cable:
Assembly instructions:
We use the DTR (pin 4 on the female connector) as our +5 volts To have a better idea of what is going on inside apcupsd,
Please note that these actions apply only to the SIMPLE cable. le Finally, here is another way of looking at the CUSTOM-SIMPLE APCUPSD SIMPLE-CUSTOM CABLE Computer Side | Description of Cable | UPS Side DB9f | DB25f | | DB9m | DB25m 4 | 20 | DTR (5vcc) *below | n/c | 8 | 5 | CTS (low battery) *below | <- 5 | sept 2 | 3 | RxD (no line voltage) *below | <- 3 | 2 5 | 7 | Ground (Signal) | 4 | 20 1 | 8 | CD (on battery from UPS) | <- 2 | 3 7 | 4 | RTS (kill UPS power) | -> 1 | 8 n/c | 1 | Frame/Case Gnd (optional) | 9 | 22 Note: the <- and -> indicate the signal direction. When using this cable with apcupsd specify the following in UPSCABLE simple UPSTYPE dumb DEVICE /dev/ttyS0 (or whatever your serial port is) Custom-RJ45 Smart Signalling Cable for BackUPS CS ModelsIf you have a BackUPS CS, you are probably either using it with the The jack in the UPS is actually a 10 pin RJ45. However, you can Below, you will find a diagram for the CUSTOM-RJ45 cable: CUSTOM-RJ45 CABLE Signal Computer UPS UPS DB9F RJ45-8 RJ45-10 RxD 2 ---------------- 1 2 TxD Send TxD 3 ---------------- 7 8 RxD Receive GND 5 ---------------- 6 7 Ground FG Shield ---------------- 3 4 Frame Ground The RJ45-8 pins are: looking at the end of the connector: 8 7 6 5 4 3 2 1 ___________________ | . . . . . . . . | | | ------------------- |____| The RJ45-10 pins are: looking at the end of the connector: 10 9 8 7 6 5 4 3 2 1 _______________________ | . . . . . . . . . . | | | ----------------------- |____| For the serial port DB9F connector, the pin numbers are stamped in Note, one user, Martin, has found that if the shield is not When using this cable with apcupsd specify the following in UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyS0 (or whatever your serial port is) The information for constructing this cable was discovered and Other APC Cables that apcupsd Supportsapcupsd will also support the following off the shelf cables that
Voltage Signalling Features Supported by Apcupsd for Various CablesThe following table shows the features supported by the current
Voltage SignallingApparently, all APC voltage-signalling UPSes with DB9 serial ports The signals presented or accepted by the UPS on its DB9 connector UPS Pin Signal meaning 1 <- Shutdown when set by computer for 1-5 seconds. 2 -> On battery power (this signal is normally low but goes high when the UPS switches to batteries). 3 -> Mains down (line fail) See Note 1 below. 5 -> Low battery. See Note 1 below. 6 -> Inverse of mains down signal. See Note 2 below. 7 <- Turn on/off power (only on advanced UPSes only) Note 1: these two lines are normally open, but close when the appropriate signal is triggered. In fact, they are open collector outputs which are rated for a maximum of +40VDC and 25 mA. Thus the 4.7K ohm resistor used in the Custom Simple cable works quite well. Note 2: the same as note 1 except that the line is normally closed, and opens when the line voltage fails. The Back-UPS Office 500 signalsThe Back-UPS Office UPS has a telephone type jack as output, which Looking at the end of the connector: 6 5 4 3 2 1 _____________ | . . . . . . | | | | |----------| |__| It appears that the signals work as follows: UPS Signal meaning 1 (brown) <- Shutdown when set by computer for 1-5 seconds. 2 (black) -> On battery power 3 (blue) -> Low battery 4 (red) Signal ground 5 (yellow) <- Begin signalling on other pins 6 (none) none Analyses of APC Cables940-0020B Cable Wiring
Although we do not know what the black box semiconductor contains, This cable can only be used on voltage-signalling UPSes, and This diagram is for informational purposes and may not be complete. APC Part# - 940-0020B Signal Computer UPS DB9F DB9M CTS 8 -------------------- 2 On Battery DTR 4 -------------------- 1 Kill power GND 5 ---------------*---- 4 Ground | --- *---- 9 Common DCD 1 ----|///|----------- 5 Low Battery |\| RTS 7 ----|///| (probably a --- semi-conductor) 940-0020C Cable Wiring
This cable can only be used on voltage-signalling UPSes, and This diagram is for informational purposes and may not be complete. APC Part# - 940-0020C Signal Computer UPS DB9F DB9M CTS 8 -------------------- 2 On Battery DTR 4 -------------------- 1 Kill power GND 5 ---------------*---- 4 Ground | *---- 9 Common RTS 7 -----[ 93.5K ohm ]----- 5 Low Battery or semi-conductor 940-0023A Cable Wiring
This cable can only be used on voltage-signalling UPSes, and This diagram is for informational purposes and may not be complete. APC Part# - 940-0023A Signal Computer UPS DB9F DB9M DCD 1 -------------------- 2 On Battery 3.3K ohm TxD 3 --[####]-* | DTR 4 ---------* GND 5 ---------------*---- 4 Ground | *---- 9 Common 940-0024C Cable Wiring
If you wish to build the standard cable furnished by APC APC Part# - 940-0024C Signal Computer UPS DB9F DB9M RxD 2 -------------------- 2 TxD Send TxD 3 -------------------- 1 RxD Receive DCD 1 --* | DTR 4 --* GND 5 -------------------- 9 Ground RTS 7 --* | CTS 8 --* 940-0095A Cable Wiring
This is the definitive wiring diagram for the 940-0095A cable APC Part# - 940-0095A UPS end Computer end ------- ------------ 47k 47k BATTERY-LOW (5) >----R1----*----R2----*----< DTR,DSR,CTS (4,6,8) | | | | | / E | |/ | B | *-------| 2N3906 PNP | | C | | *----< DCD (1) Low Batt | | R 4.7k 3 | 4.7k | SHUTDOWN (1) >----------*----R4----*----< TxD (3) | | 1N4148 *----K|---------< RTS (7) Shutdown POWER-FAIL (2) >--------------------------< RxD,RI (2,9) On Batt GROUND (4,9) >--------------------------< GND (5) Operation:
940-0095B Cable Wiring
This diagram is for informational purposes and may not be complete. APC Part# - 940-0095B Signal Computer UPS DB9F DB9M DTR 4 ----* CTS 8 ----| DSR 6 ----| DCD 1 ----* GND 5 ---------------*---- 4 Ground | *---- 9 Common RI 9 ----* | RxD 2 ----*--------------- 2 On Battery TxD 3 ----------[####]---- 1 Kill UPS Power 4.7K ohm 940-0119A Cable Wiring
This diagram is for informational purposes and may not be complete. APC Part# - 940-0119A UPS Computer pins pins Signal Signal meaning 1 (brown) 4,6 DSR DTR <- Shutdown when set by computer for 1-5 seconds. 2 (black) 8,9 RI CTS -> On battery power 3 (blue) 1,2 CD RxD -> Low battery 4 (red) 5 Ground 5 (yellow) 7 RTS <- Begin signalling on other pins 6 (none) none Serial BackUPS ES Wiring
The BackUPS ES has a straight through serial cable with no computer ----------- BackUPS-ES ----------------- DB9-M DB-9F pin signal pin 4 DSR -> 4 --+ | diode resistor 6 DTR -> 6 --+---->|----///---o kill power 1 DCD <- 1 --+ | 2 RxD <- 2 --+----------------+--o low battery | 7 RTS -> 7 --------+--///--+ | +--///--+ | 8 RI <- 8 --+----------------+--o on battery | 9 CTS <- 9 --+ 5 GND --- 5 ----------------------o ground 3 TxD 3 nc 940-0128A Cable Wiring
Though these UPSes are USB UPSes, APC supplies a serial cable Thanks to all the people who have helped test this and have APC Part# - 940-0128A computer --------- Inside the Connector--------- UPS DB9-F | | RJ45 pin - signal | | Pin - Color | | 4 DSR ->|---+ | | | diode resistor | 6 DTR ->|---+---->|----///---o kill power | 8 Orange | | 1 DCD <-|----+ | | | | 2 RxD <-|----+----------------+--o low battery| 3 Brown | | | 7 RTS ->|----------+--///--+ | | | | | +--///--+ | | | | 8 RI <-|----+----------------+--o on battery | 2 Black | | | 9 CTS <-|----+ | | signal | 5 GND --|-----------------------o ground | 7 Red | | 3 TxD | | | chassis | Chassis/GND |-----------------------o ground | 4 Black | | | Not connected | 1, 5, 6, 9, 10 -------------------------------------- The RJ45 pins are: looking at the end of the connector: 10 9 8 7 6 5 4 3 2 1 _______________________ | . . . . . . . . . . | | | ----------------------- |____| 940-0128D Cable Wiring
940-0128D is functionally similar to the 940-0128A cable except for Unverified: Try setting apcupsd to UPSTYPE dumb et UPSCABLE 940-0128A. APC Part# - 940-0128D DB9(Computer) RJ45-10(UPS) (5) (1) ____________ ( o o o o o ) [ oooooooooo ] o o o o / [____________] (9) (6) (10) [_] (1) RI(9)<---+ | CTS(8)<---+--- E 2N2222(NPN) |___ ____ /| B | | C | | | +---vvvv---+--[>|------<(2)OnBatt RTS(7)>---| 2k 1N5819 +---vvvv---+--[>|------<(3)LowBatt | | +--- C | |___| /| B DCD(1)<------- E 2N2222(NPN) DTR(4)>-------------------------->(8)KillPwr GND(5)----------------------------(7)Signal GND (Shield)--------------------------(4)Chassis GND 940-0127B Cable Wiring
Standard USB cable for USB-capable models with 10-pin RJ45 connector. APC Part# - 940-0127B USB(Computer) RJ45-10(UPS) _________ ____________ | = = = = | [ oooooooooo ] |_________| [____________] (1) (4) (10) [_] (1) +5V(1)-----------(1)+5V DATA+(2)-----------(9)DATA+ DATA-(3)-----------(10)DATA- GND(4)-----------(7)Signal GND (Shield)-----------(4)Chassis GRND Win32 Implementation Restrictions for Simple UPSesDue to inadequacies in the This imposes a few minor restrictions on the functionality of some Note: In a future release of apcupsd this procedure will be This section does not apply to voltage-signalling or dumb UPSes Smart UPSes internally compute the remaining runtime, and apcupsd If you wish to have the UPS recalibrate the remaining runtime
In principle, you should be able to do this with the computer You should not run the recalibration command more than once or There is a good deal of information available about the UPS and apcupsd's Status report formatSTATUS output is in ASCII format with a single data value or piece Status logging consists of periodically logging ALL available After each write, the file is rewound so that the size of the file To make reading the status data reliable via a named pipe, the Consequently, the first record always consists of 24 bytes (23 When this data is written to a file, it is written as two records, When this data is written to syslog(), it is written a record at a Status Report ExampleAn example of output from a BackUPS RS 1500 follows: APC : 001,037,0906 DATE : Sun Apr 26 17:22:22 EDT 2009 HOSTNAME : mail.kroptech.com VERSION : 3.14.2 (10 September 2007) redhat UPSNAME : ups0 CABLE : USB Cable MODEL : Back-UPS RS 1500 UPSMODE : Stand Alone STARTTIME: Sun Apr 26 10:22:46 EDT 2009 STATUS : ONLINE LINEV : 123.0 Volts LOADPCT : 24.0 Percent Load Capacity BCHARGE : 100.0 Percent TIMELEFT : 144.5 Minutes MBATTCHG : 5 Percent MINTIMEL : 3 Minutes MAXTIME : 0 Seconds SENSE : Medium LOTRANS : 097.0 Volts HITRANS : 138.0 Volts ALARMDEL : Always BATTV : 26.8 Volts LASTXFER : Low line voltage NUMXFERS : 0 TONBATT : 0 seconds CUMONBATT: 0 seconds XOFFBATT : N/A SELFTEST : NO STATFLAG : 0x07000008 Status Flag MANDATE : 2003-05-08 SERIALNO : JB0319033692 BATTDATE : 2001-09-25 NOMINV : 120 NOMBATTV : 24.0 FIRMWARE : 8.g6 .D USB FW:g6 APCMODEL : Back-UPS RS 1500 END APC : Sun Apr 26 17:22:32 EDT 2009 Status Report FieldsThe meaning of the above variables are:
Logging the STATUS InformationIf specified in the configuration file, the STATUS data will also be The first case is to set up your syslog.conf file so that the data The second case is to setup your syslog.conf file so that the Although we mention system logging of STATUS information, we Shutdown SequenceIf you experienced so problems with the testing procedures, or if The shutdown sequence is as follows:
This final step is important if you want to ensure that your system # See if this is a powerfail situation. # ***apcupsd*** if [ -f /etc/apcupsd/powerfail ]; then # ***apcupsd*** echo # ***apcupsd*** echo "APCUPSD will now power off the UPS" # ***apcupsd*** echo # ***apcupsd*** /etc/apcupsd/apccontrol killpower # ***apcupsd*** echo # ***apcupsd*** echo "Please ensure that the UPS has powered off before rebooting" # ***apcupsd*** echo "Otherwise, the UPS may cut the power during the reboot!!!" # ***apcupsd*** echo # ***apcupsd*** fi # ***apcupsd*** The above code must be inserted as late as possible in the halt If you are not able to insert the above code in your halt script Only if you cannot insert the appropriate code in the halt script, A very important consideration is that you must set the EEPROM in When using a USB connection, apcupsd automatically sets this value Shutdown ProblemsObviously if your halt script is not properly modified, apcupsd Master/Slave ShutdownIn master/slave configurations, however, the master cannot be 100 Also, on a slave machine, you do not want to use the modified halt One possible problem during shutdown can be caused by remnants of StartupNormally, apcupsd is automatically started when
où path is normally /etc/rc.d or /etc/rc.d/init.d depending on
The APC UPS The start of this chapter of the apcupsd manual in HTML format was La descriptionHere's the information on the elusive APC smart signaling protocol RS-232 differencesNormal 9 pin serial connections have TxD on 3 and RxD on 2. APC's The Smart ProtocolDespite the lack of official information from APC, this table has The following table describes the single character "Code" or
Dip switch info
Status bitsThis is probably the most important register of the UPS, which
Alert messagesThese single character messages are sent by the UPS any time there
Register 1All bits are valid on the Matrix UPS. SmartUPS models only support
Register 2Matrix UPS models report bits 0-5. SmartUPS models only support
Register 3All bits are valid on the Matrix UPS and 3rd generation SmartUPS
Interpretation of the Old Firmware RevisionThe Old Firmware Revision is obtained with the "V" command, which Old Firmware revision and model ID String for SmartUPS & MatrixUPS This is a three character string XYZ where X == Smart-UPS or Matrix-UPS ID Code. range 0-9 and A-P 1 == unknown 0 == Matrix 3000 5 == Matrix 5000 the rest are Smart-UPS and Smart-UPS-XL 2 == 250 3 == 400 4 == 400 6 == 600 7 == 900 8 == 1250 9 == 2000 A == 1400 B == 1000 C == 650 D == 420 E == 280 F == 450 G == 700 H == 700XL I == 1000 J == 1000XL K == 1400 L == 1400XL M == 2200 N == 2200XL O == 3000 P == 5000 where Y == Possible Level of Smart Features, unknown??? G == Stand Alone T == Stand Alone V == ??? W == Rack Mount where Z == National Model Use Only Codes D == Domestic 115 Volts I == International 230 Volts A == Asia ?? 100 Volts J == Japan ?? 100 Volts Interpretation of the New Firmware RevisionNew Firmware revision and model ID String in NN.M.L is the format where NN == UPS ID Code. 12 == Back-UPS Pro 650 13 == Back-UPS Pro 1000 52 == Smart-UPS 700 60 == SmartUPS 1000 72 == Smart-UPS 1400 where NN now Nn has possible meanings. N == Class of UPS 1n == Back-UPS Pro 5n == Smart-UPS 7n == Smart-UPS NET n == Level of intelligence N1 == Simple Signal, if detectable WAG(*) N2 == Full Set of Smart Signals N3 == Micro Subset of Smart Signals where M == Possible Level of Smart Features, unknown??? 1 == Stand Alone 8 == Rack Mount 9 == Rack Mount where L == National Model Use Only Codes D == Domestic 115 Volts I == International 230 Volts A == Asia ?? 100 Volts J == Japan ?? 100 Volts M == North America 208 Volts (Servers) EEPROM ValuesUpon sending a ^Z, your UPS will probably spit back approximately #uD43132135138129uM43229234239224uA43110112114108 .... It looks bizarre and ugly, but is easily parsed. The # is some kind
Then it's followed by the choices, and it starts over. Matrix-UPS models have ## between each grouping for some reason. Here is an example broken out to be more readable: CMD DFO RSP FSZ FVL u D 4 3 127 130 133 136 u M 4 3 229 234 239 224 u A 4 3 108 110 112 114 u I 4 3 253 257 261 265 l D 4 3 106 103 100 097 l M 4 3 177 172 168 182 l A 4 3 092 090 088 086 l I 4 3 208 204 200 196 e 4 4 2 00 15 50 90 o D 1 3 115 o J 1 3 100 o I 1 3 230 240 220 225 o M 1 3 208 s 4 4 1 H M L L q 4 4 2 02 05 07 10 p 4 4 3 020 180 300 600 k 4 4 1 0 T L N r 4 4 3 000 060 180 300 E 4 4 3 336 168 ON OFF CMD == UPSlink Command. u = upper transfer voltage l = lower transfer voltage e = return threshold o = output voltage s = sensitivity p = shutdown grace delay q = low battery warning k = alarm delay r = wakeup delay E = self test interval DFO == (4)-all-countries (D)omestic (I)nternational (A)sia (J)apan (M) North America - servers. RSP == Total number possible answers returned by a given CMD. FSZ == Max. number of field positions to be filled. FVL == Values that are returned and legal. Programming the UPS EEPROMThere are at this time a maximum of 12 different values that can be
The first two cases (Ident and Batt date) are somewhat special in In each case, you indicate to the UPS that you want to change the The UPS will respond by "OK" and approximately 5 seconds later by a Click to rate this post! [Total: 0 Average: 0] |
Commentaires
Laisser un commentaire