General :: Script To Find Disk Utilized Processes?
May 25, 2011
I have written a script that triggers a mail if the server load average goes beyond a specific value.
The mail contains following field Current Load average. Top 10 CPU utilized processes.
Code:
ps -auxf | sort -nr -k 3 | head -10
Top 10 Memory Utilized processes.
Code:
ps -auxf | sort -nr -k 4 | head -10
But the problem is that whenever there is any disk related activity happens the load gets high and the command (for ex.mkfs.ext3 /dev/sdb1, dd,scp,cp)which are the main cause behind the load average doesnt get displayed in top 10 CPU/Memory Utilized processes.
Is there any way of finding top 10 processes for Disk related activity?
My system just crashed with a message that the /tmp space was full, and now after rebooting I can't login to gnome.
I hit ALT-F1 to get to the command prompt and logged in and ran "df" and I noticed that my root partition is 100% full. /tmp is part of the root partition. I deleted everything in /tmp but it wasn't much stuff.
I have a separate partition for /boot and /home and a separate swap partition.
Can someone please help me get logged in again!? pretty please
It is a 12GB partition, that should be more than enough for the root partition...
At the time of the crash, I was playing with "incron" a utility which monitors the file system. It was supposed to act upon the creation of a new file in /media/Data (which is not part of the / partition). The action was that it should copy using rsync any new files in that location to a backup on another disk. I ended my statement with ";" because other statements in incrontab were ended that way... i wonder if it rsynced to my root partition because of that...?
Is there a command to check specific processes that's using the most IO/disk usage? I know sar and ps but I want more specific details on IO on individual processes
I am developing a daemon that is acting up and I am now unable to create any new processes (ie. I cannot start a new process to kill the other rogue processes). So, I need to be able to kill the processes from a remote machine. How do I do "kill" remotely without admin privileges? If I cannot kill my own process from a remote machine as a normal user then tell me so I can mark it as the correct answer.
I have a linux server top reports about 9GB of swap used:But I cannot figure where's it use swap, some google results said that top - O commad follow by p will show swap usage by process. But as shown in the above image, taking a brief sum of the SWAP column shows that > 10GB of swap is used, so where does the 9GB figure for swap usage come from? Top reports that about 96492kb of ram is used by buffers. Is there anything I can do to utilize this, instead of using swap?
My problem is, firefox (3.6.12 and 4.0 beta 7) freezes for seconds/minutes and enters in disk sleep state (the usb-storage process too). My system is an EeePC 701, openSUSE 11.3 x86, with the /home and swap partitions on a SD card.
Many processes enter in disk sleep mode and stops (Hang) and return to work after 10 to 20 seconds.
In System Monitor i get "Disk Sleep" like this:
My PC specifications: Ram: 4GB Hard Disk: 1024GB Processor: AMD Athlon II X2 Display: ATI HD 4670 Motherbord: Gigabyte System: openSUSE 11.2 x86_64
The problem still exists after system update and i try run other distributions like kubuntu and i don't get this error. I also change Hard Disk but the problem is still ongoing.
I want to find the cumulative CPU time used by each process between two points (defined by the user, e.g. running a command or clicking a button).
A first stab at this would be running
Code: ps -eo pid,cputime
at the beginning of the interval and at the end, then doing some arithmetic on the two sets of results. But this only shows whole seconds of cputime ... and what about processes that started and stopped during the interval?
I'm in the process of writing a program that is a server- it will accept connections and stuff, and spawn a child process for each. However, i've run into a small problem. I do NOT want to bother with keeping track of the processes unless i need to. So, i set SA_NOCLDWAIT (#ifdef) on a SIG_IGN to the SIGCHLD handler through sigaction interface. The standard says that it the kernel will then keep track of reaping zombie processes for me (a HUGE plus). However, upon receiving a SIGINT signal, i want to stop the server from accepting new connections (done), and then wait for there to be no new connections. I was thinking of just putting a loop like so:
However, I'm not *sure* that this will work, especially with SIGCHLD still ignored. So how can i tell if there are still child processes? I can't find any call like int getnumchld(pid_t proc); (i wish). Plus it would be inefficient to spin on that function anyway. OTOH, i would rather *NOT* have to do the same thing in a loop with a system("ps |...>file"); read(file); etc. either. Is there a way i can portably implement this feature (I was hoping i could run it on linux and the major BSDs, at least).
TO SUM IT UP:
How can i tell if a process has no child processes if i've SIG_IGN'd SA_NOCLDWAIT'd the SIGCHLD? Is there a _reasonably_ portable way to do so? I *don't* want to manually wait for EVERY process. Maybe only those still active at the time of SIGTERM, but that requires keeping track of the number of connections and whether those have terminated...
EDIT: Does anyone know if the above code *would* work, even with SIGCHLD ignored and the kernel cleaning up zombies *for* me? I checked the manpage and it doesn't say much.
EDIT1: Note that all of the processes are in the same process group and session. SO i can find them through this as well. Perhaps even setting the uid/gid and finding all processes run by that group?
EDIT2: i have an idea if the above isn't feasible. If there is no "elegant" way to do it, i could reduce the complexity by sending a SIGUSR1 to the whole process group. Each process would then set a flag telling it to send a SIGUSR1 in reply and send a SIGUSR2 when it is done executing. Then i could keep a count of signals. Maybe that would be *easier*. Or perhaps a count of all child processes and just a termination signal to decrement the counter.
i have installed ubuntu version 9 and i cant seem to find where hard disk partitions are,what do i do?also what do i do to install the webcam and to change from gnome to Kde enviroment!!i also installed virtualbox but i seem not to find the icon
How do I check my hard disk Revolutions Per Minute (RPM) speed from a Linux shell prompt without opening my server case?
I referenced some other articles. they give only model number, serial number and disk space, but I need Hard disk RPM speed using shell script. any other Java program
I created a VM disk image with kvm-img, but I forget what was the max size of that disk image when I created it. Currently, its size is 6.2G, I want to install some large packages in that VM, so I want to make sure the disk image can expand to an adequate size.
I am in the process of re-DL-ing the ISO as the checksums didn't match.
Mind you, that was with a shell extension in Win-Lose. Who knows.
Anyway:
I have the ISO (that I had previously) on a USB courtesy of UNetBootIn. All appears well until, quite quickly, I receive an error after the loading process which goes something like:
Code: Error: cannot find disk at [hash-code - looks like 0ace5f etc etc, is about 12 char's in length.]Something very similar (but not same error I think) happened when I tried to do the same with my OpenSolaris or Fedora install. I.e., gets as far as the very beginning of the loader and then: bork.
At least one of them said "will reboot in 120 secs". Saves me the trouble!
I have mentions of ata1 and ata8 in my messages log, like "ata8: hard resetting link" How does one map ata8 to a real disk?
I can not find anything in /dev/disk, not fdisk or lshw. The only way I found was grepping through dmesg and you get a serial which you can then use lshw to find out. But is this the only way?
I had this error when installing and running a vncserver before, which I have now removed. However, the xterm's seem to remain in the system and are regenerating themselves. Should the pid IDs stay the same each time I run this?
I need to create a small list of processes in a monitor.conf file. A shell script needs to check the status of these processes and restart if they are down. This shell script needs to be run every couple of minutes.
The output of the shell script needs to be recorded in a log file.
So far I have created a blank monitor.conf file. I have gotten the shell script to automatically updated every couple of minutes The Shell script also sends some default test information to the log file.
how I go about doing this part ? A shell script needs to check the status of these processes and restart if they are down.
I have put in the conf file the below commands but I am not sure if this is right.
ps ax | grep httpd ps ax | grep apache
I also dont know if the shell script should read from the conf file or if the conf file should send information to the shell script file.
Virtual box says one of its OS's is inaccessible. The other ones are all right.
Code: Could not find a hard disk with UUID {a7d99ada-aeab-45bb-ba33-5eab6659fa25} in the media registry ('/home/eric/.VirtualBox/VirtualBox.xml'). Result Code: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001) Component: VirtualBox Interface: IVirtualBox {3f36e024-7fed-4f20-a02c-9158a82b44e6}
Looked in /dev/disk/by-uuid on the host, Debian Lenny, if that is relevant, and there is nothing like the above UUIDs.
I know that you can modify the nice value of a particular process as follows:renice 19 -p 4567However, now I would be interested to set the renice value of ALL active processes.I am coming from the Win world so what I tried warenice 19 -p *Of course it is not working... Anyone a quick solution how to do that in Linux?