PDA

View Full Version : New PyCI screenshots: Status, Utilities, and dnsmasq


riskable
06-24-2009, 02:29 PM
The pictures have detailed descriptions so I won't get into detail here. I will say that I'm really proud of the new status plugin. I can make it graph just about anything with very little effort. In fact, here's the timeline for it's development:

~3 hours: Writing the plugin and reading Flot documentation trying to figure out how it likes its data. At the end of this period I had it charting load averages (with bugs).
~1 hour: Figuring out the necessary Javascript to keep the on-screen graph updating at regular intervals whilst removing old data points (so it doesn't grow indefinitely). Essentially, I taught myself how to walk a json object and how to use push() and shift() (hehe). Never had to use them before.
~1 hour: Figuring out how to get the various CPU/Sys/User/etc values into human-readable form from /proc/stat. 2 minutes: Getting the page to update that data in real-time.
~30 minutes: Figuring out the best way to parse /proc/net/dev into the format Flot likes.

Here's some example code of how easy it is to graph stuff with Flot using PyCI:

def load_average(self, **options):
"""Return the current system load average in a json format flot understands."""
now = datetime.now().strftime('%H.%M%S')
json_out = []
json_out.append({'data':[[now, getloadavg()[0]]], 'label': '5 minute'})
json_out.append({'data':[[now, getloadavg()[1]]], 'label': '10 minute'})
json_out.append({'data':[[now, getloadavg()[2]]], 'label': '15 minute'})
return json.dumps(json_out)

...and here's the screenshots:

http://www.flickr.com/photos/18175109@N00/3658297772/
http://www.flickr.com/photos/18175109@N00/3658297638/
http://www.flickr.com/photos/18175109@N00/3658297512/

CzechEnglishFrenchGermanItalianPolishPortugueseRussianSpanish
Translations delivered by vBET Translator 3.5.4