Linux monitoring

 Linux  Comments Off on Linux monitoring
Jan 292012
 

As my Dell laptop with Ubuntu 10.10 felt really slow the other day, I began to wonder what tools were available to monitor performance, except for the usual top and ps commands I already knew about.

This is a list of the result of my little search of these kind of tools (in no aspect to be regarded as complete).

top - The program provides a dynamic real-time view of a running system.
htop - interactive process viewer.
atop - AT Computing's System & Process Monitor.
iotop - simple top-like I/O monitor.
ps - report a snapshot of the current processes.
iostat - Report Central Processing Unit (CPU) statistics and input/output statistics for devices, partitions and network filesystems (NFS).
sar - Collect, report, or save system activity information.
nmon -systems administrator, tuner, benchmark tool.
lsof - ls of open files.
netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.
ss - another utility to investigate sockets.
iptraf - Interactive Colorful IP LAN Monitor.
Nagios - Server And Network Monitoring.
strace - trace system calls and signals.
/proc - linux kernel info.
# cat /proc/cpuinfo
# cat /proc/meminfo
# cat /proc/zoneinfo
# cat /proc/mounts

The Beginning

 VIM  Comments Off on The Beginning
Jan 122012
 

The very first blog entry!
What should it be about?
Linux, device drivers, Lego Mindstorms NXT, Arduino, Raspberry Pi, or ...?
No!
Let's start with the tool I use daily, both at work and at home.

That would be VIM (VI iMproved).

My first encounter with Vim was when a collegue showed it, and then sent me this link.
http://www.derekwyatt.org/vim/vim-tutorial-videos/
It has been a real kick-starter for me in the introduction to Vim.

To be honest it was not easy in the beginning, but after using it constantly for several months, I would not like to switch it for any other editor.

Anyhow, here is my .vimrc, which I use both at work and at home.

"
" not compatible with original vi
set nocompatible
" Status bar --------------------------------------------------------------
" Make command line two lines high
set ch=2
" show current mode in status bar
set showmode
" Set the status line the way I like it
set stl=%f\ %m\ %r\ Line:\ %l/%L[%p%%]\ Col:\ %c\ Buf:\ #%n\ [%b][0x%B]
"set stl=%f\ %m\ %r\ Line:\ %l/%L[%p%%]\ Col:\ %c\ Buf:\ #%n\
" Show statusline in single window
set laststatus=2
" Color, layout etc  ------------------------------------------------------
" background color
set background=dark
" color scheme
colorscheme darkgreen
" Enable syntax highlightning
syntax on
" text width
set tw=120
" highlight column after textwidth
set cc=+1
" wrap text
set nowrap
" tab/backspace are smart
" set smarttab
" Tab length, nbr spaces
set tabstop=8
" indent according to tabstop
set cindent
" help me with indenting
set smartindent
" autoindent
set autoindent
" scrollbar width
set sw=2
" show line numbers
set number
" watch for file changes
set autoread
" nbr undo levels
set undolevels=1000
" Show trailing spaces and tabs
set list
set listchars=trail:+,tab:>-
" Folding
"set foldmethod=syntax
" Folding lines shown
set foldminlines=5
" Folding level
set foldnestmax=3
" Search ------------------------------------------------------------------
" ignore case in pattern
set ignorecase
" override ignorecase
set smartcase
" show pattern in text as it is written
set incsearch
" highlight all matches
set hlsearch
" Set the search scan to wrap around the file
set wrapscan
" search directories
set path+=**
" Copy --------------------------------------------------------------------
" add a $ at end of 'copy/change'
set cpoptions+=$
" Buffer ------------------------------------------------------------------
" change buffer without saving
set hidden
" Switch to first buffer
noremap  :bfirst
" Switch to next buffer
noremap  :bnext
" Switch to previous buffer
noremap  :bprevious
" Switch to last buffer
noremap  :blast
" Windows -----------------------------------------------------------------
" Move the cursor to the window left of the current one
noremap   :wincmd h
" Move the cursor to the window below the current one
noremap   :wincmd j
" Move the cursor to the window above the current one
noremap   :wincmd k
" Move the cursor to the window right of the current one
noremap   :wincmd l
" Cscope----------------------------------------------------------------
if has("cscope")
	set csprg=/usr/bin/cscope
	set csto=0
	set cst
	set nocsverb
	" add any database in current directory
	if filereadable("cscope.out")
	    cs add cscope.out
	" else add database pointed to by environment
	elseif $CSCOPE_DB != ""
	    cs add $CSCOPE_DB
	endif
	set csverb

	map g :cs find c =expand("")
	map g :cs find s =expand("")
endif
" Specials ----------------------------------------------------------------
" 'Ctrl s' to save file in both command and insert mode.
map  :w
imap  :wi
" Plugins -----------------------------------------------------------------
:filetype plugin on
" Taglist, need ctags
map  :TlistToggle
" NERDtree
map  :NERDTreeToggle
" Buflist (buflist.vim defines F4 as toggle window
"map  
" CScope. Find this definition - :cs f g
map  :cs f g =expand("")
" CScope. Find functions called by this function - :cs f d
map  :cs f d =expand("")
" CScope.  Find functions calling this function - :cs f c
map  :cs f c =expand("")
" CScope.  Find symbol - :cs f s
map  :cs f s =expand("")
" Search for this word in this file
map  :/=expand("")
" Remove MS-DOS carriage returns
"map  :1,$s/
//
" Cscope
" Matchit
" ColorSamplePack
" SearchComplete
" VcsCommand
" Folding
" Filetype specifics ------------------------------------------------------
" file type detection
:filetype on
"
autocmd FileType make set noexpandtab sw=4
autocmd FileType c set tw=80
autocmd FileType h set tw=80
" Text width --------------------------------------------------------------
"autocmd BufEnter *.c,*.h let w:m1=matchadd('Search', '/\%<81v.\%77v', -1)
"autocmd BufEnter *.c,*.h let w:m2=matchadd('ErrorMsg', '/\%>80v.\+', -1)