lm-semsors
ที่ทำเนี่ยเพราะว่า มี server อยู่ตัวนึงเอาไป co-location ไว้ที่ ISP เจ้านึงแต่ปรากฏว่า เข้าไปได้วันเดียวก็ล่มแล้วล่มอีกจนไม่แน่ใจว่าตกลง network หรือ hardware ของเรามีปัญหากันแน่ก็เลยตัดสินใจลง lm-sensors นี่แหละเขียนไว้เผื่อทำอีกกันลืมนะครับ
ใน ubuntu มี apt-get อยู่แล้วเลยทำให้ทุกอย่างง่ายมั๊กๆ
1. ติดตั้ง lm-sensors ซะก่อน
apt-get install lm-sensors
สำหรับคนที่ไม่ใช้ user root ซึ่งส่วนใหญ่เขาก็ไม่ใช้กันยกเว้นผมอย่าลืม sudo ไว้ด้านหน้าด้วยนะครับ
2. พอลงแล้วก็สร้าง script ชื่อ mkdev.sh อ่ะแล้วใส่ข้างในด้วย script ต่อไปนี้ครับ
#!/bin/bash
# Here you can set several defaults.
# The number of devices to create (max: 256)
NUMBER=32
# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600
# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
if grep -q "/dev devfs" /proc/mounts ; then
echo "You do not need to run this script as your system uses devfs."
exit;
fi
fi
i=0;
while [ $i -lt $NUMBER ] ; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i || exit
chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
i=$[$i + 1]
done
#end of file
# Here you can set several defaults.
# The number of devices to create (max: 256)
NUMBER=32
# The owner and group of the devices
OUSER=root
OGROUP=root
# The mode of the devices
MODE=600
# This script doesn't need to be run if devfs is used
if [ -r /proc/mounts ] ; then
if grep -q "/dev devfs" /proc/mounts ; then
echo "You do not need to run this script as your system uses devfs."
exit;
fi
fi
i=0;
while [ $i -lt $NUMBER ] ; do
echo /dev/i2c-$i
mknod -m $MODE /dev/i2c-$i c 89 $i || exit
chown "$OUSER:$OGROUP" /dev/i2c-$i || exit
i=$[$i + 1]
done
#end of file
ใส่ไว้ใน root ก็ได้ครับ script นี้ก็ก๊อปเขามาอ่ะสร้างเสร็จแล้วก็ chmod 755 มันด้วยนะครับ
chmod 755 mkdev.sh
แล้วก็รัน script
./mkdev.sh
อย่าลืม sudo นะผมไม่ต้องใส่เพราะใช้ user root จะบอกทำไมหลายรอบเนี่ย -_-"
3. จากนั้นก็สั่งให้มัน detect hardware
sudo sensors-detect
อ่ะรอบนี้ใส่มันซะเลยจะได้ไม่ต้องเตือนคนอ่านอีก sudo เนี่ย ตอบ Yes มันให้หมดเลยนะครับ
มันจะบอกว่าเจออารัยบ้างถ้าไม่แน่ใจให้ไปดูใน /etc/modules
แล้ว add probe ให้มัน
sudo modprobe i2c-xxxxxx
sudo modprobe i2c-xxxxxx
sudo modprobe i2c-xxxxxx
sudo modprobe it87
sudo modprobe i2c-xxxxxx
sudo modprobe i2c-xxxxxx
sudo modprobe it87
xxxxxx ดูจากใน /etc/module หรือที่มันบอกว่าเปนชื่ออารัยนะครับ
แล้วก็พิมพ์
sudo depmod -a
sudo update-modules
sudo update-modules
ไม่รู้ว่าทำไมมันไม่บอกไว้
ลอง test ด้วยคำสั่ง sensors
# sensors
V1.5: +2.467 V (min = +1.42 V, max = +1.58 V) ALARM
VCore: +1.479 V (min = +1.48 V, max = +1.63 V) ALARM
V3.3: +3.373 V (min = +3.13 V, max = +3.47 V)
V5: +5.000 V (min = +4.74 V, max = +5.26 V)
V12: +11.734 V (min = +11.38 V, max = +12.62 V)
CPU_Fan: 2299 RPM (min = 4000 RPM) ALARM
fan2: 0 RPM (min = 0 RPM)
fan3: 1057 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU: +41.50°C (low = +10°C, high = +50°C)
Board: +35.25°C (low = +10°C, high = +35°C)
Remote: +35.50°C (low = +10°C, high = +35°C) ALARM
CPU_PWM: 144
Fan2_PWM: 112
Fan3_PWM: 112
vid: +1.550 V (VRM Version 9.0)
V1.5: +2.467 V (min = +1.42 V, max = +1.58 V) ALARM
VCore: +1.479 V (min = +1.48 V, max = +1.63 V) ALARM
V3.3: +3.373 V (min = +3.13 V, max = +3.47 V)
V5: +5.000 V (min = +4.74 V, max = +5.26 V)
V12: +11.734 V (min = +11.38 V, max = +12.62 V)
CPU_Fan: 2299 RPM (min = 4000 RPM) ALARM
fan2: 0 RPM (min = 0 RPM)
fan3: 1057 RPM (min = 0 RPM)
fan4: 0 RPM (min = 0 RPM)
CPU: +41.50°C (low = +10°C, high = +50°C)
Board: +35.25°C (low = +10°C, high = +35°C)
Remote: +35.50°C (low = +10°C, high = +35°C) ALARM
CPU_PWM: 144
Fan2_PWM: 112
Fan3_PWM: 112
vid: +1.550 V (VRM Version 9.0)
ถ้าขึ้นปามานนี้ก็ถือว่า ok ละครับแล้วก้ reboot มันก็จะเสร็จสมบูรณ์
จบครับเรื่องแรกของผม
ปล. ไม่ได้คิดขึ้นมาเองครับเอามาจาก