Pages

Showing posts with label Fedora. Show all posts
Showing posts with label Fedora. Show all posts

Monday, 6 August 2012

Compiling Nmon Under RHEL / CentOS / Fedora / Scientific Linux


Compiling Nmon Under RHEL / CentOS / Fedora / Scientific Linux

   wget http://ncu.dl.sourceforge.net/project/nmon/lmon14g.c
   wget http://ncu.dl.sourceforge.net/project/nmon/makefile

yum install ncurses-devel

mv lmon14g.c lmon.c

Open the makefile and find the the directive that matches your platform and Linux release:

vi makefile

make nmon_x86_rhel52

You can move nmon_x86_rhel52 to /usr/local/sbin, enter:

mv nmon_x86_rhel52 /usr/local/sbin/nmon

How do I set default monitoring options for nmon?

To see the memory, network, disk and processor statistics immediately after the nmon command is started, run (or add in your shell startup file):

# export NMON=mndc

Run the nmon command:

# nmon

Capturing and analyzing data with nmon

You can capture the data to a file for later analysis and graphing. Type the following command:
# nmon -f -s2 -c 30

OR
# nmon -ft -s 30 -c 120


Wednesday, 1 August 2012

What happens when a device is plugged in?


What happens when a device is plugged in?

Many times device Plug-in related questions comes in our mind . These questions specially arises when we face challenges to block certain device on the server , or block certain devices for certain users . Let me explain my understanding on this topic.

For newly Plugged-in device , given below steps take place


1. Kernel detect the Plug-in device and export device status to sysfs. You can view exported state via mounted /sys virtual filesystem.


2. Kernel then notify udev about this event via netlink socket.


3. udev process the user-configurable rules (present in /etc/udev/rules.d) and creates device file in /dev.


4. After creating device node , udev notify hald about the event via the socket.


5. HAL probes the device for information.


6. The device object structure populates with the probed information.


7. HAL broadcast Plug-in event.


8. A user-space application then process the information.


In this complete process , We can add our custom hook in udev rules . For example suppose you want to notify administrator via mail about any usb storage device insertion on the system, we can do that by udev rules. In coming posts ,I will explain about writing udev rules.
Twitter Bird Gadget