intertwingly

It’s just data

Sample + One Line + Glue = Solution


Michal Wallace: I mentioned to Sam Ruby that I’d like to have a window pop up on my home machine if the load started to creep up on one of my servers. Not five minutes later he sends me a python/Tkinter script that does just that!

<chuckle>

Michael: if you look closely, the script looks amazing like this one.

My big value add?  One line of code:

load=max(map(float,re.findall('(\d+\.\d+)',getoutput('uptime'))))

The version I sent to Michal issued ssh <host> uptime instead.  The version Michal ultimately settled on was to install this line on the server (presumably as a CGI) and fetch the page using a library like urllib.

Update: And that one line had a bug in it. It originally only captured the last digit of the integer portion of the load average. The version posted above corrects this problem.