29 January 2009

System Administration with Webmin

Whether you have a linux server somewhere you would like to keep an eye on or you are doing shared hosting for other people, webmin is a great tool to let you do a lot of the common administration tasks via an easy to use web application.

To install, get the latest version from here http://www.webmin.com/download.html (or install from your distro's repository, but it might not be up to date)

Then, depending on the OS you have, you may have to run '/usr/libexec/webmin/setup.sh'

After that, you are ready to go. To access webmin, headoff to http://yourserver:10000/ (default configuration)

You can install a number of additional modules available here: http://www.webmin.com/third.html
Some that I found useful:
System Information - http://swelltech.com/projects/webmin/modules/sysinfo-1.170.wbm
Custom Link - http://www.webmin.com/download/modules/link.wbm
Stats - http://downloads.sourceforge.net/webminstats/sysstats-1.2.tgz

One nice feature is that webmin allows you to install module directly from the net, just by pasting the link above.

If you are running a shared hosting environment, the usermin module is a must. You might also want to rely on virtualmin for setting up all the virtual domains, but if you go that route, you have to set it up and use it from the start.

28 January 2009

Monitoring (and Conky)

First, you should install lm-sensors

Then, to make it detect what it can, run the following command 'sensors-detect', which will determine what kernel modules should be loaded for lm-sensors to do its job.

Then you install conky

here is a sample config file to get you started:

# fork to background ? ################################################
background no

# font settings #######################################################
use_xft yes
#font monospace-8
xftfont Acknowledge TT BRK:size=8
#xftfont Edit Undo BRK:size=8
#xftfont Visitor TT2 BRK:size=10
uppercase no
override_utf8_local yes

# update every 1 secs #################################################
update_interval 5
# stay running forever ################################################
total_run_times 0

# draw to root window #################################################
own_window no

# avoid flickering ####################################################
double_buffer yes

# size ################################################################
minimum_size 1280 800
maximum_width 1280

# position ############################################################
alignment top_left
#alignment top_middle
#alignment top_right
#alignment bottom_left
#alignment bottom_middle
#alignment bottom_right
#alignment middle_left
#alignment middle_right
gap_x 0
gap_y 0

# colors ##############################################################
default_color white
default_shade_color white
default_outline_color black
# custom colors #######################################################
color0 FFFFFF
color1 F5F5F5
color2 A2AEC6
color3 696969
color4 D3D3D3
color5 6495ED
color6 87CEFA
color7 5F9EA0
color8 BBBBBB
color9 262729


# borders #############################################################
draw_borders no
draw_graph_borders yes
stippled_borders 8
border_margin 4
border_width 1

# shades ##############################################################
draw_shades no

# outline #############################################################
draw_outline no

# spacer ##############################################################
use_spacer no

# buffers (Substract (file system) buffers from used memory?)##########
no_buffers yes
# sampling ############################################################
cpu_avg_samples 2
net_avg_samples 2

# configuration #######################################################
TEXT
${voffset 20}${offset 10}$color8 /$color3 System$color8 /
${offset 10}$color2 $sysname$color9 -$color2 $machine
${offset 10}$color2 $kernel $color9 on$color2 $nodename
${offset 10}$color6 ${time %A %d/%m/%y %kh%M}
${offset 10}$color2 Uptime :$color6 $uptime

${offset 10}$color8 /$color3 Mails$color8 /
${offset 15}$color2 mail : $color4${imap_unseen imap.server.com "user" ""}

${voffset -100}${offset 980}$color8 /$color3 Ubuntu Planet RSS$color8 /
${offset 985}$color2 >$color4${rss http://planet.ubuntu-fr.org/feed/tag/Accueil/rss2 60 item_title 0}

${voffset 50}${offset 10}$color8 /$color3 CPU #01$color8 /
${offset 10}$color2 Temperature :$color4 ${execi 10 sensors | grep -A 2 '^coretemp-isa-0000' | cut -c15-18 | grep '°'}C - $color2 Frequency : $color4${freq_dyn cpu1}$color2 MHz
${offset 10}$color2 Load: $color9 ${cpubar cpu1 6,220} $color4${cpu cpu1}$color2 %
${offset 10}$color4 ${cpugraph cpu1 15,255 262729 87CEFA}
${offset 10}$color8 /$color3 CPU #02$color8 /
${offset 10}$color2 Temperature :$color4 ${execi 10 sensors | grep -A 2 '^coretemp-isa-0001' | cut -c15-18 | grep '°'}C - $color2 Frequency : $color4${freq_dyn cpu2}$color2 MHz
${offset 10}$color2 Load: $color9 ${cpubar cpu2 6,220} $color4${cpu cpu2}$color2 %
${offset 10}$color4 ${cpugraph cpu2 15,255 262729 87CEFA}

${offset 10}$color8 /$color3 Entropy $color8 /
${offset 10}$color4 ${entropy_bar 15,255 262729 87CEFA}

${voffset 10}${offset 20}$color8 /$color3 Lan (eth0)$color8 /
${offset 35}$color2 IPv4 : $color4${addr eth0}$color2
${offset 30}$color2 Down : $color4 ${downspeed eth0}$color2 kb/s
${offset 30}$color4 ${downspeedgraph eth0 15,250 262729 87CEFA}
${offset 30}$color2 Up : ${offset 6} $color4 ${upspeed eth0}$color2 kb/s
${offset 30}$color4 ${upspeedgraph eth0 15,250 262729 87CEFA}

${voffset 10}${offset 20}$color8 /$color3 Wireless (wlan0)$color8 /
${offset 35}$color2 essid : $color4${wireless_essid wlan0}$color2 - MAC : $color4${wireless_ap wlan0}
${offset 35}$color2 Wifi Level : $color4${wireless_link_qual wlan0}$color2 /$color4 ${wireless_link_qual_max wlan0}$color2 - Quality: $color4 ${wireless_link_qual_perc wlan0}
${offset 35}$color2 IPv4 : $color4${addr wlan0}$color2
${offset 30}$color2 Down : $color4 ${downspeed wlan0}$color2 kb/s
${offset 30}$color4 ${downspeedgraph wlan0 15,250 262729 87CEFA}
${offset 30}$color2 Up : ${offset 6} $color4 ${upspeed wlan0}$color2 kb/s
${offset 30}$color4 ${upspeedgraph wlan0 15,250 262729 87CEFA}

${voffset -45}${offset 1060}$color8 /$color3 Power$color8 /
${offset 1055}$color2 $acpiacadapter$color4 $battery
${offset 1050}$color2 Time Left :$color4 $battery_time
${offset 1045}$color9 ${battery_bar 6,160}

${voffset 10}${offset 20}$color8 /$color3 Volumes$color8 /
${offset 35}$color2 / : $color4 ${fs_used_perc /}% (${fs_free /} free)
${offset 35}$color9 ${fs_bar 6,320 /}
${offset 50}$color2 /home : $color4 ${fs_used_perc /home}% (${fs_used /home} free)
${offset 50}$color9 ${fs_bar 6,320 /home}

${voffset -90}${offset 600}$color8 /$color3 Memory$color8 /
${offset 605}$color2 RAM: ${offset 0} $color9 ${membar 6,200}$color4 $mem ($memperc%)
${offset 610}$color2 Swap: $color9 ${swapbar 6,200}$color4 $swap ($swapperc%)

${voffset -500}${offset 1110}$color8 /$color3 Activity$color8 /
${offset 1105}$color2 Hdd Temp:$color4 ${hddtemp /dev/sda}
${offset 1100}$color2 Read/Write: $color4 $diskio
${offset 1090}$color2 Process :$color4 $running_processes$color2 /$color4 $processes
${offset 1090}$color6 ${top name 1}$alignr$color4 ${top cpu 1}%
${offset 1090}$color5 ${top name 2}$alignr$color4 ${top cpu 2}%
${offset 1090}$color5 ${top name 3}$alignr$color4 ${top cpu 3}%
${offset 1090}$color5 ${top name 4}$alignr$color4 ${top cpu 4}%
${offset 1090}$color5 ${top name 5}$alignr$color4 ${top cpu 5}%
${offset 1090}$color2 Memory :
${offset 1090}$color6 ${top_mem name 1}$alignr$color4 ${top_mem mem 1}%
${offset 1090}$color5 ${top_mem name 2}$alignr$color4 ${top_mem mem 2}%
${offset 1090}$color5 ${top_mem name 3}$alignr$color4 ${top_mem mem 3}%
${offset 1090}$color5 ${top_mem name 4}$alignr$color4 ${top_mem mem 4}%
${offset 1090}$color5 ${top_mem name 5}$alignr$color4 ${top_mem mem 5}%

${offset 1090} ${diskiograph 15,180 262729 87CEFA}



save this as ~/.conkyrc

This setup is good for black background (plain or with an element in the middle), wide screen at least 1280 pixels wide.

Documentation on conky variables can be found here: http://conky.sourceforge.net/variables.html

08 January 2009

eclipse performance problems

It seems that eclipse doesn't like running on gcj at all. Changing the default OS virtual machine to Sun's JDK improves performance considerably.

A couple of generic steps to set the default JDK (most distros have their own tool to do that) - make sure 'which java' returns Sun's java executable.

Also, add the path to Sun's libraries at the top in the java_home file in eclipse's directory.

A more complete guide of how to do all this in Ubuntu can be found here: http://ubuntuforums.org/showpost.php?p=1065271&postcount=8