Monitoring & Updating • Objectives – to be aware of Unix monitoring utilities • Contents – look at utilities for monitoring the system – what to monitor & why – monitoring with sar – reconfiguring the kernel – patching kernel – lilo & grub • Practical – to examine monitoring output • Summary
23
Embed
Monitoring & Updating Objectives –to be aware of Unix monitoring utilities Contents –look at utilities for monitoring the system –what to monitor & why.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Monitoring & Updating
• Objectives– to be aware of Unix monitoring utilities
• Contents– look at utilities for monitoring the system
– what to monitor & why
– monitoring with sar
– reconfiguring the kernel
– patching kernel
– lilo & grub
• Practical– to examine monitoring output
• Summary
Why Use Monitoring?
• Monitoring is useful for benchmarking a system
• If the system appears slow or sluggish– use monitoring to look for problems
– too many processes or users
– disk activity concentrated on one disk
• Users complain that system isn't as good as it used to be– gather performance data for a period of time
– compare with benchmarks
• Analysing monitoring statistics is subjective– there are no hard and fast absolutes
– data has to be compared over a period of time
What Do We Monitor?
• Process (CPU) activity– monitor processor loading
– know the most processor-hungry programs
• Disk access (I/O) activity– understand how your applications use storage devices
– observe I/O activity and its distribution
– know the most I/O intensive programs
• Memory utilisation– weigh amount memory against number of users and what they do
– minimise swapping and paging activity
– monitor kernel tables: don't allow them to overflow
• Network activity– learn the 'nEtiquette'
– don't load the network with activities which should be performed locally
• All of the above means: KNOW YOUR SYSTEM
System Activity Reporter (sar)• Use sar to monitor the system
– can look at current system performance
– can look at historical data collected via cron jobs in files/var/log/sa/sadd and /proc
• Install SuSE package sysstat to get sar
• Collects data on cpu, disk, memory, paging etc.– over the next few slides we will see examples of sar reports
• Compare values over a period of time (days or weeks)– system monitoring is an iterative process
– often when you attempt to cure one bottleneck, new problem is introduced
• Output not immediately meaningful
• Not provided by all Unix systems – on BSD based systems (and AIX) look for vmstat
– vmstat uses different options and reports, but provides the same kind of information
• 3 ways of getting the kernel:– From http://www.kernel.org as tar-ball (for generic linux system)– From SuSE using YAST installing kernel-source package.– From SuSE RPM files.
• Get needed packages and development enviroment1. First check current version of running kernel with uname –r
In my case I had: 2.6.11.4-20a2. Install the enviroment if it is not already there (needed in all cases):
• Find out ALL about your hardwareCPU type Graphics board and chipsetsMemory SCSI controllersMotherboard chipsets Audio controllersNetwork cards Other installed hardware
Kernel source home
• Carefully read the kernel documentation/usr/src placeholder of kernel and rpm sources
/usr/src/linux link to linux[-kernel-version]
/usr/src/linux.vanilla link to linux, needed for patches
/usr/src/linux/Documentation Linux kernel doc’s
• To make a generic custom kernelDownload latest kernel source from: http://www.kernel.org
Download needed patches from same site or distributor site.
• If needed apply patches4. Backup old kernel source tree somewhere and then cd to /usr/src
5. Unpack kernel as it is under /usr/src/
6. Make a link called linux.vanilla -> /usr/src/linuxkernel-whatever
7. Apply patches, for example alan cox ac found in people at kernel.org
There can be vendor specific patches as well. Patch order is important.
Apply Kernel patches, if needed• If no kernel patches, skip step 7, goto the dry run!• Apply the patches, kernel source tree
For a compressed patch, enter the following command : 7a. cd /usr/src/linux-whatever 7b. zcat /tmp/patch-whatever | patch -p1 2> outAccordingly the command for an uncompressed patch is 7b. patch -p1 < /tmp/patch-whatever 2> out
• Allways ”dry run” first time on new kernels– Make a dry run compile, helps up, sometimes kernel wont compile if this step is omitted)8a. cd linux.vanilla8b. cp .configure configure.orig (Backup your old configuration, if exist)9. zcat /proc/config.gz > .config (Get the running kernel configuration, good start point)10. make oldconfig (11. make mrproper) for non rpm kernel sources.12. make clean13. make bzImage14. make modules
DONT install anything yet!
Ways to configure the kernel• Add our EXTRAVERSION to separate the new kernel from current/old
– First edit the /usr/src/linux.vanilla/Makefile.to be able separating your kernel compiling attempts :EXTRAVERSION = -ac-IKEA1
• Backup the .config file– First time this file does not exist, backup after you run the make config above
cp .config config.old
• Installing the running kernel .config is a good startpoint in most caseszcat /proc/config.gz > .config make oldconfig
• Normal ”config steps” and how the ".config" file is made– Current running kernel config options is in /proc/config.gz – If .config does not exist, a generic config will be used with your new kernel– .config is created if it does not exist or modified if it exists when configuring the kernel with one of
these make options:• make oldconfig -use .config as template without questions• make config -classic config for text terminals (much coffe is needed)• make menuconfig -modern vt100/ansi terminals• make xconfig -X-Windows GUI
• General config options inside the ”menues”– M=module Y=Yes, static and N=No skip– Modules are loaded into kernel when needed Static is there all the time
Kernel options, while configuring
• Depending on your #make config# choice– We recommend using the make menuconfig or make xconfig
– You will be presented a large menu, where you are supposed to select proper kernel support for various hardware and inner kernel workings.
– Static selections will consume more memory but will respond fast
– Dynamic Module will consume less memory but will respond slower
– Filesystem for booting must be static, or system will not load, they live in initrd
• You must now walk through all menu’s– To see what you can disable
– To see what you need to support as static or module
– Add support for at least what you found in ”Find out ALL about your hardware”
• Now it is time for step 15, enter the kernel configuration:15. make menuconfig (or some other shown like make xconfig)
Adding support for 3comNIC example
• Walk to: ”Network device support --->” Hit enter on ”Select”
Walk down to ”Ethernet (10 or 100Mbit) --->”
Hit enter on ”Select”
Walk down to ”3COM cards”
Press spacebar to check/open 3COM cards
Walk down to ” 3c590/3c900 series (592/595/597) "Vortex/Boomerang" support”
press spacebar or m or y to select or n to deselect
Now you have added this card to .config file!
You can move with arrows to exit and exit up to main menu again.
• Walk around exactly like this to select any other– This can take long time, read about all devices you add support
– It is well worth the trouble, optimized kernels offer from 3% up to 40% preformance increase
– Dont forget why we are here, we want to add support for our hardware!
Make the new kernel
• Exit the configuration sectionWalk back to main menu and move to exit
Press enter
Question will come up if you want to save
Select YES
• Not nessesary step, configure dependencies type:16. make dep (make clean or make distclean erases .config)
• Extraversion will be added to output kernel nowlinux-2.6.11.4-20a-ac-IKEA1
• Compile A New gzipped Kernel image type:17. make clean ; make bzImage
bzImage will hide itself in the kernel source tree!
• Build The Kernel's loadable Modules type:18. make modules
Install the new kernel• Install the Kernel Modules
19. export INSTALL_PATH=/boot make install
20. make modules_install
- All modules will copy to /lib/modules/kernelversion
• Copy The New Kernel To The /boot Partition21. make install
- The new kernel is copied to /boot
- The new System.map is copied to /boot
- Check that they are really copied into /boot
- The old kernel should still be there in /boot and the new with your subversion added
• Depending on how you boot your linux– INITRD initial run demon, a miniroot system on ram disk.
– INITRD is used to boot on raid, or special net boots
• Read the GRUB documentation before continueIf you did the make install, and use GRUB, the new configuration is already added and the
old GRUB configuration is named menu.lst.old
• To manually add/check entry for your new kernel in /boot/menu.1st:In top of menu.1st, change to:default=1
After first ”title” bofore the next ”title” add a new title for the new kernel to auto start:title Linux (2.6.11.4-20a-ac-IKEA1) root (hd0,0) kernel /boot/vmlinuz-2.6.11.4-20a-ac-IKEA1 ro root=/dev/sda1 initrd /boot/initrd-2.6.11.4-20a-ac-IKEA1.img
• Reboot and test new kernelreboot
• GRUB is popular in modern workstations and some high end systems
Creating BOOT floppy for your kernel
• Make bootfloppies for your system the SuSE wayInsert a floppy and type:
yast bootfloppy
– You will be offered to make various boot floppies (select rescue)
• Test your rescue diskreboot your linux with disk system should start on floppy and load the rest from your harddisks.
Kernel afterwork• Add APC UPS driver
– We added alan cox patch to our kernel in order to support UPS USB
– Now we need to compile the main driver for UPS control
Prepare compiling APC UPS driver:
cd /usr/src/extras/apcupsd-whatever
export CFLAGS="-g -Wall“; export LDFLAGS="-g -Wall“; make distclean