UPS Server
การติดตั้ง UPS Server กับ Client หลายตัวแบบ NIS Server (APC UPS)
ต้อง ต่อกันเป็นแบบ NIS แยกเป็น NIS server และ NIS client ตัว NIS server คือ Server (192.168.1.13) ที่มี UPS ต่อผ่านในที่นี่เป็น USB Port ซึ่งจะมีการรับส่งสัญญาณกับ UPS โดยตรง ส่วน NIS client (192.168.1.21) คือ server ที่ไม่มีการต่อผ่าน UPS โดยตรง แต่อาศัยการรับสัญญาณจาก NIS server เท่านั้น ในระบบหนึ่งๆจะมี NIS server เพียงตัวเดียว แต่มี NIS client ที่เป็นสมาชิกได้หลายๆตัว
Download : http://software.susethailand.com/
1. UPS Server ( NIS Server)
# wget http://www.susethailand.com/public/sles/x86_64/apcupsd/apcupsd-3.12.1-18.2.x86_64.rpm
# vim /etc/apcupsd/apcupsd.conf
UPSCABLE usb
UPSTYPE usb
DEVICE
UPSCLASS standalone
UPSMODE disable
NETSERVER on
NISIP 192.168.1.13
NISPORT 3551
# yast runlevel (apcupsd)
2. UPS NIS Client (ต้องติดตั้ง gd package ก่อนนะครับ ติดตั้งจาก YaST)
# wget http://www.susethailand.com/public/sles/x86_64/apcupsd/apcupsd-3.12.1-18.2.x86_64.rpm
# vim /etc/apcupsd/apcupsd.conf
UPSCABLE ether
UPSTYPE net
DEVICE 192.168.1.13:3551
NISPORT 3551
NETSERVER on
UPSMODE disable
# yast runlevel (apcupsd)
3. ทดสอบ NIS Server (192.168.1.13)
# apcaccess status
หากมีข้อความฟ้องว่า
#FATAL ERROR in apcaccess.c at line 243
tcp_open: cannot connect to server localhost on port 3551.
ERR=Connection refused
รอสัก 1 นาที แล้วสั่งคำสั่งเดิมอีกครั้ง
APC : 001,026,0616
DATE : Fri Jul 04 17:20:56 ICT 2008
HOSTNAME : bcscrouter1
RELEASE : 3.12.1
VERSION : 3.12.1 (06 January 2006) suse
UPSNAME : bcscrouter1
CABLE : USB Cable
MODEL : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: Fri Jul 04 16:57:32 ICT 2008
STATUS : ONLINE
BCHARGE : 070.0 Percent
TIMELEFT : 13.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
STATFLAG : 0x07000008 Status Flag
MANDATE : 2003-01-24
SERIALNO :
BATTDATE : 2003-01-24
NOMBATTV : 12.0
APCMODEL :
END APC : Fri Jul 04 17:21:57 ICT 2008
ตรวจสอบ Logfile
# tail -f /var/log/apcupsd.events
Fri Jul 04 16:59:52 ICT 2008 apcupsd 3.12.1 (06 January 2006) suse startup succeeded
4. ทดสอบที่ NIS Client (192.168.1.21)
# apcaccess status
APC : 001,026,0616
DATE : Fri Jul 04 17:24:57 ICT 2008
HOSTNAME : bcscrouter1
RELEASE : 3.12.1
VERSION : 3.12.1 (06 January 2006) suse
UPSNAME : bcscrouter1
CABLE : USB Cable
MODEL : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: Fri Jul 04 16:57:32 ICT 2008
STATUS : ONLINE
BCHARGE : 070.0 Percent
TIMELEFT : 13.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 seconds
CUMONBATT: 0 seconds
XOFFBATT : N/A
STATFLAG : 0x07000008 Status Flag
MANDATE : 2003-01-24
SERIALNO :
BATTDATE : 2003-01-24
NOMBATTV : 12.0
APCMODEL :
END APC : Fri Jul 04 17:25:58 ICT 2008
ตรวจสอบ Logfile
# tail -f /var/log/apcupsd.events
Communications with UPS restored.
command :
#apctest
#ps fax | grep apcupsd
#apcaccess status
--------------------------------------------------------------------------------------------
Log Slave: tail -f /var/log/apcupsd.events
--------------------------------------------------------------------------------------------
Setting up and Testing the CGI Programs
https://192.168.1.13/cgi-bin/multimon.cgi
Not available: upsfetch: tcp_open failed for 127.0.0.1 port 3551
--------------------------------------------------------------------------------------------
Solution :
1. Firewall
find : function set_basic_rules()
# vim /sbin/SuSEfirewall
# APCUPS
$IPTABLES -A INPUT -i eth1 -p tcp -m tcp --dport 3551 --syn -j ACCEPT
2. hosts
# vim /etc/apcupsd/hosts.conf
Comment
# MONITOR 127.0.0.1 "Local Host"
Additional
MONITOR 192.168.1.13:3551 "Server"
Test again : https://192.168.1.13/cgi-bin/multimon.cgi
เป็นอันเสร็จครับ.
อ้างอิจจาก :http://www.apcupsd.org/manual/manual.html#SECTION000131000000000000000

SUSE Linux Enterprise Cool Solutions
|













