Now for a demo with a bit more teeth. This will soon be released as a stand alone open source web server package, named dropSTAR (Scripts, Templates and RPC). It is designed to easily allow dropping in new dynamic pages, and is focused on system automation instead of the standard end-user applications that normal dynamic web servers are intended to serve. It can do that kind of work too, but it’s not optimized for millions of page loads, it’s optimized to take as little time as possible to make and modify web pages for system administration use, and RPC for dynamic pages or system automation between nodes or processes.
The demo can be downloaded at the procblock downloads page. You will need to install procblock as well, which is also available at that link.
A live version of the demo can be played with here.
The demo is a series of tabs, each doing something different:
This tab shows a very simple CPU statistics collection program (runs a Shell command, parses and returns dict of fields), which runs in an Interval RunThread every 5 seconds, and then graphs the results. The page automatically reloads the graph every 5 seconds so it can be watched interactively.
This is another very simple shell command, that cats /proc/cpu and puts the columns into an HTML table.
This tab reads out of the tail of a log file, reverses the lines, and splits the contents to format for HTML in color. It updates every 5 seconds.
This is the most complex tab on the page. It has a monitor for “requests”, which is a counter in the shared resources (unidist.sharedcounter module), and a thread will run with a delay and increment the requests. The total number of requests since starting are showing in text, and the graph displays the change in this request variable over time.
A slider allows adjustment of the delay for requests, which will be saved in shared state (unidist.sharestate module). Reloading the page will keep the slider in any changed position, and the graph/counter should correlate to the position of the slider in terms of more or less requests per second.
These is also a button called “Stop Request Poller” which Acquires a lock (unidist.sharedlock module), which stops the poller from incrementing the request counter. If toggled again, requests will resume.
The right bottom side of the page has not been completed yet, and so just is there to look pretty and take up page space. Later this will turn into an adjustable SLA monitor which will notify or alert (via the HTML page) that the SLA is near or out of tolerance with regard to requests a second.
This page shows the use of the message queues (unidist.messagequeue module), which allow messages to be inserted into a queue for later processing. Any message typed into the input field with an enter key or Write button click will be inserted into the message queue “wall” in the shared message queues. Any messages older than the last 25 are discarded to keep it only storing useful data. Messages are not removed from the queue on reading, so that they can be continually re-processed for display.
Then in 5 seconds an RPC call will update the page with all the messages.