Skip to content

Version 0.3 of servermonitor.py, now with 100% more web 2.0′ness!

Here is version 0.3 of servermonitor.py.  

Added in this version is if a service has a history of going up and down there will be a toggle link to display the history of the services states.  All the HTML that is loaded is pre-rendered and the js lib only does a GET and append to the DOM (there is no JSON or real AJAX going on here), so there is still no additional requirement of any kind of dynamic web programing language such as PHP or mod_perl to query a DB and generate the page dynamically.  Also, to keep with the one file philosophy I have used the Google javascript CDN to load jquery rather than distributing the library in a separate file.

 

Here is a sample of the HTML output http://black.kracknet.net/~stickystyle/servermonitor/

XMPP Z-Machine

Since prakbot that I mentioned a while back may be dead (I can’t get to it anymore) I have found another Z-Machine gateway here.  He has even put in a few features to make playing on a blackberry easier, such as being able to set the screen width to a custom value (e.g. 68 to fit JiveTalk).  So check it out if your looking for a time waster on your BB.

Version 0.2 of servermonitor.py

Well that didn’t take long for me up get around and update the script to include a method to update the hash of a ConnectAndVerify service :-)

Next step will be to look at the code I wrote and possibly refractor a few bits just to make sure I’m not duplicating code anywhere or doing things in a manner that is not as efficient as it could be, since really most of this script was written on a saturday afternoon while I was board.

servermonitor.py

Simple server monitoring with servermonitor.py

The problem with most server monitoring systems is they run from inside of your network, as such if there is a major outage past office hours where their monitor server is not capable of sending an alert email out (be it the mail server is down, or internet) you may not get the notification at the time of the outage.  

There are ideal solutions to this such as signing up for a paging service so your servers have some kind of Out-Of-Band alerting or paid external monitoring but for very small shops that may not have the extra equipment or funds to install such hardware or pay for a service and the situation of having an externaly facing server go down is still a big deal I offer this script.

It’s purpose is to use one of the many free online shell accounts to provide you with additonal external monitoring to you already existing internal system for no cost.  It would also work great for all the home server folks out there that may have one box hosting there domain and want a simple monitor to know if there site, internet, or mail service has stopped working.

Here is an example of the status page the script generates script running at on of my free shells http://black.kracknet.net/~stickystyle/servermonitor

So here is v 0.1 of my script whose goal is to rely on nothing standard built-in python modules, and keep everything in one file.  It has an MIT license so everyone should be able to use it without worry of “GPL contamination”, also if you do use it, drop me a comment let me know how it works for you, that may inspire me to put some more work into it :-)  (patches are ALWAYS welcome)

servermonitor.py

 

TODO: Need to add a function to update the hash on ConnectAndVerify, right now you need to delete the service and re-add it if your banner or web page changes.

Free shell accounts.

Been hanging with the guys at kracknet.net recently and they are a pretty good group of guys, so good in fact that they are offering free shell accounts with very liberal permissions on what you can do (basically no IRC bouncers / psybnc).

To get a free account ssh on over, with the username and password of new/new…
$ssh -l new shell.kracknet.net

kracknet.net

Servoy server SysV init script

Here is a quick servoy server init script I wrote and use at work.  It works pretty well on my debian based machines, although it may be a problem if you have other java apps running as it may catch the wrong PID.  I  could clean that up if i needed, but I personally don’t so if you need help let me know in the comments and I can adjust it.
Continue reading ›

Command line meme

Seems like everyone is posting there top ten command line commands, so what the hell…

 
ryanparrishscomputer:~ rparrish$ history|awk '{a[$2]++} END{for(i in a){printf “%5d\t%s\n”,a[i],i}}’|sort -rn|head
  57 ls
  51 cd
  45 svn
  22 ssh
  19 paster
  13 sudo
  11 vi
  9 python
  6 ps
  3 whois

This is on a week old OS 10.5 system, so I’m still getting things setup and haven’t got into the swing of things yet.  Although you can see I have been doing most of my work with pylons this past week.

OpenID now enabled

I know just one post and 15 miniutes ago I said that I didn’t have any plugins, well that was false.  In fact I do use Akismet, Google XML Sitemaps and wp-cache.  Good job at knowing my own system eh?

So now on top of that I have added wp-openid for your commenting pleasure.

Just upgrade to wordpress 2.5

I just updated this blog to wordpress 2.5 and I have to say so far I am impressed overall, but there are some major nagging points still with the visual editor.  At least in safari when you put tags such as <p> and <br/> into the HTML mode of the editor, switch to visual mode, then switch back to HTML - your tags are gone.  I have gathered from reading other reports that this is a safari issue, but still it is quite annoying.  

I also do not have any plugins on this site so perhaps if I did (http://gallery.menalto.com/node/67933) this would have been a lot more painful.

Installing MySQL + MySQLdb in OS 10.5 (Leopard)

Anyone that is a python developer and that uses mysql will tell you getting MySQLdb can sometimes be a bit of a pain, and every time I reinstall my system I have to dig around to find the instructions to build it properly.So this time I thought I would document what I did on my blog, mostly so I can reference it myself.

  1. Get the mysql packages from darwinsource, this is by far the easiest way to get mysql on your box. http://www.opensource.apple.com/darwinsource/Current/
  2. There you will find a binary package (I guess you could comiple from source also, but I’m doing the quickest route) MySQL-43.binaries.tar.gz, download it.
  3. $tar zxvf MySQL-43.binaries.tar.gz and you are left with a folder, in that folder it has a readme with the command you need to run $sudo tar -xzvf MySQL-43.root.tar.gz -C /
  4. Now you need to edit the download MySQLdb sources file _mysql.c (as per this ) and remove the following lines near the top of the file
    #ifndef uint
    #define uint unsigned int
    #endif
  5. Now with that file patched, you can run $python setup.py build followed by $sudo python setup.py install. I didn’t have to create a symlink to any .so or .o files as mentioned in some other posts, I think it may be because I used darwinsource package rather than the packages from dev.mysql.com