![]() |
Feel free with Open Source SoftwareAndries Filmer - Internet professional sinds 1996.
|
|
|
|
Commandline system monitoringIntroductionThere are many commandline monitoring tools. On this page you can find a list of commands who I commonly use. The first part are commands you can use without installing a package. This page gives only some shorthand examples. The man pages can tell you much more ;)
Part 1 (default system tools)psDisplays The ProcessesPrint All Process On The Server ps aux Print All Process On The Server (wrapping commands) ps auxww Print A Process Tree ps -ejH ps axjf pstree Display Only The Process IDs of apache pgrep apache Find Out The Top 10 Memory Consuming Process ps -auxf | sort -nr -k 4 | head -10
freeDisplays Memory Usage
free -o
topdisplay Linux tasksBy default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.
top
vmstatSystem Activity, Hardware and System InformationThe command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity vmstat 3 Display Memory Utilization Slabinfo vmstat -m Get Information About Active / Inactive Memory Pages vmstat -a
uptimeTell How Long The System Has Been RunningThe uptime command can be used to see how long the server has been running. The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.
uptime
watchWatch changeable data continuouslyDefault it repeatedly reruns a command every 2 seconds by default. The next command shows the output of the free command updated every 2 seconds.
watch free To see the interrupts occurring on your system, run the command: watch -n.1 'cat /proc/interrupts'
Part II (installed system tools)
dstatversatile tool for generating system resource statistics
apt-get install dstat
ngrepNgrep is a pcap-aware tool that will allow you to specify extended regular expressions to match against data part of packets on the network.No arguments. Shows all traffic going through the default network card. ngrep -qd eth1 'HTTP' tcp port 80 Be quiet, look only at tcp packets with either source or dest port 80 on interface eth1, look for anything matching 'HTTP'. ngrep -qd le0 port 53 Watch all tcp and udp port 53 (nameserver) traffic on interface le0. Be quiet. ngrep 'USER|PASS' tcp port 21 Look only at tcp packets with either source or dest port 21, look for anything resembling an FTP login. ngrep -wiA 2 'user|pass' tcp port 21
atopAT Computing's System & Process Monitor
apt-get install atop The program atop is an interactive monitor to view the load on a Linux system. It shows the occupation of the most critical hardware resources (from a performance point of view) on system level, i.e. cpu, memory, disk and network. When running atop interactively (no output redirection), keys can be pressed to control the output. In general, lower case keys can be used to show other information for the active processes and upper case keys can be used to influence the sort order of the active process list. g # Show generic output (default). m # Show memory related output. d # Show disk-related output. n # Show network related output (when kernel patch 'cnt' is installed). s # Show scheduling characteristics. v # Show various process characteristics. c # Show the command line of the process. u # Show the process activity accumulated per user. p # Show the process activity accumulated per program (i.e. process name). Useful website: http://www.atoptool.nl for patch and more info. The man page is very useful too ;)
nethogsNet top tool grouping bandwidth per processInstead of breaking the traffic down per protocol or per subnet, like most tools do, it groups bandwidth by process. If there's suddenly a lot of network traffic, you can fire up NetHogs and immediately see which PID is causing this.
apt-get install nethogs More info: http://nethogs.sourceforge.net
iostatAverage CPU Load, Disk Activity
apt-get install iostat
iostat
bmonGraphs/tracks network activity/bandwidth real time.
apt-get install bmon Just type bmon to see your network activity/bandwith in real time ;)
bmon
inotify, incron and authctlThere is a separate page about Monitoring file system events with inotify, incron and authctl. Very usefull if you want to know what files are created or modified.
StressCheck the system onder (heavy) load.
apt-get install stress
stress -c 20 -i 4 --verbose --timeout 1h
OthersI don't use the next tools, but maybe you like them.
Resources
I appreciate if you give some comment about this page. Please go ahead. |
|
Andries Filmer | http://andries.filmer.nl | andries@filmer.nl | © 2011
|