ติดตั้ง nut บน ubuntu

ใช้ได้กับ ups เกือบทุกยี่ห้อ รวมทั้งยี่ห้อ apc ด้วย
หากใช้ยี่ห้อ apc ขอแนะนำให้ใช้โปแกรม apcuspd แทน ตามคำแนะนำที่บันทึก ติดตั้ง apcupsd บน ubuntu
ตอนไฟดับ ระบบสั่งปิดเครื่องได้อย่างเดียว ตอนไฟมา ups เปิดตัวเองไม่เป็น เราต้องมาเปิด ups ด้วยตนเอง
ทดสอบกับ ubuntu 10.04
ต้นฉบับจาก http://www.networkupstools.org/

ติดตั้งโปรแกรม nut ด้วยคำสั่ง  sudo apt-get install nut nut-cgi

แก้ไขแฟ้ม   /etc/nut/ups.conf  ให้ถูกต้องตามรุ่นของ ups ดูข้อมูลเพิ่มเติมจากเวบ http://www.networkupstools.org/compat/stable.html

ตัวอย่างสำหรับ ups ยี่ห้อ apc รุ่น Back-UPS RS แบบ usb  ข้อมูลแฟ้ม /etc/nut/ups.conf เป็นตามตัวอย่างประมาณว่า
[myups]
        driver = usbhid-ups
        port = auto
        desc = "My Test UPS"

ตัวอย่างสำหรับ ups ยี่ห้อ ablerex รุ่น 625L แบบ usb  ข้อมูลแฟ้ม /etc/nut/ups.conf เป็นตามตัวอย่างประมาณว่า
[myups]
        driver = megatec_usb
        port = auto
        desc = "My Test UPS"

แก้ไขแฟ้ม /etc/nut/uspd.users เพิ่มข้อมูลให้เป็นประมาณว่า
[monuser]
password = changeme
upsmon master

แก้ไขแฟ้ม /etc/nut/upsmon.conf   เพิ่มข้อมูลให้เป็นประมาณว่า
MONITOR myups@localhost 1 monuser changeme master
...

แก้ไขแฟ้ม /etc/nut/nut.conf  แก้ไขข้อมูลจากเดิม
MODE=none
ให้เป็นว่า
MODE=standalone

ถึงขั้นตอนนี้ให้รีบูท server ใหม่  แล้วสั่งให้ nut ทำงานด้วยคำสั่ง  sudo /etc/init.d/nut restart
แล้วทดสอบดูผลงานด้วยตัวอย่างคำสั่ง upsc myups@localhost  ได้ผลประมาณว่า
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2005/06/20
battery.runtime: 1950
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 26.9
battery.voltage.nominal: 24.0
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.2.1-
driver.version.data: APC HID 0.92
driver.version.internal: 0.32
input.transfer.high: 264
input.transfer.low: 194
input.voltage: 224.0
input.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: -1
ups.firmware: 7.g8 .I
ups.firmware.aux: g8
ups.load: 29
ups.mfr: American Power Conversion
ups.mfr.date: 2005/06/20
ups.model: Back-UPS RS 1000
ups.productid: 0002
ups.serial: QB0525144498
ups.status: OL
ups.test.result: No test initiated
ups.vendorid: 051d

เป็นอันว่าใช้งานได้

หากต้องการแสดงผลแบบ graphic ผ่าน cgi ให้ทำดังนี้

แก้ไขแฟ้ม /etc/nut/hosts.conf  เพิ่มข้อมูลให้เป็นประมาณว่า
MONITOR myups@localhost "Back-UPS RS 1000"

ดูผลงานได้ที่  http://localhost/cgi-bin/nut/upsstats.cgi