can not edit /etc/fstab
พอดี มี server อยู่ตัวนึงเป็น redhat enterprise 5 ( โหลดมาใช้ตั้งแต่ Redhat เปิดให้ download แรก ๆ นู่น) มัน boot ไม่ขึ้น
Checking filesystems
/:Resize inode not valid.
/:UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY
(i.e., without -a or -p options)
*** An error occurred during the file system check.
*** Dropping you to a shell; the system will reboot
*** When you leave the shell.
Give root password for maintenance
(or type Control-D to continue):
เนื่องจาก มันเช็ค file system แล้วผิดปกติ ประมาณ not clean อะไรประมาณนี้ ที่นี้เราจะแก้ไข /etc/fstab แต่มันเป็น read only ทำให้เราไม่สามารถแก้ไขได้ ถ้ามันขึ้นแบบนี้แล้วให้ใส่ password root
จากนั้นเข้า single mode ด้วยคำสั่ง init 1
#mount -n -o remount /
แค่นี้ก็แก้ fstab แล้ว
** ไม่ได้ทำบ่อย ๆ ก็ลืมได้ ขอ blog ไว้หน่อย
uptime
ไม่มีอะไรมากเอา uptime ของ Labtop ที่ใช้งานอยู่ ก็เป็น winXP นี่แหละ ที่ uptime ขนาดนี้ก็เพราะว่าไม่เคย reboot เลย ( hibernate ตลอด) นาน ๆ ถึงจะ reboot ทีนึง แต่ปกติไม่เคยเกิน 10 วันก็ reboot แล้ว

ส่วนอีกอันเป็น server ตัวนึงที่อยู่ในความดูแลไม่เคย reboot มาปีนึงและ

ที่เอามาเขียนใน blog เพราะว่าอยากเก็บไว้เป็นที่ระลึก แค่นั้นเอง
Network Management using Nagios
ลองลง Nagios บน Debian จริง ๆ ไปเจอ manual ใน sourceforge แต่เป็นของ Ubuntu แ่ต่ก็ใช้กันได้เพราะ Debian เป็นต้นกำเนิดของ Ubuntu (http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html)
apt-get install apache2
apt-get install build-essential
apt-get install libgd2-xpm-dev
1) create account for nagios
/usr/sbin/useradd nagios
passwd nagios
Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -G nagcmd nagios
/usr/sbin/usermod -G nagcmd www-data
2)Download nagios and the Plugins ไว้ที่ไหนก็ได้ง่าย ๆ ก็ /usr/local/src
wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nagios-3.0.tar.gz
wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
3) Compile and Install Nagios
tar xzf nagios-3.0.tar.gz
cd nagios-3.0
./configure –with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install
make install-init
make install-config
make install-commandmode
4) Customize Configuration
config file ของ nagios ที่เรา compile อยู่ที่ /usr/local/nagios/etc/
ให้เราแก้ไข email address ที่อยู่ในไฟล์
vi /usr/local/nagios/etc/objects/contacts.cfg
ตรง yourmail@yourdomain ให้เป็น mail ของเราที่ต้องการให้ alert แจ้ง
5) Configure the Web Interface
make install-webconf
และให้ทำการสร้าง user สำหรับ web interface ในที่นี้ให้เป็น user nagiosadmin โดยใช้คำสั่ง
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
จากนั้นจะให้เรากรอก password ของ nagiosadmin
6) Compile and Install the Nagios Plugins
cd /usr/local/src
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure –with-nagios-user=nagios –with-nagios-group=nagios
make
make install
7) Start Nagios
สร้าง link ให้ nagios start ทุกครั้งเมื่อมีการ reboot
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
ตรวจสอบ file config ของ nagios โดยใช้คำสั่ง
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ถ้าไม่มี error ก็ให้ start Nagios
/etc/init.d/nagios start
8) ลอง Login ผ่านหน้าเว็บ http://ipaddress/nagios/
ลองคลิกที่ service detail
โดยรวมแล้วน่าใช้กว่า cacti







