Since I have an issue with following basic tutorials and writing code that has no practical use, I decided to create a small app to monitor databases.
Nothing to fancy, just a listing a couple of running SQL queries, table locks and user sessions.
The nice part is that it can do this for three different database systems: Oracle, MySQL and PostgreSQL (this one is not yet implement).
I placed all of the code on github (HERE) so you can check it out by yourself.
How does it work?
Well I created a simple interface using ncurses the is divided into 4 areas: Header, Running Queries, Current DB Locks, Current Sessions.
The interface is the same for all database systems and the information to display is the same (within each DB's possibilities).
Here are some screenshots:
But there also some nice things: long running queries (over 5 minutes) should appear in RED, the query text is divided into two lines so you can more easily identify bad queries.
The information is constantly refreshing (currently once per second) and it should have a low impact on your database since the queries it runs are on internal database tables/views.
I plan on adding some more features like system/db load, traffic, query cache hit, key efficiency, etc....
So stay tuned for more updates...