Wednesday, May 18, 2011

Conky - monitoring your system

Conky is a high customizable tool, which displays various system information and has a lot of option.


This tool is really impressive, you can configure it just like you want and you can add many options to it. In this post I'll show you how looks my conky and its configuration file.


So this is my conky at the time of writing this post:



conky





conky                






Basic settings: it is shown on all desktops, but not in the system tray. It is transparent.

What's in the picture:
  • actual used kernel and the computer name in the network
  • uptime and system load
  • CPU load graph (for both CPU's), CPU frequency and load in %
  • CPU load for the 1. kernel, its frequency, load in % and kernel temperature
  • CPU load for the 2. kernel, its frequency, load in % and kernel temperature
  • processes count: all processes and running processes, HDD temperature
  • next the two most CPU consuming processes are shown
  • used amount of RAM from the overall capacity and IO disk load
  • used SWAP from the overall capacity and the disk IO graph
  • free space on the HDD: / - root and H: home
  • du: shows size of the /tmp directory, next to it the new mail count notification is shown
  • wired shows the IP address of eth0 device, under it are graphs for network load and transferred data counters
  • kvota displays quota for my computer (only on my network)
  • LCD brightness and laptop mode indicator
  • power shows actual power/battery state
  • next there are indication for MPD konsole player
  • showing nameday
  • and weather
Not shown in the above picture is the indication for wlan interface, which will be shown when the interface is turned on, and active connections to the PC (ssh and ftp).

Here is the .conkyrc configuration file from the home directory:
# set to yes if you want Conky to be forked in the background
background yes
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont DejaVu Sans Mono:size=8
# Text alpha when using Xft
xftalpha 1.0

# Update interval in seconds
update_interval 3
# Create own window instead of using desktop (required in nautilus)
own_window yes
# own_window_type normal # desktop, normal, override
own_window_hints below,sticky,undecorated,skip_taskbar,override
own_window_transparent yes
# own_window_colour black
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# Minimum size of text area
minimum_size 240
maximum_width 250
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders no
# border margins
border_margin 0
# border width
border_width 1
# Default colors and also border colors
default_color white
default_shade_color white
default_outline_color white
# Text alignment, other possible values are commented
gap_x 5
gap_y 5
alignment top_left
# Gap between borders of screen and text
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer left
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# boinc (seti) dir
#variables for new connections on ftp and ssh
template0 0
template1 1
TEXT
${color #16FF0E}$sysname $kernel ${color yellow} $nodename
${color #15F015}Up: ${color white}$uptime ${color #15F015}Load: ${color white}$loadavg
${color white}${hr}
${color #15F015}CPU ${color blue}${cpugraph cpu0 10,70 C05600 FFFF00} ${color yellow}${freq_g}GHz ${alignr}${color white}${cpu cpu0}%
${color #15F015}Core 1:${color darkblue}${cpugraph cpu1 10,70 0000C0 00FFFF} ${color lightblue}${freq_g cpu1}GHz${alignr}${color white}${cpu cpu1}%${color grey} ${color #00ffdd}${execi 60 cat /proc/acpi/thermal_zone/THM0/temperature | grep temp | sed -e 's/temperature: //' | sed -e 's/ C//'}°
${color #15F015}Core 2:${color darkblue}${cpugraph cpu2 10,70 0000C0 00FFFF} ${color lightblue}${freq_g cpu2}GHz${alignr}${color white}${cpu cpu2}%${color grey} ${color #00ffdd}${execi 60 cat /proc/acpi/thermal_zone/THM1/temperature | grep temp | sed -e 's/temperature: //' | sed -e 's/ C//'}°
${color #15F015}Processes:${color white}$processes ${color #15F015} Run:${color white}$running_processes ${alignr}HDD: ${color #00ffdd}${execi 60 sudo hddtemp /dev/sda | sed -e 's/\/dev\/sda: ST9160824AS: //' | sed -e 's/C//'}
${color magenta}CPU Usage PID CPU% MEM%
${color gold}${top name 1}${top pid 1} ${top cpu 1} ${top mem 1}
${color darkorange}${top name 2}${top pid 2} ${top cpu 2} ${top mem 2}
${color #15F015}RAM:${color white} $mem/$memmax${alignr}${color #15F015}IO: ${color white}${diskio}
${color #15F015}SWAP:${color white}$swap/$swapfree${alignr}${color blue}${diskiograph 10,80 FFBBCC 00FFDD}
${color orange} /: ${color white}${fs_free /}/${color white}${fs_size /}${alignr}${color #FF8000}${fs_bar 5,80 /}
${color orange} H: ${color white}${fs_free /home/krisko}/${color white}${fs_size /home/krisko}${alignr}${color #FF8000}${fs_bar 5,80 /home/krisko}
${color orange} du: ${color white} ${execi 360 du -hs /tmp} ${alignr}${color 00FFDD}gmail${color yellow}${execi 300 /home/krisko/bin/mailcheck/gmail} ${color 00FFDD}intrak${color yellow}${execi 300 /home/krisko/bin/mailcheck/intrak}
${color yellow}${hr}
${color #15F015}Wired: ${color white}${addr eth0} ${if_running dhcpd} $alignr${color red}DHCP Server!$endif
${if_up wlan0}${color #15F015}Wireless: ${color white}${addr wlan0}
${color #15F015} Down:${color white} ${downspeed wlan0} ${alignr}${color #15F015}Total:${color white}${totaldown wlan0}
${color #15F015} Up: ${color white} ${upspeed wlan0} ${alignr}${color #15F015}Total:${color white}${totalup wlan0}
$else${color #15F015}Down:${color white} ${downspeed eth0} $alignr${color #15F015} Up:${color white} ${upspeed eth0}
${color #6600FF}${downspeedgraph eth0 15,100 0000FF FF0000 180} $alignr${color #6600FF}${upspeedgraph eth0 15,100 0000FF FF0000 25}
${color white}${totaldown eth0} $alignr${color white}${totalup eth0}${endif}${if_match ${template0} != ${tcp_portmon 21 21 count}}
${color #FFFF99}FTP: ${color white}${tcp_portmon 21 21 count}
${color white} ${tcp_portmon 21 21 rip 0} ${tcp_portmon 21 21 rhost 0}${endif}${if_match ${template1} < ${tcp_portmon 21 21 count}}
${color white} ${tcp_portmon 21 21 rip 1} ${tcp_portmon 21 21 rhost 1}${endif}${if_match ${template0} != ${tcp_portmon 22 22 count}}
${execi 240 notify-send "SSH status" \ "New connection has been established!" -t 9000 -i /opt/kde3/share/icons/crystalsvg/32x32/actions/messagebox_warning.png}${color #FF9999}SSH: ${color white}${tcp_portmon 22 22 count}
${color white} ${tcp_portmon 22 22 rip 0} ${tcp_portmon 22 22 rhost 0}${endif}
#${color white} ${tcp_portmon 22 22 rip 1} ${tcp_portmon 22 22 rhost 1}
${color slate grey}Kvota: ${color}${execi 600 wget -q http://www.intrak.sk -O /tmp/index.html;cat /tmp/index.html | grep \<b\>PC | sed -e 's/ //' -e 's/\ \// /' -e 's/<b>krisko//' | sed 's/<\/b> <\/td>//g' | sed -e 's/<b>//'; rm /tmp/index.html}${color blue}${hr}
${color #15F015}Brightness:${color #86FFF1} ${execi 5 cat /sys/devices/virtual/backlight/acpi_video0/brightness} / 15 ${alignr}${color #15F015}Laptop mode:${color 86FFF1}${laptop_mode}
${color #15F015}Power: ${color yellow}${execi 10 acpi | sed -e 's/ .*: //'}$if_mpd_playing${color red}$alignr${exec mpc_current_song}
${color green}${mpd_status} ${color white}${mpd_elapsed}/${mpd_length} VOL:${mpd_vol}% RND:${mpd_random}
${color blue}${mpd_bar 3 200}
${color 00EECC}${scroll 40 15 ${mpd_smart}}
> ${mpd_title 26}${alignr}${color yellow}${mpd_bitrate}kbps${endif}
${color yellow}${hr}
${color #FFF893}${execi 1800 meniny_offline}${if_gw}
${color blue}${hr}
${color #90EFFF}${execi 600 weather -a KE}
${color #90EFFF}${scroll 40 20 ${execi 600 weather -f KE}}${endif}

Note: functions for e-mail, nameday and weather are standalone scripts. Some of the information  won't work on each computer, it depends on the distribution and hardware of the PC.

Update: this is my new conkyrc file:
# set to yes if you want Conky to be forked in the background
 background yes
 cpu_avg_samples 2
 net_avg_samples 2
 out_to_console no
 # Use Xft?
 use_xft yes
 # Xft font when Xft is enabled
 xftfont DejaVu Sans Mono:size=8.5
 # Text alpha when using Xft
 xftalpha 1.0

 # Update interval in seconds
 update_interval 5
 # Create own window instead of using desktop (required in nautilus)
 own_window yes
# own_window_type normal # desktop, normal, override
# own_window_hints below,sticky,undecorated,skip_taskbar,override
 own_window_hints below,sticky,undecorated,skip_taskbar
 own_window_transparent yes
# own_window_colour black
 # Use double buffering (reduces flicker, may not work for everyone)
 double_buffer yes
 # Minimum size of text area
 minimum_size 250 720
 maximum_width 160
 # Draw shades?
 draw_shades no
 # Draw outlines?
 draw_outline no
 # Draw borders around text
 draw_borders no
 # Stippled borders?
 stippled_borders no
 # border margins
 #border_margin 0
 # border width
 border_width 1
 # Default colors and also border colors
 default_color white
 default_shade_color white
 default_outline_color black
 # Text alignment, other possible values are commented
 gap_x 5
 gap_y 25
 alignment top_right
 # Gap between borders of screen and text
 # Add spaces to keep things from moving about? This only affects certain objects.
 use_spacer left
 # Subtract file system buffers from used memory?
 no_buffers yes
 # set to yes if you want all text to be in uppercase
 uppercase no
 # boinc (seti) dir

#increase text buffer size for todo skript (default is 256)
  text_buffer_size 2048

 #variables for new connections on ftp and ssh
 template0 0
 template1 1

TEXT
${color #0066CC}$sysname Kernel
${color white} $kernel
${color #0066CC}Uptime: ${color white}$uptime
${color #0066CC}Load: ${color white}$loadavg
${color #0066CC}HDD: ${color darkblue}${diskiograph 10,30 C0FFC0 214BBF}  ${color white}${diskio}${color #0066CC} ${execi 60 sudo /usr/sbin/hddtemp /dev/sda | egrep -o [0-9][0-9]°C | sed -e 's/C//'}
${color #0066CC}CPU: ${color darkblue}${cpugraph cpu0 10,30 000033 33A1DE} ${color #0066CC} ${freq_g}GHz ${color #0066CC}${execi 10 cat /proc/acpi/ibm/thermal | cut -d ' ' -f 1 | sed -e 's/temperatures:\t//'}°
${color #0066CC}CPU: ${color white}${cpu cpu0}% ${color #0066CC}FAN: ${color white}${execi 6 cat /proc/acpi/ibm/fan | grep speed | sed -e 's/speed:\t\t//'}

${color #0066CC}CMD ${color white}PID    CPU    MEM 
${color #0066CC} ${top name 1}
${color white}   ${top pid 1} ${top cpu 1} ${top mem 1}
${color #0066CC} ${top name 2}
${color white}   ${top pid 2} ${top cpu 2} ${top mem 2}
${color  #0066CC}${hr}
${color #0066CC} /: ${fs_bar 7,60 /} ${color white}${fs_free /} 
${color #0066CC} H: ${fs_bar 7,60 /home/krisko} ${color white}${fs_free /home/krisko}
${color #0066CC}RAM:${membar 7,60 } ${color white}$mem
${color #0066CC}SWP:${color white}$swap${color #0066CC}/tmp:${color white} ${execi 600 du -hs /tmp | sed -e 's/\/tmp//'}  

${if_gw}${color #0066CC}gmail:${color white}${execi 120 /home/krisko/bin/appl/mailcheck/gmail}${execi 120 cat /home/krisko/bin/appl/mailcheck/gmailcount}  ${color #0066CC}intrak:${color white}${execi 120 /home/krisko/bin/appl/mailcheck/intrak}${execi 120 cat /home/krisko/bin/appl/mailcheck/intrakcount} ${endif}
${color #0066CC}${hr}
${color #0066CC}Wired: ${color white}${addr eth0}
${if_up wlan0}${color #0066CC}Wireless: ${color white}${addr wlan0} 
${color #0066CC} Down:${color white} ${downspeed wlan0}  ${alignr}${color #0066CC}Total:${color white}${totaldown wlan0}
${color #0066CC} Up:  ${color white} ${upspeed wlan0}  ${alignr}${color #0066CC}Total:${color white}${totalup wlan0}
$else${color #0066CC}Down: ${color white}${totaldown eth0}  ${downspeed eth0}
${color #0066CC}Up:   ${color white}${totalup eth0}  ${upspeed eth0}
${color white}D:${color #0066CC}${downspeedgraph eth0 12,60 000033 33A1DE 180} ${color white}U:${color #0066CC}${upspeedgraph eth0 12,60 000033 33A1DE 25}${endif}${if_match ${template0} != ${tcp_portmon 21 21 count}}
${color #FFFF99}FTP Connection: ${color white}${tcp_portmon 21 21 count}
${color white} ${tcp_portmon 21 21 rip 0} ${tcp_portmon 21 21 rhost 0}${endif}${if_match ${template1} < ${tcp_portmon 21 21 count}}
${color white} ${tcp_portmon 21 21 rip 1} ${tcp_portmon 21 21 rhost 1}${endif}${if_match ${template0} != ${tcp_portmon 22 22 count}}
${execi 300 notify-send "SSH status" \ "New connection has been established!" -t 9000 -i /home/krisko/.icons/messagebox_warning.png}${color #FF9999}SSH Connection: ${color white}${tcp_portmon 22 22 count}
${color white} ${tcp_portmon 22 22 rip 0} ${tcp_portmon 22 22 rhost 0}${endif}
#${color white}        ${tcp_portmon 22 22 rip 1} ${tcp_portmon 22 22 rhost 1}
${color slate grey}Kvota: ${color white}PC ${execi 600 wget -q http://www.intrak.sk -O /tmp/index.html;cat /tmp/index.html | grep \<b\>PC | cut -d " " -f 14,15}${color #0066CC}
${color #0066CC}Brightness:${color #86FFF1} ${execi 5 cat "/sys/devices/pci0000:00/0000:00:02.0/backlight/acpi_video0/actual_brightness"}/15 
${color #0066CC}Laptop mode:${color 86FFF1} ${laptop_mode}
${color #0066CC}Power: ${color #86FFF1}${execi 10 acpi | cut -d " " -f 3-}

${color #487EDB}Today: ${color white}${execi 1800 date "+%a %d %b %Y"}
${color #0066CC}${execi 1800 meniny_offline}

${color #0000FF}Todo List ${hr}
${color white}${execi 5 todo show}
It look like this:

No comments:

Post a Comment