Thursday, 20 March 2014

Guest Post: Brandon and his server monitor project

This post is a guest post by one of my students that displayed a Raspberry Pi project at our STEM Fair yesterday.

When Darren asked me to work on a project using the Raspberry Pi for the STEM Fair, my mind instantly jumped to ideas involving things like a Parrot AR Drone, a Kinect and voice recognition software, all of which were a little outside of my comfort zone. I kept looking into it and played around with some libraries and APIs, but the real idea for the project came to me after some unexpected downtime of one of my servers.


[Network Traffic graph from server web panel]

Due to a poorly developed/configured application, the server was outputting a lot of traffic (near 100Mbps). The server host detected it and shut down the server under the assumption that it had been compromised and was being used for malicious activity. I didn't find out about the issue until several hours when I tried to SSH into it and my password was being rejected due to 'rescue mode'. After several more hours communicating back and forth with the support team, we finally resolved the issue, but we had to wait for the Datacenter team to check that the server had been secured, which could take a few hours. At this point, I was tired and heading to bed and wouldn't be up for when the server came back online, yet I wanted users to know when it had returned so that they could continue using the websites and other services I have running.

I wrote a quick little application in Java that would ping the server to see if it was online and send a tweet when it returned. I gave the application to a small handful of friends that had either computers that they never turned off or servers of their own to run the application for me. Whilst writing the application, I thought about how useful it would be to have a computer or server somewhere in the world that does nothing but monitor online services and alerts people when there is a change in their online status. It wouldn't take much in the way of resources: minimal RAM, low-end CPU, next to no HDD space required. Pretty much the exact description of a Raspberry Pi. The application I was already working was quick, dirty and almost finished, so I finished that and got it running, but contemplated writing an application that was extensible and had a nice API so could be hooked in other applications if necessary.

Over the next couple of months, I worked on the project for several hours a day, most days of the week. I focused on small but extremely nice (in my opinion as a user) details, such as full user configuration (even though JSON is notorious for being difficult from a user point of view), lightweight and clean. I also started commenting code (something I've never done) so if any other developers wanted to look at it, they knew exactly what it did. I wrote 2 or 3 versions of the same program, deleting everything I had and starting again or rewriting whole classes just because they didn't look neat or efficient. However, I finally got it finished enough in time for the STEM Fair. It had full status checking capability and would send a tweet as the only form of notification currently, but it worked. Mostly. Sort of.


[Twitter with tweets from StatusNotifier]

At the STEM Fair, I got the application running. For some reason, it didn't want to demonstrate the offline checking feature unless I gave it a 'Malformed URL', which wasn't ideal to demonstrate services coming up and going down over time. Luckily, I had a few downtime issues with my test host anyway, so it wasn't all bad. An unfortunate happenstance was that the majority of the attendees of the STEM Fair were young children and teenagers, and my application is slightly more focused at business' or System Administrators, which I'm fairly certain none of these young people were. However, it appeared that the older attendees that were interested in what my application did were impressed with it, which made me feel great. I'm not sure they really were interested, but as long as I think they did, it doesn't matter, right?

I plan on continuing development of this project as I plan to use it personally in the near future. I also agree with something that my web lecturer (Don MacSween) said: the fact that I have an application that can be seen as useful for a wide range of people is a good step in the door leading to professional development, as well as the potential to earn a little free money in the way of voluntary contributions as appreciation of my work. I'm 19 years old, of course money is always a good motivator.


[Prototype of my WIP site, designed by https://twitter.com/encrypted_curse]

Darren said he's okay with putting some personal details of mine on the blog such as websites and stuff. I currently own the domains http://www.y3ti.me/ and http://www.branicyeti.co.uk/ that I plan to use for professional and not-so-professional portfolios, as well as other sites like a portal to my connections and a blog. I hope for all of the sites and sub-sites I run on those domains to be completely custom, and hopefully open sourced if you're interested in that sort of thing. They're not finished yet, but I will be working on them as soon as I get time. I am also the lead developer in a development group called NotoriousDev. At the moment, we focus on Minecraft development using the Bukkit API, but we also have some other somewhat useful utilities available on our Gitlab and Jenkins instances such as a YAML abstraction layer (YamlConfig) and a simple IRC Twitter bot (TwitterBot). All of the links for that community are on http://www.notoriousdev.com/.

Thanks for reading?

Brandon

6 comments:

  1. Hi Brandon,

    Thank you for sharing your story with us. I agree with Don MacSween that having something concrete and working to show for your skills is the best way to get peoples attention. Be it for project work, freelance stuff that you want to do, or a regular job.

    So what are your plans with the tool that you build? Are you going to provide it as a paid application? or as freeware or open source?
    Making it a paid for version would/could put some money in your pocket, but also raises the bar as to what people expect from the application. They are paying for it after all. Then again, even from a free application, some people expect everything.

    I do think however that there will be a genuine interest for a tool like you describe, running on a Raspberry Pi. I don't know if I would pay for it personally (don't think so I am afraid), but I would probably install it on one of my Pi's.

    ReplyDelete
    Replies
    1. Pierre, I will get Brandon to reply Monday when he returns back into college.

      Delete
    2. Hi Pierre,

      My current plans don't really go beyond finishing the application and using it, although since I plan for it to be extensible, there really is no "finish". I did have a rough plan somewhere from when I started the application with a list of things that I wanted it to be able to do, so if I can find that, I'll upload it to the BitBucket page. I guess the main thing to do is to add more services to it. The number one priority should probably be to make sure that it is as clean and easy to use as humanly possible for both the end user and other developers, starting by commenting the rest of the code. However, changes won't be appearing to the application until I have managed to set up my sites so I have a way of communicating with the programming world myself rather than hijacking Darren's blog.

      I have absolutely no intention of releasing the application with a price. It is an extremely small application, and I'm essentially a nobody in the programming world, so it most likely wouldn't go down well. The source code is already licensed under GNU GPLv3, so I'm more than happy for it to stay open sourced and available to anyone. I will also make sure that my Continuous Integration server is building any changes to the source code so there will always be a download place for the application. As for the idea of "people expecting everything", I have experienced that firsthand, albeit in a smaller community made up of younger audiences. I find it best to ignore the people that are demanding something, help the people that require support (if I can) and perhaps accept the odd feature request every now and again. I don't plan on "advertising" the application in places such as forums, so there shouldn't be too much of a problem there.

      I'm genuinely amazed that even after only a short amount of time on a blog that doesn't appear very active in the way of viewers (no offense Darren), people are already finding out about my work and expressing an interest in it. It puts things into perspective, and gives me a little more motivation towards adding to and improving the application.

      Delete
  2. Hi Brandon,

    Thanks for the response. I must have missed something though, you said it already was on Bitbucket? In a closed repository then, or at least one that isn't linked from the post yet.
    Keep in mind that a large group of the interested people will never look at your code. I for one would just test to see if it does what you say it does (check to see if my server stay online) and couldn't care less about the neatness of the code :-)
    Any post (in English) that involves a Raspberry Pi is bound to get some attention. Yesterday for one, you were mentioned by Adafruit: http://www.adafruit.com/blog/2014/03/21/19-year-old-uses-raspberry-pi-to-power-his-server-monitor-raspberry_pi-piday-raspberrypi/

    ReplyDelete
    Replies
    1. Pierre, the link to the code is at the end of this post http://maniccoding.blogspot.co.uk/2014/03/minecraft-on-pi-controlling-robot-arm.html

      Delete
  3. Hi. Its really a nice post, the content of this blog is really awesome and extraordinary. waiting for other interesting posts at a time when that will come.
    From bvba Woodstone

    ReplyDelete