I.T. Security and Linux Administration

Apr 21 2013   10:33PM GMT

Writing a Full-Serviced Sysadmin App from Scratch – Part 3

Eric Hansen Eric Hansen Profile: Eric Hansen

Probably the last post I’m going to make for the night (not sure, though) is about presenting the monitoring data.

As mentioned, I was working on a backup solution previously.  In it, I used a Python module called Tornado to interact with HTTP requests that the client would issue.  This was all backend, however.  During this time, however, I learned about its powerful templating engine which looks to be tightly based on Jinja2.  So, for this project, I decided to ditch the PHP interface for the end user and go directly with Python.

One of the toughest decisions I’ve had to make so far is how do I want to present certain data (this is prior to me working with graphs, mind you, that only came a couple of days ago at the time of this writing).  Tornado allows for passing as many arguments as you can through Python to the templates, but what if I didn’t want to work it that way?  Luckily I didn’t have to.

Templates allow you to do all sorts of things in Tornado, including executing methods/functions.  All I had to do was pass a reference to the function, which is as easy as just giving the name without ()’s (so func_to_execute=some_func and not func_to_execute=some_func()).  The parameters are passed when being called in the template itself:

{% set var = some_func(params) %}

Easy, you say?  You darn tootin it is.  I really wouldn’t recommend doing this for EVERYTHING, but I’ve done it for generating graphs on page views instead of when the graphs are updated (which I’ll try to get to in a different part).

Now, to be honest, I’m horrible at designing pages.  I’m more of a backend developer kind of person.  With that said…

A few months ago (maybe longer?), a friend of mine wrote a small monitoring set up for his servers.  Originally he wasn’t going to share the source, but he ended up making a private repo of it on BitBucket and shared it with me.  Basically, with his permission, I used his design for mine.  It works for me and is clean, so I figure why not.  This posed an issue, though, as I had to also figure out how to present data that it really wasn’t designed for (i.e.: graphs).

Lets just say I might use a HTML5 template to make things easier.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: