Wednesday, September 14, 2011

Munin คืออะไร และการติดตั้ง munin

Munin คืออะไร และการติดตั้ง munin

Munin ก็คือ web mornitoring ตัวหนึ่ง ที่เอาไว้ดูสถานะของเครื่องเรา และเครื่อข่าย ผ่าน บน http port 80  ซึ่ง Monitoring นั้นก็มีหลายตัวให้เลือกใช้ไม่ว่าจะเป็น NagiOS   MRTG Zenoss CACTI สามารถดูรายระเอียดได้มากน้อยแต่ต่างกัน สามารถเลือกได้ตรงตามความต้องการ แต่เจ้า munin นั้นจะมีรายละเอียดคือ Apache Disk Mysql Network Processes Sendmail Sensors System
หลังจากติดตั้ง เสร็จรอสักพัก 5-10 นาทีลอง refesh ดู โดย http://localhost/munin

 

 

การติดตั้ง munin 
จากที่ผมได้ทดสอบติดตั้งทดลองสาม OS นี้

CentOS
cd /root

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

yum install munin munin-node
chkconfig --levels 235 munin-node on
/etc/init.d/munin-node start
chown -R munin:munin /var/www/munin
ln -s /var/www/munin/ /var/www/html/munin
service httpd restart && service crond restart
ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/
/etc/init.d/munin-node restart

หลังจากติดตั้ง แล้ว สามารถเข้าไปดูได้โดย http://yourdomain.com/munin

 

Debian
# aptitude install munin

#sudo apt-get install munin

ส่วน package ต่อไปนี้ระบบจะจัดการติดตั้งให้เอง gawk, libio-multiplex-perl, libnet-cidr-perl, libnet-server-perl, libnet-snmp-perl, librrd4, librrds-perl, munin, munin-node,rrdtool

 

สำหรับ fedora ผมลอง fedora 9

สำหรับเครื่อง fedora  นั้นผมเทสแบบ VirtualHost แบบ user dir (/home/*/html) เช่น /home/user1  /home/user2 แต่หลังจากติดตั้งแล้ว munin ก็จะยังคงอยู่ที่
/var/www/html/munin ส่วน munin.conf จะอยู่ที่  etc/munun จึงจำเป็นต้องเซ็ต Alias เอา

yum -y install munin*
vi /etc/httpd/conf/httpd.conf

เพิ่ม Alias

Alias /munin "/var/www/html/munin"
<Directory "/var/www/html/munin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

#service httpd restart
# /etc/rc.d/init.d/munin-node start
#chkconfig munin-node on

Test
http://localhost/munin



* localhost-df-day.png (19.18 KB, 501x331 - ดู 903 ครั้ง.)

วิธีติดตั้ง Munin ใน Centos 5

เริ่มแรก ก็อัพเดท Server ก่อนเลย
1. yum update
2. wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
3. rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
4. yum install munin munin-node
5. chkconfig ?levels 235 munin-node on
6. /etc/init.d/munin-node start
7. chown -R munin:munin /var/www/munin
8. ln -s /var/www/munin /var/www/html/munin
9. service httpd restart && service crond restart
เสร็จแล้วครับ ทดสอบเข้าดูผ่าน
http://IP/munin หากเข้าได้ ก็ถือว่าผ่านแล้วครับ

ติดตั้ง munin บน Centos VPS

wget http://packages.sw.be/rpmforge...ease-0.3.6-1.el5.rf.x86_64.rpm 
rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rm -f rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
yum install munin munin-node
chkconfig --levels 235 munin-node on
/etc/init.d/munin-node start
/etc/munin/munin.conf
mkdir -p /var/www/html/munin
chown munin:munin /var/www/html/munin


เอาสูตรผมไปบ้าง 

โค๊ด:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
yum install munin munin-node
chkconfig –levels 235 munin-node on
/etc/init.d/munin-node start
chown -R munin:munin /var/www/munin
ln -s /var/www/munin /var/www/html/munin
service httpd restart && service crond restart
ln -s /usr/share/munin/plugins/apache_* /etc/munin/plugins/
/etc/init.d/munin-node restart

ถ้าเปิด server-status เรียบร้อยแล้ว ก็รอครับ อับเดทครั้งหน้าจะมีกราฟขึ้นเองครับ

: )


มาแล้วจริงๆ ด้วย

ขอบคุณคุณ iPokz มากๆ ค่ะ และท่านอื่นๆ ด้วยนะคะ
 
 

นติดตั้ง munin บน Centos VPS

เคยลองติดตั้งบน kloxo อ่ะค่ะ แต่ก็งงๆ เพราะดูได้ไม่ค่อยครบ

ตอนนี้มี VPS อีกตัวหนึ่ง เป็น Centos DirectAdmin

แต่ไม่รู้วิธีติดตั้งชัวร์ๆ เลยอยากถามว่า พอจะมีใครแนะนำได้ไหมคะ

ขอบคุณค่ะ


 Copy ไปได้เลยครับ ถ้าเป็น OS แบบ 64Bit

rpm -Uvh http://download.fedora.redhat....64/epel-release-5-4.noarch.rpm  
yum -y install munin munin-node 
chkconfig munin-node on
mkdir -p /var/www/html/munin 
chown munin. /var/www/html/munin 
mv /var/www/html/munin/.htaccess /var/www/html/munin/htaccess.default 
service munin-node start


จากนั้นเวลาเข้าดูให้เข้าดูผ่าน http://Server-IP/munin  


Operating System เป็นแบบนี้อ่ะค่ะ CentOS 5.5 32 bit

 rpm -Uvh http://download.fedora.redhat....86/epel-release-5-4.noarch.rpm
yum -y install munin munin-node 
chkconfig munin-node on
mkdir -p /var/www/html/munin 
chown munin. /var/www/html/munin 
mv /var/www/html/munin/.htaccess /var/www/html/munin/htaccess.default 
service munin-node start

Tuesday, March 22, 2011

Linux Tips : การติดตั้งแพ็กเกจด้วย Yum

Yum ย่อมาจาก
ใช้ติดตั้งแพ็กเกจบนลีนุกซ์
การติดตั้งแพ็กเกจ
# yum install mc [enter]
ตอบ y [enter]
การติดตั้งแพ็กเกจครั้งละหลายๆ แพ็กเกจ
# yum install httpd php mysql mysql-server php-mysql phpmyadmin [enter]
ตอบ y [enter]
การถอนแพ็กเกจออกจากระบบ
# yum remove mc [enter]

ดูข้อมูลเกี่ยวกับ hard disk บน linux

  • ทดสอบกับ ubuntu 8.0.4


  1. ใช้คำสั่ง  lshw  ตามคำแนะนำใน ดูข้อมูลเกี่ยวกับ hardware ของ PC บน linux

  2. ดูข้อมูลเกี่ยวกับ partition ของ hard disk  ใช้คำสั่ง sudo fdisk -l  ได้ผลตัวอย่างประมาณว่า
    Disk /dev/sda: 41.1 GB, 41110142976 bytes
    255 heads, 63 sectors/track, 4998 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0xc241c241

    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *           1        4787    38451546   83  Linux
    /dev/sda2            4788        4998     1694857+   5  Extended
    /dev/sda5            4788        4998     1694826   82  Linux swap / Solaris

    บรรทัดแรก ข้อความว่า Disk /dev/sda: 41.1 GB  หมายถึง hard disk ชื่อ /dev/sda มีความจุ 41.1 GB
    บรรทัดล่างๆที่ขึ้นต้นว่า /dev/sda? หมายถึงการจัด partition ต่างๆ ของ hard disk นี้


  3. ดูข้อมูลการใช้พื้นที่ของ hard disk  ใช้คำสั่ง  df -h ได้ผลตัวอย่างประมาณว่า
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sda1              19G  2.6G   16G  14% /
    varrun                250M   60K  250M   1% /var/run
    varlock               250M     0  250M   0% /var/lock
    udev                  250M   44K  250M   1% /dev
    devshm                250M     0  250M   0% /dev/shm

    บรรทัดที่สอง ข้อความว่า  /dev/sda1  19G  2.6G   16G  14% /
    หมามถึง partition  /dev/sda1 มีขนาด 19 G ใช้ไปแล้ว 2.6 G เหลืออีก 16 G หรือประมาณ  14 %  ถูก mount เป็นพื้นที่ /

  4. ดูข้อมูล swap ของ hard disk ใช้คำสั่ง  cat /proc/swaps  ได้ผลตัวอย่างประมาณว่า
    Filename                Type        Size    Used    Priority
    /dev/sda5                partition   377488    132    -1

    บรรทัดที่สอง ข้อความว่า  /dev/sda5  partition 377488  132 -1
    หมายถึง partition /dev/sda5 ถูกทำเป็น swap มีขนาด 377,488  Kbytes ใช้ไปแล้วจำนวน 132  Kbytes

  5. หากต้องการดูอุณหภูมิการทำงานของ hard disk ต้องติดตั้ง smartmontools ตามคำแนะนำใน ติดตั้ง_smartmontools_บน_ubuntu
    แล้ว ใช้คำสั่งตัวอย่างประมาณว่า sudo smartctl -A /dev/sda|grep "Temperature_Celsius"

  6. ดูข้อมูล uuid ของ hard disk ด้วยคำสั่ง  ls -l /dev/disk/by-uuid

Monday, March 21, 2011

Linux Command Reference รวมคำสั่งลีนุกซ์บางส่วนที่เป็นประโยชน์

คำสั่งหน้าที่รายละเอียด
File/Directory Basics
lsList filesแสดงรายชื่อไฟล์และไดเร็คทอรี่
cpCopy filesสำเนาไฟล์
mvRename filesเปลี่ยนชื่อไฟล์
rmDelete filesลบไฟล์
lnLink filesสร้างไฟล์เชื่อมโยง
cdChange directoryย้ายไปยังไดเร็คทอรี่ที่ต้องการ
pwdPrint current directory nameแสดงชื่อไดเร็คทอรี่ปัจจุบัน
mkdirCreate directoryสร้างไดเร็คทอรี่ใหม่
rmdirDelete directoryลบไดเร็คทอรี่ (ที่ว่างเปล่าเท่านั้น)
File Viewing
catView filesดูเนื้อหาของ text file
lessPage trough filesเลื่อนดูเนื้อหาของไฟล์
headView file beginningแสดงส่วนต้นของไฟล์
tailView files endingแสดงส่วนท้ายของไฟล์
nlNumber linesแสดงหมายเลขบรรทัด
odView binary filesแสดงเนื้อหาในไฟล์ไบนารี่
xxdView binary filesแสดงเนื้อหาในไฟล์ไบนารี่
gvView Postscript/PDF filesแสดงไฟล์แบบโพสต์สคริปต์หรือ PDF
xdviView TeX DVI filesแสดงไฟล์รูปแบบ TeX
File Creation and Editing
emacsText editorโปรแกรมแก้ไขข้อความของ GNU
vimText editorโปรแกรมแก้ไขข้อความที่ปรับปรุงจาก vi
umaskSet default file protectionsแสดง/กำหนดค่าสำหรับคำนวณค่า permission mode
sofficeEdit Word/Excel/PowerPoint docsแก้ไขไฟล์เอกสาร Word/Excel/PowerPoint
abiwordEdit Word documentsแก้ไขเอกสาร Word
gnumericEdit Excel documentsแก้ไขเอกสาร Excel
File Properties
statDisplay file attributesแสดงสถานะ/สถิติ/คุณลักษณะของไฟล์
wcCount bytes/words/linesนับจำนวนอักขระ คำ บรรทัด
duMeasure disk usageแสดงปริมาณการใช้เนื้อที่ไดเร็คทอรี่
fileIdentify file typesแสดงชนิดของไฟล์
touchChange file timestampsเปลี่ยนค่าเวลาของไฟล์
chownChange file ownerเปลี่ยนชื่อเจ้าของไฟล์
chgrpChange file groupเปลี่ยนชื่อกรุ๊ปเจ้าของไฟล์
chmodChange file protectionsเปลี่ยนระดับการป้องกันไฟล์
chattrChange advanced file attributesเปลี่ยนคุณลักษณะของไฟล์ในขั้นสูง
IsattrList advanced file attributesแสดงคุณลักษณะของไฟล์ในขั้นสูง
File Location
findLocate filesค้นหาตำแหน่งของไฟล์
slocateLocate files via indexค้นหาตำแหน่งของไฟล์ด้วยฐานข้อมูลดัชนี
whichLocate commandsค้นหาคำสั่ง
whereisLocate standard filesค้นหาไฟล์มาตรฐาน
File Text Manipulation
grepSearch text for matching linesค้นหาข้อความในระดับบรรทัด
cutExtract columnsคัดแยกคำโดยระบุตำแหน่ง
pasteAppend columnsเชื่อมต่อไฟล์ในแนวระนาบ
trTranslate charactersแปลงข้อความ
sortSort linesจัดเรียงข้อความระดับบรรทัด
uniqLocate indentical linesรวมบรรทัดที่เหมือนกัน
teeCopy stdin to file and to stdout simultaneouslyสำเนาข้อความออกทางไฟล์และ stdout พร้อมๆ กัน
File Compression
gzipCompress files (GNU Zip)บีบอัดไฟล์ให้เป็น .gz
CompressCompress files (Unix)บีบอัดไฟล์แบบมาตรฐาน Unix
bzip2Compress files (BZip2)บีบอัดไฟล์ให้เป็น .bz2
zipCompress files (Windows Zip)บีบอัดไฟล์สำหรับ WinZip
File Comparison
diffCompare files line by lineเปรียบเทียบไฟล์ในระดับบรรทัด
commCompare sorted filesเปรียบเทียบไฟล์ที่ผ่านการเรียงข้อมูลมาแล้ว
cmpCompare files byte by byteเปรียบเทียบไฟล์ระดับไบต์
md5sumCompute Checksumsคำนวณหาค่า md5 ของไฟล์
Disks and Filesystems
dfShow free disk spaceรายงานขนาดดิสก์ที่เหลืออยู่
mountMake a disk accessibleเชื่อมต่ออุปกรณ์จัดเก็บข้อมูลเข้าสู่ระบบ
fsckCheck a disk for errorsตรวจสอบแก้ไขความผิดปรกติของเนื้อที่ดิสก์
syncFlush disk cachesเขียนข้อมูลในแคชกลับคืนสู่ดิสก์
Backups and Remote Storage
mtControl a type driveควบคุมเทป
dumpBack up a diskสำรองข้อมูลจากดิสก์
restoreRestore a dumpนำข้อมูลที่สำรองไว้กลับคืนที่เดิม
tarRead/write type archivesจัดเก็บไฟล์ให้รวมกันไว้ที่เดียว
cdrecordBurn a CDเขียนไฟล์ลงสู่แผ่นซีดี
rsyncMirror a set of filesสำรองข้อมูลระหว่างโฮสต์
Printing
lprPrint filesส่งไฟล์ไปพิมพ์ที่เครื่องพิมพ์
lpqView print queueเปิดดูลำดับงานพิมพ์ที่ค้างอยู่
lprmRemove print jobsยกเลิกงานพิมพ์ที่ค้างอยู่
Spelling Operations
lookLook up spellingเปิดสารบัญคำศัพท์
aspellCheck spelling interactivelyตรวจคำสะกดว่าถูกต้องหรือไม่
spellCheck spelling in batchตรวจคำถูกผิดในไฟล์จำนวนมาก
Processes
psList all processesแสดงโปรเซสทั้งหมด
wList users' processesแสดงรายชื่อยูสเซอร์ที่กำลังใช้งานโปรเซส
uptimeView the system loadแสดงปริมาณภาระของระบบ
topMonitor processesแสดงข้อมูลเกี่ยวกับโปรเซสแบบต่อเนื่อง
xloadMonitor system loadแสดงภาระของระบบในแบบกราฟฟิก
freeDisplay free memoryแสดงปริมาณหน่วยความจำประเภทต่างๆในปัจจุบัน
killTerminate processesส่งรหัสควบคุมไปยังโปรเซส
niceSet process prioritiesตั้งค่าระดับความสำคัญให้โปรเซส
reniceChange process prioritiesปรับระดับความสำคัญของโปรเซส
Scheduling Jobs
sleepWait for some time หน่วงเวลา
watchRun programs at set intervalsรันโปรแกรมซ้ำในระยะเวลาที่กำหนด
atSchedule a jobตั้งเวลารันกลุ่มคำสั่ง
crontabSchedule repeated jobsตั้งเวลารันคำสั่งเป็นรอบเวลาที่กำหนด
Hosts
unamePrint system informationแสดงรายละเอียดของระบบปฏิบัติการ
hostnamePrint the system's hostnameแสดง/กำหนดชื่อโฮสต์
ifconfigSet/display network informationแสดง/กำหนดค่าเกี่ยวกับเครือข่าย
hostLook up DNSสืบค้นชื่อและไอพีของโฮสต์ในระบบ DNS
whoisLookup domain registrantsสืบค้นข้อมูลการจดทะเบียนโดเมน
pingCheck if host is reachableทดสอบการตอบสนองของโฮสต์ปลายทาง
tracerouteView network path to a hostตรวจสอบเส้นทางไปสู่โฮสต์ปลายทาง
Networking
sshSecurely log into remote hostsเข้าสู่โฮสต์จากระยะไกล (มีการเข้ารหัสข้อมูล)
telnetLog into remote hostsเข้าสู่โฮสต์จากระยะไกล(ไม่มีการเข้ารหัส)
scpSecurely copy files between hostsสำเนาไฟล์ระหว่างโฮสต์(มีการเข้ารหัสข้อมูล)
stfpSecurely copy files between hostsบริการโอนถ่ายไฟล์ระหว่างโฮสต์(มีการเข้ารหัสข้อมูล)
ftpCopy files between hostsบริการโอนถ่ายไฟล์ระหว่างโฮสต์(ไม่มีการเข้ารหัสข้อมูล)
evolutionGUI email clientโปรแกรมใช้งานอีเมล์แบบกราฟฟิก
muttText-based email clientโปรแกรมใช้งานอีเมล์แบบ text
mailMinimal email clientคำสั่งรับส่งอีเมล์ขนาดเล็กมาก
mozillaWeb browserโปรแกรมเว็บบราวเซอร์แบบกราฟฟิก
lynxText-only web browserโปรแกรมเว็บบราวเซอร์แบบ text
wgetRetrieve web pages to diskดาวน์โหลดข้อมูลเว็บมาสู่ดิสก์
slrnRead Usenet newsอ่านข่าวใน usenet
gaimInstant messaging/IRCโปรแกรมรับส่งข้อความ
talkLinux/Unix chatคำสั่งรับส่งข้อความโต้ตอบ
writeSend messages to a termainalคำสั่งส่งข้อความไปยังจอภาพอื่น
mesgProhibit talk/writeเปิด/ปิดการรับข้อความจากคำสั่ง write
Audio and Video
gripPlay CDs and rip MP3sเล่นแผ่นซีดีเพลงและแปลงเป็นไฟล์ MP3
xmmsPlay audio filesเล่นไฟล์เสียงชนิดต่างๆ
cdparanoiaRip audioแปลงแทร็กเพลงให้เป็นไฟล์
audacityEdit audioปรับแต่ง/แก้ไขไฟล์เสียง
xcdroastBurn CDsบันทึกข้อมูล/แทร็กเสียงลงแผ่นซีดี

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | free samples without surveys