Difference between revisions of "Uninterruptable Power Supply/fr"

From SME Server
Jump to navigationJump to search
Line 51: Line 51:
 
====Serial Connection====
 
====Serial Connection====
  
<ol><li>Find the configuration details for your model of UPS. Refer to: http://www.networkupstools.org/stable-hcl.html and make note of the driver name and upstype number (if any) in the third column.  
+
<ol><li>Find the configuration details for your model of UPS. Refer to: http://www.networkupstools.org/stable-hcl.html and make note of the driver name and upstype number (if any) in the third column.  
  
{{Warning box|Always use the serial cable supplied with the UPS. Standard serial cables won't work with a serial UPS and have been known to cause damage to the UPS. Pay particular attention to any references to cable in in the UPS Model column.}}
+
{{Warning box|Always use the serial cable supplied with the UPS. Standard serial cables won't work with a serial UPS and have been known to cause damage to the UPS. Pay particular attention to any references to cable in in the UPS Model column.}}
  
 
</li><li>From the console issue the following commands:
 
</li><li>From the console issue the following commands:
Line 141: Line 141:
  
 
====Droits d'administrateur ASI====
 
====Droits d'administrateur ASI====
Vous devriez vérifier votre nouveau mot de passe (AdminPass) pour exécuter '''upserw''' et '''upscmd'''. Bien sûr, vous pouvez changer votre mot de passe pour un mot de passe plus facile à utiliser.
+
Vous devriez vérifier votre nouveau mot de passe (AdminPass) pour exécuter '''upsrw''' et '''upscmd'''. Bien sûr, vous pouvez changer votre mot de passe pour un mot de passe plus facile à utiliser.
  
 
  config show nut
 
  config show nut
Line 189: Line 189:
 
Une ASI esclave peut accéder avec UPS@192.168.1.1 (IP de l'ASI maître).
 
Une ASI esclave peut accéder avec UPS@192.168.1.1 (IP de l'ASI maître).
  
===Setting UPS Variables===
+
====Réglages des variables de l'ASI====
In order to set UPS variables it is necessary to have enabled the administrative privileges as above first and you get the possibility to run command from slave ups if access is set to private as above.
+
Afin de définir les variables de l'ASI, il est nécessaire d'avoir d'abord activé les privilèges administratifs comme ci-dessus et vous avez la possibilité d'exécuter une commande à partir de l'onduleur esclave si l'accès est défini sur « private » comme ci-dessus.
  
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
+
Dans les exemples ci-dessous, on suppose que le nom de votre ASI est '''UPS''', qu'elle est locale, que l'utilisateur administrateur est '''admin''' et que le mot de passe est '''admin'''. Vous pouvez vérifier votre nom d'ASI par :
 
  upsc -l
 
  upsc -l
  
To view a complete list of the UPS variables, both informational and modifiable
+
Pour voir une liste complète des variables de l'ASI, à la fois informationnelles et modifiables :
 
  upsc UPS
 
  upsc UPS
  
To determine the modifiable variables for your UPS, their current settings and their available setting values execute the command:
+
Pour déterminer les variables modifiables de votre ASI, leurs valeurs actuelles et leurs valeurs de réglage possibles, exécutez la commande :
 
  upsrw UPS
 
  upsrw UPS
  
You can now modify the variables you wish using a command similar to the following (Note the order of the arguments is important, and you may need quotes around the value being set, "20"):
+
Vous pouvez maintenant modifier les variables souhaitées à l'aide d'une commande similaire à la suivante (notez que l'ordre des arguments est important et vous aurez peut-être besoin de guillemets autour de la valeur définie, "20") :
 
  upsrw -s battery.charge.low=20 -u admin -p admin UPS
 
  upsrw -s battery.charge.low=20 -u admin -p admin UPS
  
For remote host (slave UPS ), we need to add the IP from master UPS to run command.
+
Pour un hôte distant (ASI esclave), nous aurons besoin d'ajouter l'IP de l'ASI maître pour lancer la commande :
 
  upsrw -s battery.charge.low=20 -u admin -p admin UPS@192.168.2.1
 
  upsrw -s battery.charge.low=20 -u admin -p admin UPS@192.168.2.1
  
Where the value after '''-s''' should be one of the parameters identified by the '''upsrw ups''' command. You can of course verify your changes using    
+
Où la valeur après '''-s''' doit être l'un des paramètres identifiés par la commande '''upsrw ups'''. Vous pouvez, naturellement, vérifier vos modifications en utilisant  :    
 
  upsrw UPS
 
  upsrw UPS
or
+
ou
 
  upsc UPS
 
  upsc UPS
  
After you are done, clean up by disabling the '''upsc''' administrative privileges:
+
À la fin, effectuer un nettoyage en désactivant les privilèges d'administrateur de  '''upsc'''.
{{Warning box|Make sure you understand the meaning or the UPS variables and their available setting options. Verify that your changes meet your intended behaviour!}}
+
{{Warning box|type=Attention : |Assurez-vous de bien comprendre la signification des variables UPS et leurs options de configuration disponibles. Vérifiez que vos modifications correspondent au comportement souhaité !}}
 
 
More information on upsrw can be found at:
 
  
- Manual page: man upsrw
+
Plus d'information sur upsrw peut être obtenue sur la page du manuel :
 +
man upsrw
  
====Issuing UPS Commands====
+
====Émission de commandes à l'ASI====
In order to issue UPS commands it is necessary to have enabled the administrative privileges as above first and you get the possibility to run command from slave ups if access is set to private as above.
+
Pour émettre des commandes à l'ASI, il est nécessaire d'avoir d'abord activé les privilèges administratifs comme ci-dessus et vous avez la possibilité d'exécuter une commande à partir de l'onduleur esclave si l'accès est défini sur « private » comme ci-dessus.
  
In the examples below, it is assumed your UPS name is '''UPS''', that it is local, that the administrative user is '''admin''' and password '''admin'''. You can verify your UPS name via:
+
Dans les exemples ci-dessous, on suppose que le nom de votre ASI est '''UPS''', qu'elle est locale, que l'utilisateur administrateur est '''admin''' et que le mot de passe est '''admin'''. Vous pouvez vérifier votre nom d'ASI par :
 
  upsc -l
 
  upsc -l
  
To view a complete list of available commands for your UPS:
+
Pour voir la liste complète des commandes pour votre ASI :
 
  upscmd -l UPS
 
  upscmd -l UPS
  
You can now issue a command to the localhost UPS with similar to the following:
+
vous pouvez maintenant émettre une commande à l'ASI « localhost » avec une commande similaire à celle-ci :
 
  upscmd -u admin -p admin UPS test.battery.start
 
  upscmd -u admin -p admin UPS test.battery.start
  
For remote host (slave UPS ), we need to add the IP from master UPS to run command.
+
Pour un hôte distant (ASI esclave), nous aurons besoin d'ajouter l'IP de l'ASI maître pour lancer la commande :
 
  upscmd -u admin -p admin UPS@192.168.2.1 test.battery.start
 
  upscmd -u admin -p admin UPS@192.168.2.1 test.battery.start
  
Where the command '''test.battery.start''' is a valid command for your UPS as previously determined by '''upscmd -l UPS'''. Depending upon the command issued you may get broadcast messages and emails relating to and confirming what the UPS is doing.
+
Où la commande '''test.battery.start''' est une commande valide pour votre ASI comme déterminée préalablement par '''upscmd -l UPS'''. En fonction de la commande émise, vous pouvez recevoir des messages diffusés et des courriels concernant et confirmant ce que fait l'ASI.
  
After you are done, clean up by disabling the '''upsc''' administrative privileges:
+
À la fin, effectuer un nettoyage en désactivant les privilèges d'administrateur de  '''upsc'''.
{{Warning box|Before issuing any commands verify what they do for your particular UPS via the relevant documentation and ensure that the command meets your intended behavioural requirement!
+
{{Warning box|type=Attention : |Assurez-vous de bien comprendre la signification des variables UPS et leurs options de configuration disponibles. Vérifiez que vos modifications correspondent au comportement souhaité !
 +
L'émission de commandes pourrait arrêter votre serveur de manière inattendue.}}
  
Issuing commands could shutdown your server unexpectedly!}}
+
Plus d'information sur upscmd peut être obtenue sur la page du manuel :
 +
man upscmd
  
 
</tab>
 
</tab>

Revision as of 17:02, 18 January 2024


Is this article helpful to you?
Please consider donating or volunteering
Thank you!

Alimentation sans interruption - ASI

PythonIcon.png Skill level: Advanced
The instructions on this page may require deviations from standard procedures. A good understanding of linux and Koozali SME Server is recommended.


Introduction

L'objectif principal du projet Network UPS Tools (NUT) est de fournir une surveillance fiable du matériel d'ASI et d'assurer des arrêts sûrs des systèmes connectés.

La configuration par défaut de NUT maintiendra vos systèmes connectés opérationnels jusqu'à ce qu'un état critique de la batterie soit atteint (c'est-à-dire que la batterie soit presque vide), puis mettra hors tension votre serveur/équipement de manière contrôlée. Voir http://www.networkupstools.org/ (en anglais).

Si vous disposez d'un onduleur de marque APC, consultez également Uninterruptable_Power_Supply:APC (en anglais) pour une alternative à l'implémentation ordinaire Koozali SME « Nut ».

Si vous disposez d'une ASI Dell, cela pourrait vous aider Uninterruptable_Power_Supply:LatestGeekery (en anglais).

Configuration par défaut (USB)

La configuration par défaut pour 'NUT' dans le serveur Koozali SME est assurée par les propriétés de la base de données de configuration :

Model  = usbhid-ups
status = disabled
type   = service
Important.png Note :
l'absence d'une propriété 'Master' définit la configuration par défaut comme étant une configuration principale. Il s'agit d'un ASI connectée directement au serveur via un câble USB ou série. Voir plus tard pour le réglage en tant qu'esclave.

Par défaut, NUT est désactivé, c'est qu'il n'y a pas d'ASI connectée.


La plupart des ASI connectées en USB fonctionneront avec ces paramètres par défaut. Si vous utilisez une connexion USB, activez seulement NUT comme suit :

Pour Koozali SME 10, systemd est maintenant en service. Nous avons créé un service générique pour votre commodité :

config setprop nut status enabled
signal-event e-smith-nutUPS-update
systemctl restart nut-server.service
systemctl restart nut-monitor.service
systemctl restart nut.service
config setprop nut status enabled
signal-event post-upgrade
signal-event reboot

Si votre ASI USB ne fonctionne pas correctement OU si vous avez un appareil série, alors suivez les « Options de configuration » ci-après comme requises.

Configuration Options

Not all UPS's are supported by USB or the usbhid-ups driver. However NUT supports many UPS's and can be configured under SME Server easily.

Serial Connection

  1. Find the configuration details for your model of UPS. Refer to: http://www.networkupstools.org/stable-hcl.html and make note of the driver name and upstype number (if any) in the third column.
    Warning.png Warning:
    Always use the serial cable supplied with the UPS. Standard serial cables won't work with a serial UPS and have been known to cause damage to the UPS. Pay particular attention to any references to cable in in the UPS Model column.

  2. From the console issue the following commands: config setprop nut Model <model> config setprop nut Device <device> config setprop nut Type <type> config setprop nut status enabled Where:
    <model> and <type> are the driver name and type number found above.
    <device> is the serial port that the UPS is connected to eg. /dev/ttyS0. It also possible to use a more readable symlink. See HowTo on udev - symlinks for details. Note: The case of Model, Device and Type.
  3. Check: config show nut
  4. Apply changes and restart server: signal-event post-upgrade signal-event reboot Alternatively, without NUT running or requiring a server reboot: signal-event console-save service nut start
  5. Confirm server is communicating with UPS: upsc UPS@localhost Whenever a UPS event occurs Emails are sent to the admin account.

Configuring as a master

edit the file /etc/ups/nut.conf, and modify the line

MODE=netserver

Set configuration values:

config setprop nut access private TCPPort 3493 
expand-template /etc/ups/upsd.conf
expand-template /etc/rc.d/init.d/masq
systemctl restart masq
systemctl restart nut-server 

Configuring as a slave

Set configuration values:

config setprop nut SlaveUPS UPS@192.168.33.11
config setprop nut Master no

Where 192.168.33.11 is your UPS master, that is the computer that is in direct communication with the UPS. The hostname of that computer may also work.

Apply changes and restart server:

signal-event post-upgrade
signal-event reboot 

or (for SME10):

signal-event e-smith-nutUPS-update

Confirm server is communicating with master:

upsc UPS@192.168.33.11

Connecting multiple UPS's

To be added http://bugs.contribs.org/show_bug.cgi?id=629


Warning.png Warning:
Be sure to have e-smith-nutUPS-2.4.0-9.el6.sme.noarch or higher to carry on with these instructions. If you get a lower version, just follow SME8 instruction.

rpm -qa e-smith-nutUPS

If you get NUT running with administrative privileges modification from sme8 instruction, you need to remove the custom template created for this. These variables are taken in charge by the new package.

First you need to delete the custom template file.( This command delete the directory, be sure you don't have personal file present. If the case, delete manualy the file created for administrative privileges )

rm -rf /etc/e-smith/templates-custom/etc/ups/upsd.users

Now, to get upsd to recognise the modification of user, we need to expand the template and reload the upsd configuration

/sbin/e-smith/expand-template /etc/ups/upsd.users
/usr/sbin/upsd -c reload

Variables et commandes ASI

Dans certains cas, vous souhaiterez peut-être modifier les variables de l'onduleur lui-même, telles que le paramètre Low Charge/LOWBATTERY. Cela nécessite l'utilisation de la commande upsrw et les privilèges d'administrateur ASI.

Vous souhaiterez peut-être également contrôler l'onduleur directement à partir de la ligne de commande en émettant des commandes ASI. Cela nécessite l'utilisation de la commande upscmd et les privilèges d'administrateur ASI.

Warning.png Attention :
en général, les données de l'onduleur doivent rester protégées et les modifications ou l'émission de commandes doivent être effectuées avec attention. Si vous souhaitez apporter des modifications aux données ou émettre des commandes, les privilèges d'administrateur peuvent être activés comme ci-dessous et doivent ensuite être désactivés.

Droits d'administrateur ASI

Vous devriez vérifier votre nouveau mot de passe (AdminPass) pour exécuter upsrw et upscmd. Bien sûr, vous pouvez changer votre mot de passe pour un mot de passe plus facile à utiliser.

config show nut

Pour mettre un nouveau mot de passe admin dans la base de données. Le nouveau mot de passe serait admin (changer comme vous voulez) :

config setprop nut AdminPass admin 

Pour activer les droits d'administrateur et exécuter des commandes à l'ASI :

config setprop nut AdminUser enabled

Maintenant, pour que upsd reconnaisse la modification de l'administrateur pour les droits d'administrateur, nous développons le modèle et rechargeons la configuration upsd.

/sbin/e-smith/expand-template /etc/ups/upsd.users
/usr/sbin/upsd -c reload


Important.png Note :
pour désactiver les droits d'administrateur après avoir modifié les paramètres de l'ASI ou effectué les commandes nécessaires, exécutez les commandes :
config setprop nut AdminUser disabled
/sbin/e-smith/expand-template /etc/ups/upsd.users
/usr/sbin/upsd -c reload

Accès à l'ASI

L'accès à l'ASI est contrôlé par les propriétés de la base de données. La propriété par défaut sélectionne « localhost » et donne le droit d'exécuter upsrw et upscmd depuis « localhost » si le privilège d'administrateur est activé comme ci-dessus. Aucune ASI esclave ne peut être connectée dans ce mode. Trois choix sont disponibles pour paramétrer l'accès :

  • « localhost » : l'accès à l'ASI se fait uniquement depuis la machine locale ( ASI maître) ;
  • « private » : l'accès à l'ASI se fait depuis votre machine locale et le réseau local comme défini dans le gestionnaire du serveur ;
  • « public » : l'accès à l'ASI est similaire à « localhost ».


Pour régler les propriétés d'accès dans la base de données (exemple : localhost) :

config setprop nut access localhost  
/sbin/e-smith/expand-template /etc/ups/upsd.conf
 /usr/sbin/upsd -c reload

En mode « localhost » ou « public » (pas d'accès à distance), l'accès à votre ASI est (le nom de l'ASI est UPS) :

UPS@localhost

En mode « private », l'accès à votre ASI est (le nom de l'ASI est UPS) :

UPS@localhost

ou

UPS@192.168.1.1    # (IP de l'ASI maître)

Une ASI esclave peut accéder avec UPS@192.168.1.1 (IP de l'ASI maître).

Réglages des variables de l'ASI

Afin de définir les variables de l'ASI, il est nécessaire d'avoir d'abord activé les privilèges administratifs comme ci-dessus et vous avez la possibilité d'exécuter une commande à partir de l'onduleur esclave si l'accès est défini sur « private » comme ci-dessus.

Dans les exemples ci-dessous, on suppose que le nom de votre ASI est UPS, qu'elle est locale, que l'utilisateur administrateur est admin et que le mot de passe est admin. Vous pouvez vérifier votre nom d'ASI par :

upsc -l

Pour voir une liste complète des variables de l'ASI, à la fois informationnelles et modifiables :

upsc UPS

Pour déterminer les variables modifiables de votre ASI, leurs valeurs actuelles et leurs valeurs de réglage possibles, exécutez la commande :

upsrw UPS

Vous pouvez maintenant modifier les variables souhaitées à l'aide d'une commande similaire à la suivante (notez que l'ordre des arguments est important et vous aurez peut-être besoin de guillemets autour de la valeur définie, "20") :

upsrw -s battery.charge.low=20 -u admin -p admin UPS

Pour un hôte distant (ASI esclave), nous aurons besoin d'ajouter l'IP de l'ASI maître pour lancer la commande :

upsrw -s battery.charge.low=20 -u admin -p admin UPS@192.168.2.1

Où la valeur après -s doit être l'un des paramètres identifiés par la commande upsrw ups. Vous pouvez, naturellement, vérifier vos modifications en utilisant :

upsrw UPS

ou

upsc UPS

À la fin, effectuer un nettoyage en désactivant les privilèges d'administrateur de upsc.

Warning.png Attention :
Assurez-vous de bien comprendre la signification des variables UPS et leurs options de configuration disponibles. Vérifiez que vos modifications correspondent au comportement souhaité !

Plus d'information sur upsrw peut être obtenue sur la page du manuel :

man upsrw

Émission de commandes à l'ASI

Pour émettre des commandes à l'ASI, il est nécessaire d'avoir d'abord activé les privilèges administratifs comme ci-dessus et vous avez la possibilité d'exécuter une commande à partir de l'onduleur esclave si l'accès est défini sur « private » comme ci-dessus.

Dans les exemples ci-dessous, on suppose que le nom de votre ASI est UPS, qu'elle est locale, que l'utilisateur administrateur est admin et que le mot de passe est admin. Vous pouvez vérifier votre nom d'ASI par :

upsc -l

Pour voir la liste complète des commandes pour votre ASI :

upscmd -l UPS

vous pouvez maintenant émettre une commande à l'ASI « localhost » avec une commande similaire à celle-ci :

upscmd -u admin -p admin UPS test.battery.start

Pour un hôte distant (ASI esclave), nous aurons besoin d'ajouter l'IP de l'ASI maître pour lancer la commande :

upscmd -u admin -p admin UPS@192.168.2.1 test.battery.start

Où la commande test.battery.start est une commande valide pour votre ASI comme déterminée préalablement par upscmd -l UPS. En fonction de la commande émise, vous pouvez recevoir des messages diffusés et des courriels concernant et confirmant ce que fait l'ASI.

À la fin, effectuer un nettoyage en désactivant les privilèges d'administrateur de upsc.

Warning.png Attention :
Assurez-vous de bien comprendre la signification des variables UPS et leurs options de configuration disponibles. Vérifiez que vos modifications correspondent au comportement souhaité !

L'émission de commandes pourrait arrêter votre serveur de manière inattendue.


Plus d'information sur upscmd peut être obtenue sur la page du manuel :

man upscmd

UPS Variables and Commands

In some cases you may wish to modify variables on the actual UPS such as the Low Charge/LOWBATTERY setting. This requires the use of the upsrw command and UPS administrative privileges.

You may also want to control the UPS directly from the command line by issuing UPS commands. This requires use of the upscmd command and UPS administrative privileges.

Warning.png Warning:
In general, the UPS data should be left protected and changes to it or issuing of commands well thought out. If you wish to make data changes or issue commands then the administrative privileges can be enabled as below and should then be disabled.

UPS Administrative Privileges

In order to be able to use upsrw and upscmd it is necessary to have a suitable additional user defined in the upsd.users configuration file.

In order to create a suitable user we will use SME Servers templating system and configuration database. This is based on an original forum thread[1].

First we need to create a suitable custom template directory

mkdir -p /etc/e-smith/templates-custom/etc/ups/upsd.users
cd /etc/e-smith/templates-custom/etc/ups/upsd.users

Create and edit a new file called 'admin' with the following content:

{
    # create admin user for upsd to allow setting of
    # UPS parameters via upsrw

    $OUT .= "";
    return unless (($nut{AdminUser} || 'disabled') eq 'enabled');
    return unless (($nut{AdminPass} || '') ne '');

    $OUT .= "\n";
    $OUT .= "       [admin]\n";
    $OUT .= "               password  = $nut{AdminPass}\n";
    if ( ($nut{Master} || 'yes') ne 'no') {
       $OUT .= "               allowfrom = localhost\n";
    } else {
       $OUT .= "               allowfrom = localhost localnet\n";
    }
    $OUT .= "               actions   = set\n";
    $OUT .= "               instcmds  = all\n";
}

Create two new database properties for nut

config setprop nut AdminUser enabled                (This enables the creation of the user in the template above)
config setprop nut AdminPass admin                  (This sets a password for the admin user. Set to whatever you want)

Now, to get upsd to recognise the new user with the required administrative privileges we expand the template and reload the upsd configuration

/sbin/e-smith/expand-template /etc/ups/upsd.users
/usr/sbin/upsd -c reload


Important.png Note:
To disabled the admin user once you have changed the UPS parameters or issued commands as required, issue the commands
config setprop nut AdminUser disabled
/sbin/e-smith/expand-template /etc/ups/upsd.users
/usr/sbin/upsd -c reload

Setting UPS Variables

In order to set UPS variables it is necessary to have enabled a user with administrative privileges as above first.

In the examples below, it is assumed your UPS name is UPS, that it is local, that the administrative user is admin and password admin. You can verify your UPS name via:

upsc -l

To view a complete list of the UPS variables, both informational and modifiable

upsc UPS

To determine the modifiable variables for your UPS, their current settings and their available setting values execute the command:

upsrw UPS

You can now modify the variables you wish using a command similar to the following (Note the order of the arguments is important, and you may need quotes around the value being set, "20"):

upsrw -s battery.charge.low=20 -u admin -p admin UPS

Where the value after -s should be one of the parameters identified by the upsrw ups command. You can of course verify your changes using

upsrw UPS

or

upsc UPS

After you are done, clean up by disabling the upsd administrative user admin:

Warning.png Warning:
Make sure you understand the meaning or the UPS variables and their available setting options. Verify that your changes meet your intended behaviour!

More information on upsrw can be found at:

- Manual page: man upsrw

Issuing UPS Commands

In order to issue UPS commands it is necessary to have enabled a user with administrative privileges as above first.

In the examples below, it is assumed your UPS name is UPS, that it is local, that the administrative user is admin and password admin. You can verify your UPS name via:

upsc -l

To view a complete list of available commands for your UPS:

upscmd -l UPS

You can now issue a command to the UPS with similar to the following:

upscmd -u admin -p admin UPS test.battery.start

Where the command test.battery.start is a valid command for your UPS as previously determined by upscmd -l UPS. Depending upon the command issued you may get broadcast messages and emails relating to and confirming what the UPS is doing.

After you are done, clean up by disabling the upsd administrative user admin:

Warning.png Warning:
Before issuing any commands verify what they do for your particular UPS via the relevant documentation and ensure that the command meets your intended behavioural requirement!

Issuing commands could shutdown your server unexpectedly!


an example to update you battery date upon changing it. (use your own password)

upsrw -s  battery.mfr.date=2020/08/31 -u admin -p admin UPS