Entries posted in June 2012

Writing a status panel the modern way

Tuesday, 19 June 2012

So status displays are cool. Seeing what is happening in real time is cool.

As a proof of concept I put together a trivial load-graph:

This is broken down into three parts:

Load Client

The load client is a trivial script which reads /proc/loadavg, and sends the 1-minute entry to a remote server, via a single UDP packet.

Load Server

The load-server is a service which listens for UDP traffic, and when it receives a new integer records that in a redis data-store.

Load Display

This is a HTML page which has the values from the store in it, which is then plotted using javscript.

So the UDP-server which receives load will receive two things:

  • load:N - The load figure. The text "load:" is literal, and present in case I decide to extend the stats..
  • x.x.x.x - The IP address from which it received the message.

This is inserted into a Redis database as an array. This array could then be fetched via an AJAX script to update the HTML display in real-time, but at the moment I just have a shell script which updates it in near-real time.

The idea of having a UDP-server receive values from remote clients is interesting. We just need to define a mapping to redis. For me I've just done this:

receive a UDP packet with value "load:1.2" from source 1.2.3.4
append "1.2" to key "1.2.3.4-load".
append the value "1.2.3.4" to the global "known_hosts"

The values received can be truncated (i.e. keep only the most recent 60 entries) with ease, due to the available Redis primitives, and we can easily graph these using the qjplot library.

Adding more metrics just means updating the clients to send "memfree:400m", "disk-free:50%", "users:2", "uptime:12345s", or similar. The storage is wonderfully abstract - all you need to do is get the graph-drawing code to a) Know which source to display, and b) which metric.

For example, if we did extend the client to send that data I could draw a graph of the memory on host foo.example.com just by selecting "memfree" against the origin "1.2.3.4".

ObQuote: "Come here, damn you, I want to touch you. " - Hellraiser

| 4 comments.

 

Sometimes the important things are those you don't do

Saturday, 16 June 2012

Usually in life we focus upon the things we do, and not the things we don't do, or avoid.

I don't have many "rules" for the way I behave, the things I do, but there are some.

  • I refuse, point-blank, to purchase any food which includes the phrase "low fat" upon the label.
  • I eat, fry, and cook with real butter.
    • I refuse to use any of the alternatives. Especially the low-fat alternatives.
  • I have yet to view a film in 3D.
    • I suspect this is something I'm semi-seriously avoiding, but I've not yet explicitly decided to skip them.
  • I refuse to watch any film which is "supernateral".
  • I refuse to buy anything from a pound-land, pound-stretcher, or similarly low-end store which is labeled either "deluxe" or "luxury".
    • I made this mistake when I was a young student.

I could go on, but the "rules" are surprisingly hard to remember, having been in place for many years, they're just part of the way that I do (or do not do) things!

Finally: As of this year I've now lived in Edinburgh for over half my life.

ObQuote: "I don't know. We should go and like, stalk him or something. " - Megan Is Missing

| 7 comments.

 

Recent Posts

Recent Tags