Archive for October, 2009

Useful Linux commands: Screen, ttyload, mytop, mtop

Posted on October 23, 2009. Filed under: Linux, MySQL, Shell | Tags: , , , , , |

1. Screen

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). The same way tabbed browsing revolutionized the web experience, GNU Screen can do the same for your experience in the command line. Instead of opening up several terminal instances on your desktop or using those ugly GNOME/KDE-based tabs, Screen can do it better and simpler. Not only that, with GNU Screen, you can share sessions with others and detach/attach terminal sessions. It is a great tool for people who have to share working environments between work and home


2. ttyload

ttyload is a little *NIX utility I wrote which is meant to give a color-coded graph of load averages over time.


3. mtop/mkill

mtop (MySQL top) monitors a MySQL server showing the queries which are taking the most amount of time to complete. Features include ‘zooming’ in on a process to show the complete query, ‘explaining’ the query optimizer information for a query and ‘killing’ queries. In addition, server performance statistics, configuration information, and tuning tips are provided.

mkill (MySQL kill) monitors a MySQL server for long running queries and kills them after a specified time interval. Queries can be selected based on regexes on the user, host, command, database, state and query.


4. mytop

mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x, and 4.x server. It runs on most Unix systems (including Mac OS X) which have Perl, DBI, and Term::ReadKey installed. And with Term::ANSIColor installed you even get color.


Read Full Post | Make a Comment ( None so far )

Useful Linux tools: sipsak,Balance,eAccelerator,ploticus

Posted on October 20, 2009. Filed under: Linux, Shell | Tags: , , , , , |

1. sipsak

sipsak is a small command line tool for developers and administrators of Session Initiation Protocol (SIP) applications. It can be used for some simple tests on SIP applications and devices



Balance is our surprisingly successful load balancing solution being a simple but powerful generic tcp proxy with round robin load balancing and failover mechanisms. Its behaviour can be controlled at runtime using a simple command line syntax.



eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.



A free, GPL, non-interactive software package for producing plots, charts, and graphics from data. It was developed in a Unix/C environment and runs onvarious Unix, Linux, and win32 systemsploticus is good for automated or just-in-time graph generation, handles date and time data nicely, and has basic statistical capabilities. It allows significant user control over colors, styles, options and details.


Read Full Post | Make a Comment ( None so far )

Asterisk + Twitter = Call Monitor — Good idea

Posted on October 2, 2009. Filed under: Linux, Services |

Copied from

It’s a good idea.


Why? Why not. I was wondering how else I could make use of Twitter for other things I thought “How could I use twitter with my Asterisk PABX?” Doing some Google searching showed I wasn’t the first to think of this (as if that would have happened). There are a few people doing various things with asterisk and twitter.

I didn’t really like much of what I found, or found it wasn’t really what I wanted to do with it .. so I decided to use some of that info and came up with something of my own.

The short story is this. When someone calls my Canadian number, my US Toll-Free number any number that ultimately rings the group of phones in the house, I will now get a direct message in Twitter from a special account I setup for this purpose, which also sends a SMS to my phone (device notifications in twitter).

Read more by clicking below… Be warned! Thar be scripts and technical stuff in them thar parts
Ok, so lets see what’s under the bonnet of this beast now.

First, you’ll need an AGI script. Look, here’s one I prepared earlier – twitter.agi

# Background the curl process incase twitter doesn't respond. It will hang the dialplan.
curl -u username:PASSWORD -d text="$1" \
-d user="recipient" \ &

Put the script in /var/lib/asterisk/agi-bin. Don’t forget to chmod +x the script as well.

Pretty simple eh? The only things you’ll have to change in the script are

  • username = your twitter login name
  • PASSWORD = your twitter password
  • recipient = Who will get your direct message

Ok, and to make it work in Asterisk I put this in the extensions.conf file for the exten that I wanted to monitor:

exten => s,1,NoOp("This is my home phone context")
exten => s,n,Set(_DIDNUM="PUT YOUR DID NUM HERE")
exten => s,n,LookupCIDName
exten => s,n,AGI(twitter.agi|PBX: ${CALLERID(all)} just called on ${EXTEN})

I’ve only shown the first bits of this context, after this is your normal context such as DIAL or whatever else you might now. I actually build in a few seconds of delay to allow the text message a chance to get to my phone before the phone rings. A sort of early warning system

The only thing here you need to change really is the value of _DIDNUM (notice the underscore in front of the var name, this isn’t strictly needed, but if you wish to use that variable else where in the context or exten it’s a good idea. Obviously you can change the message after the “pipe” in the AGI line to customize the message you are sent.

The one thing I have left to work out is what asterisk variable to use to actually get the DID number used to call into the PBX with. If I can get that that would make this so much easier and more flexible. If you know what that is please drop me a comment.

Well, that’s really about it. It’s not rocket science by any means, heck, it’s nothing at all but it works.

Read Full Post | Make a Comment ( 1 so far )

Liked it here?
Why not try sites on the blogroll...