APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed


© May 2010 Girish Venkatachalam
Girish Venkatachalam

Girish Venkatachalam is a UNIX hacker with more than a decade of networking and crypto programming experience. His hobbies include yoga,cycling, cooking and he runs his own business. Details here:


Network monitoring is big business. There is a company in Chennai that has a famous product for network monitoring. That product has been a cash cow for them even after they built several other business lines with that money.

It continues to fill their coffers though I am not sure how much they get out of it month after month.

Any good product should fetch good money but unfortunately the world does not work that way. Certain products in certain domains get you more money than arguably much better products in some other domain.

Ultimately people pay you when they need your offering and when your offering either offers them a price advantage or a technology advantage.

The other way to look at it is this:

"Either you should improve their profits or cut down their costs."

If you can keep this goal in mind and give your customer anything that helps them achieve this goal you succeed.

By the way I heard these words many years past from a business owner.

Anyway now let us get back on track and focus on UNIX and technology. This site is after all for technology though you can get advice on related matters like this.

I had to do server monitoring for one of my clients and I ended up using the sexy conky tool for it.

But I had to do a lot of jugglery to make it work on the web.

You need a conkyrc ~/.conkyrc that looks like this:

# maintain spacing between certain elements
use_spacer none

# set to yes if you want tormo to be forked in the background
background yes

use_xft no

# Xft font when Xft is enabled
#xftfont Bitstream Vera Sans Mono-8
#xftfont Andale Mono-9
#xftfont Clean-8
xftfont Times New Roman
#xftfont squaredance10:pixelsize=14
#xftfont swf!t_v02:pixelsize=10

# Text alpha when using Xft
#xftalpha 1
#mail_spool $MAIL

# Update interval in seconds
update_interval 1.0

# Create own window instead of using desktop (required in nautilus)
own_window yes
default_color brown

own_window_colour brown
own_window_transparent yes

own_window_hints undecorated,below,skip_taskbar,skip_pager
#own_window_type normal

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
minimum_size 280 5

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no # amplifies text

# Draw borders around text
draw_borders yes

# Stippled borders?
stippled_borders 3
font verdana

# border margins
border_margin 9

# border width
border_width 1

# Default colors and also border colors, grey90 == #e5e5e5
default_color red
default_shade_color brown
default_outline_color DarkGrey

# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_left

# Gap between borders of screen and text
gap_x 810
gap_y 30

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
#uppercase yes

#$alignc${color turquoise}${diskiograph log 30, 120 0066cc 99cc00 sd0} 
#$alignc${color turquoise}${diskiograph log 30, 120 0066cc 99cc00 wd0} 
# stuff after 'TEXT' will be formatted on screen
# $alignc${color brown}${downspeedgraph eth0 30,130 99ff00 ff3300} ${color brown}${upspeedgraph eth0 30, 130 0fffff de0fff }

$alignc${color green}$sysname $kernel $machine
$alignc${color green}Uptime:$color $uptime ${color green} Load:$color $loadavg

