En la sección anterior hemos definido ya los sensores, para esta parte del articulo es necesario en especial la temperatura, ya que será mediante las lecturas de uno o varios de los termómetros con los que podremos controlar los ventiladores.
Siempre que se juega con los ventiladores y las temperaturas si se hace sin cuidado se corre riesgo de dañar el hardware de modo que cada uno lo hace bajo su propia responsabilidad.
Por ejemplo podremos definir que el ventilador del micro gire a diferentes velocidades o se pare completamente según la temperatura del micro, y hacer lo mismo de manera independiente para el chipset o la caja, en este caso puesto que el servidor que vemos solo tiene un ventilador y un sensor de temperatura será una configuración básica.
Mediante el comando "pwmconfig" ejecutaremos el asistente de configuración que nos permitirá definir umbrales, temperaturas, velocidades, etc. para poder ejecutarlo tiene que estar parado el servicio de control de ventiladores, para ello ejecutamos el comando:
/etc/init.d/fancontrol stop
Después ejecutamos pwmconfig que generara el fichero de configuración que utilizara el demonio fancontrol, primero para cada ventilador detectará según la potencia suministrada las velocidades de giro, así como con que potencia deja de funcionar y con que potencia empieza a hacerlo:
servidor:~# /etc/init.d/fancontrol stop
pwmconfig
This program will search your sensors for pulse width modulation (pwm)
controls, and test each one to see if it controls a fan on
your motherboard. Note that many motherboards do not have pwm
circuitry installed, even if your sensor chip supports pwm.
We will attempt to briefly stop each fan using the pwm controls.
The program will attempt to restore each fan to full speed
after testing. However, it is ** very important ** that you
physically verify that the fans have been to full speed
after the program has completed.
Found the following devices:
hwmon0/device is it8718
Found the following PWM controls:
hwmon0/device/pwm1
hwmon0/device/pwm2
hwmon0/device/pwm3
Giving the fans some time to reach full speed...
Found the following fan sensors:
hwmon0/device/fan1_input current speed: 4720 RPM
hwmon0/device/fan2_input current speed: 0 ... skipping!
hwmon0/device/fan3_input current speed: 0 ... skipping!
Warning!!! This program will stop your fans, one at a time,
for approximately 5 seconds each!!!
This may cause your processor temperature to rise!!!
If you do not want to do this hit control-C now!!!
Hit return to continue:
Testing pwm control hwmon0/device/pwm1 ...
hwmon0/device/fan1_input ... speed was 4720 now 0
It appears that fan hwmon0/device/fan1_input
is controlled by pwm hwmon0/device/pwm1
Would you like to generate a detailed correlation (y)?
PWM 255 FAN 994
PWM 240 FAN 2311
PWM 225 FAN 3497
PWM 210 FAN 4299
PWM 195 FAN 4066
PWM 180 FAN 3835
PWM 165 FAN 3552
PWM 150 FAN 3308
PWM 135 FAN 3040
PWM 120 FAN 2766
PWM 105 FAN 2454
PWM 90 FAN 2177
PWM 75 FAN 1829
PWM 60 FAN 1500
PWM 45 FAN 0
Fan Stopped at PWM = 45
Testing pwm control hwmon0/device/pwm2 ...
hwmon0/device/fan1_input ... speed was 4720 now 4623
no correlation
No correlations were detected.
There is either no fan connected to the output of hwmon0/device/pwm2,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)
Did you see/hear a fan stopping during the above test (n)?
Testing pwm control hwmon0/device/pwm3 ...
hwmon0/device/fan1_input ... speed was 4720 now 4530
no correlation
No correlations were detected.
There is either no fan connected to the output of hwmon0/device/pwm3,
or the connected fan has no rpm-signal connected to one of
the tested fan sensors. (Note: not all motherboards have
the pwm outputs connected to the fan connectors,
check out the hardware database on http://www.almico.com/forumindex.php)
Did you see/hear a fan stopping during the above test (n)?
Testing is complete.
Please verify that all fans have returned to their normal speed.
En este punto ya sabemos lo más importante que es el umbral en el que el ventilador instalado es capaz de arrancar y cuando se para completamente, 6o y 45 respectivamente, ahora toca decidir el ventilador que vamos a configurar, como solo tenemos uno lo elegimos:
The fancontrol script can automatically respond to temperature changes
of your system by changing fanspeeds.
Do you want to set up its configuration file now (y)?
What should be the path to your fancontrol config file (/etc/fancontrol)?
Loading configuration from /etc/fancontrol ...
Select fan output to configure, or other action:
1) hwmon0/device/pwm1 3) Just quit 5) Show configuration
2) Change INTERVAL 4) Save and quit
select (1-n): 1
Ahora seleccionamos el sensor de temperatura, en el que basaremos el control del ventilador, como en este caso solo uno da valores reales (temp3) será ese el seleccionado:
Devices:
hwmon0/device is it8718
Current temperature readings are as follows:
hwmon0/device/temp1_input-55
hwmon0/device/temp2_input-2
hwmon0/device/temp3_input35
Select a temperature sensor as source for hwmon0/device/pwm1:
1) hwmon0/device/temp1_input
2) hwmon0/device/temp2_input
3) hwmon0/device/temp3_input
4) None (Do not affect this PWM output)
select (1-n): 3
Por último seleccionamos las temperaturas y potencias umbral, que son las siguientes:
- Temperatura mínima a la que el ventilador se pondrá en marcha. En mi caso 30º.
- Temperatura máxima a la que el ventilador se pondrá a toda potencia. En mi caso dejo la que hay por defecto 60º.
- Potencia a la que el ventilador empieza a girar, según las pruebas anteriores 60.
- Potencia a la que el ventilador se para, según las pruebas anteriores es 45.
- Potencia a suministrar cuando estamos por debajo de la temperatura mínima, lo dejamos por defecto de manera que cuando estemos por debajo de 30º no se suministre potencia al ventilador.
- Potencia a suministrar cuando estamos por encima de la temperatura máxima, lo dejamos por defecto 255 para que gire a tope, mejor que haga mucho ruido a que se nos quemen los componentes.
Enter the low temperature (degree C)
below which the fan should spin at minimum speed (0): 30
Enter the high temperature (degree C)
over which the fan should spin at maximum speed (60):
Enter the minimum PWM value (0-255)
at which the fan STARTS spinning (press t to test) (150): 60
Enter the minimum PWM value (0-255)
at which the fan STOPS spinning (press t to test) (100): 45
Enter the PWM value (0-45) to use when the temperature
is below the low temperature limit (0):
Enter the PWM value (45-255) to use when the temperature
is over the high temperature limit (255):
Select fan output to configure, or other action:
1) hwmon0/device/pwm1 3) Just quit 5) Show configuration
2) Change INTERVAL 4) Save and quit
select (1-n): 4
Saving configuration to /etc/fancontrol...
Configuration saved
Al acabar y guardar la configuración ya podemos arrancar el demonio de control de ventiladores, además nos aseguraremos que esta configurado para arrancar de forma automática con el servicio, usaremos los comandos siguientes:
/etc/init.d/fancontrol start
update-rc.d fancontrol defaults
El fichero de configuración del demonio fancontrol es "/etc/fancontrol" y tras esta configuración quedo así:
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
FCTEMPS= hwmon0/device/pwm1=hwmon0/device/temp3_input
FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input
MINTEMP= hwmon0/device/pwm1=30
MAXTEMP= hwmon0/device/pwm1=60
MINSTART= hwmon0/device/pwm1=60
MINSTOP= hwmon0/device/pwm1=45