metafy home > anthracite docs > examples > rss feeds

 

How To Create an RSS Feed for Stickler!
Using Anthracite and Standard UNIX System Administration Data


Creating lots of RSS Feeds with Anthracite is easy, and viewing lots of RSS Feeds is simple using Stickler!, Metafy's scrolling ticker for RSS Feeds.

We're going to walk through just how easy it is in this example, it shouldn't take you more than ten or fifteen minutes, tops. Seriously, this document is only about 1,000 words, scroll down, you'll see, there's really nothing to it.

To get a feel for it, here's the complete Anthracite process document for this example:



In this example, we're going to create a simple RSS Feed of some information about the status of the UNIX system underneath Mac OS X, much the same as a System Administrator or Power User might need or want to do.





Step One: Choose Information to Feed

The first step of course is knowing what data you want to capture. In this example, we're going to create an RSS Feed from the uptime, process and top UNIX Commands using Anthracite's Source Objects, and then grep some of that output using Anthracite's Processor Objects.

To help you get the most out of MacOS X's built in UNIX commands, Anthracite includes a "Find UNIX Commands" feature that transparently combines the UNIX standards apropos, which and even troff under the hood to create formatted manpage help text. Select "Window > Find UNIX Commands" from the Menu Bar at the top of the screen and type in the type of command you're looking for, for example you might type in "search" which would bring up a list of matching descriptions, where you might see "zgrep" which jogs your memory that you're looking for the command "grep" to find text patterns in the source data.

Back to this sample case, looking at the final Anthracite document above, you see three Source Objects at the top of the window.

They are UNIX Command Source Objects and they are configured to run:
	/usr/bin/uptime
	/bin/ps -auxww
	/usr/bin/top -l 1

To get the correct paths to the programs, use the Find UNIX Commands window, and just below the list of matching commands and just above the command description manpage field, you'll see the output of the "which" command, showing the path to the executable.

For Uptime, there are no args, it simply returns one line with the machine's time since last boot and other info, and should be very familiar to any SysAdmin. In Terminal.app, it looks like this:

	localhost:~ admin$ uptime
	19:58  up  4:24, 3 users, load averages: 0.29 0.32 0.27

You can see the beginning of that text in the Stickler! RSS Feed window just above.

Moving on to the next Source Object, we're going to get the output of the Process Status ("ps") command.

Here's the configuration for the Anthracite UNIX Command Source Object edit sheet for the "ps" command, asking for all processes by user in double wide mode:



The third and final source is for the "top" command with additional system utilization information, we pass the "-l 1" arguments (each on a separate line) to request a one-second single snapshot of the current information, instead of the constantly updating interactive mode often used on the command line.

As you can see in the Anthracite document window example at the top of the page ("UNIXCmdsToRSS"), we then process the output of the last two Source Objects using the UNIX command "grep" to filter just the lines with the word "Anthracite" in them, so that we can monitor how the application is performing.

The configuration of the UNIX Command Processor Object is simple, the command is "/usr/bin/grep" and the single argument is "Anthracite".

The final step of text processing for each source is to use the Wrap Process Object with only an entry in the first field to prefix each item with its origin ("uptime:", "ps:" and "top:").

Then, and very importantly, we name each of those last steps "description" so that they will populate that field of our XML output, that is, the "description" that we want each item to have in our RSS Feed. With that done, Anthacite can make the RSS Feed just by connecting the processor objects to the export, and here's all you have to do to configure the the Export Object:



Using the checkboxes at the bottom, you see that the output from all three sources is combined into one document, and we allow Anthracite to overwrite the document each time it runs so we get the latest information in our RSS feed.

Also note that we write the output into a "rdf" folder in the "/Library/WebServer/Documents/" directory of the local machine, thereby placing it onto the webserver so that our News Reader (Stickler! in this case) can easily subscribe to it.



For fun, try adding a process to include the free disk space on the machine. If you don't know the UNIX Command to do this, use the Anthracite Find UNIX Commands window to look for "disk" and see if there's anything relevant for displaying free disk space.

At this point, you should be able to add free space or other functions within a few minutes each. If you want a refresher on Anthracite's various object types, see the Tools Documentation, there is also more detailed information about Anthracite's UNIX Command support.


[ Top of Page ] [ Metafy Home]

Last Update: 11/04/2004
Last Update: 8/23/2004

Copyright © 2004, All Rights Reserved. Metafy LLC