$alignc${color #ffffff}${time}$color

$alignc${color orange}CPU:$color ${cpu }% ${color green}${cpubar 10,100} 

$alignc${color brown}${cpugraph log 30, 120 0066cc 99cc00} 

$alignc${color green}RAM:$color $mem / $memmax ${color orange} ${membar 10, 120} $memperc%

$alignc${color green}IP Address:$color${addr eth0}
${color green}Down:$color${downspeed eth0}k/s${color green}${offset 65}Up:$color${upspeed eth0}k/s
$alignc${color white}${downspeedgraph eth0 30,130 99ff00 ff3300} ${color brown}${upspeedgraph eth0 30, 130 0fffff de0fff }
${color white}Root: ${fs_used_perc /}% ${fs_bar 10 /}
/data: ${fs_used_perc /data}% ${fs_bar 10 /data}
/san1: ${fs_used_perc /san1}% ${fs_bar 10 /san1}
/san2: ${fs_used_perc /san2}% ${fs_bar 10 /san2}
/san3: ${fs_used_perc /san3}% ${fs_bar 10 /san3}$color

$alignc${color green}[Top - Processes]$color

$alignc${color #ffffff}Name               PID   CPU%  MEM%
$alignc${color green}${top name 1}${top pid 1}${top cpu 1}${top mem 1}
$alignc${color #ffffff}${top name 2}${top pid 2}${top cpu 2}${top mem 2}
$alignc${color #ffffff}${top name 3}${top pid 3}${top cpu 3}${top mem 3}
$alignc${color #ffffff}${top name 4}${top pid 4}${top cpu 4}${top mem 4}
$alignc${color #ffffff}${top name 5}${top pid 5}${top cpu 5}${top mem 5}

$alignc${color green}[Top - Memory]$color

$alignc${color #ffffff}Name               PID   CPU%  MEM%
$alignc${color green}${top_mem name 1}${top_mem pid 1}${top_mem cpu 1}${top_mem mem 1}
$alignc${color #ffffff}${top_mem name 2}${top_mem pid 2}${top_mem cpu 2}${top_mem mem 2}
$alignc${color #ffffff}${top_mem name 3}${top_mem pid 3}${top_mem cpu 3}${top_mem mem 3}
$alignc 50 ${color #ffffff}${top_mem name 4}${top_mem pid 4}${top_mem cpu 4}${top_mem mem 4}
$alignc${color #ffffff}${top_mem name 5}${top_mem pid 5}${top_mem cpu 5}${top_mem mem 5}

$alignc${color lightblue}${execi 30 /usr/bin/fortune -s | fold -w52 }$color

Then I needed this script to make conky write to a fake X server Xvfb.

-sh-3.2$ cat conky-setup

# This script will not only start conky but also refresh the image
every 5 seconds

# Watch the fun ;)

Xvfb :5 -screen 0 1280x1024x24&

export DISPLAY=:5.0
xsetroot -solid lightslateblue
conky  2>/tmp/f.txt
sleep 3

windowid=`grep 0x /tmp/f.txt|cut -d\( -f2|tr -d \)`
while [ "1" = "1" ];
        import -window ${windowid} /san1/sysadmin/navigator/conky.png
        sleep 3

As you can see I used the ImageMagick convert(1) command to get Xlib window output to a file. Conky cannot directly write to an image file.

I start this script manually with


Or you can put it in ~/.profile. Your choice.

The best place would be to put in system startup script. But conky can be used by any user and it displays what is mentioned in ~/.conkyrc.

No need to use root privileges when you don't need them. First rule of UNIX.

I needed to display this on the web with cycle transitions.

I chose a jQuery slideshow plugin for the following reasons:

  1. Everytime the image loads, there is annoying blankness shown on the page.
  2. The flicker in image reloading can only be avoided by image preloading but cycle plugin offers that and animations too.

Using animations is not a good idea in serious business but that is no blanket truth. You can when there is a need as long as you don't annoy the user.

I do image preloading with the cycle callback onBefore. Here is the html.

-sh-3.2$ cat conky.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "<A HREF="https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</A>>
        <!-- -->
        <title> Monitoring dashboard for Storkmon </title>
        <!-- Active content -->
<!-- ************************************************************************

<link rel="stylesheet" href="css/tailf.css" type="text/css"/>

<script type="text/javascript" src="jquery/js/jquery-1.3.2.min.js"> </script>
<script type="text/javascript" src="jquery/js/jquery.metadata.js"> </script>
<script type="text/javascript"
src="jquery/js/jquery.cycle.lite.1.0.js"> </script>
<script type="text/javascript" >

function onBefore() {
$(function() {
                //setInterval(reloadpage, 4000);
                speed: 500,
                before: onBefore
<div id="taildiv">
        <img  />
        <img />


Wth this beautiful result:


(If that doesn't work, try https://lamp.healthsoftusa.com/cgi-bin/conky-display.cgi)

Even with all this conky's root window output on X cannot be matched.

running cheetah
Stop spam dead in its tracks!

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Server monitoring with Conky

Inexpensive and informative Apple related e-books:

Digital Sharing Crash Course

Take Control of iCloud

Photos for Mac: A Take Control Crash Course

Take Control of IOS 11

El Capitan: A Take Control Crash Course

More Articles by © Girish Venkatachalam

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

The whole thing that makes a mathematician’s life worthwhile is that he gets the grudging admiration of three or four colleagues. (Donald Knuth)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode