![]() ![]() usage-plot.gp top.dat top. While true do top -p $PID -bMn 1 | egrep '^+' | awk -v now=$(date +%s) '' > top.dat done unix time - memory with m/g suffix - CPU load in % The result is exported to a text file, and optionally an image if gnuplot is installed. Run this script (perhaps via nohup) to capture the data: #!/bin/sh This post presents a custom script to execute a process and monitor the CPU and Memory usage of that process using linux utilities such as top, grep, and awk. Memory usage is also useful.If you want to monitor the memory and CPU usage of a particular Linux process for a few minutes, perhaps during a performance test, you can capture the data with top and plot them with gnuplot. Keep reading to learn how. For a sudden influx of usage you may want a list of network connections (by address not name). You may want a lot of information besides just the processes using the most resources. You may find that cfengine's anomaly detection can be used to trigger a script to capture the system state when things go wrong. The system admin kept insisting the increasing swap usage was not a problem, right up until the server stopped responding. The problem service was a program monitoring other processes for memory leaks. I once watched a server slowly die over a period of days. You may be able to correct the problem before it goes down.įor memory leaks, a steady increase in swap usage indicates a problem. This may give you a chance to get in and watch the server going down. I realize this is server based, but it useful to determine times when problems are occurring. ![]() I have configured systems to run top for a few cycles when a resource was being over used.Ĭonsider running sar in batch mode to capture resource utilization. You may need more than one top running to capture the top offenders on multiple resources. It you want just the top offenders, consider running top with a relatively long interval (60 seconds plus) in batch mode. CPU usage and memory usage Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |