Feeding back…

Here is a copy of the modified wucoco theme I’m using.

  • Nuked the calendar
  • Moved 100 pixels of width from the right column to the left
  • Added a ‘pre’ css element assertion
  • Fixed a small problem with the title middle image (the edges aren’t quite dark enough green
  • Fixed a spacing problem in the metadata (we now get [cat] | Edit | [num comments] instead of [cat] | Edit|[num comments])
Posted in bit bucket | Leave a comment

$Greetings

please stand by

Why not try a couple long lines first. One big problem I had while trying to figure out this layout is exactly how to deal with preformatted text. Since I intend to be pasting lots of code snips and whatnot, I wanted to get this right… The trickiest part is what to do when the user bumps the browser font size up or down. With preformatted fonts, it tends to get either too small or too big rather quickly. Since the pre tag is by definition not going to wrap, ever, it’s pretty impossible to let the user scale the font more than one size in either direction and maintain both readability and containment in the bounding box. What would be really nice is the ability to make text exempt from browser scaling…

##############################################################################80
{8} andre@dude [~] % w
 3:47  up  1:14, 5 users, load averages: 0.32 0.39 0.45
USER     TTY      FROM              LOGIN@  IDLE WHAT
andre    console  -                 2:34    1:13 -
andre    p1       -                 2:37      13 ssh andre@core.dreness.com
andre    p2       -                 3:34       5 ssh dreness@tetris.dreamhost.c
andre    p3       -                 3:42       2 ssh odp@opendir1
andre    p4       -                 3:45       - w
{9} andre@dude [~] %
Posted in bit bucket | 5 Comments

Pirates vs Cowboys / Bay to Breakers

I spent most of the weekend in SF hangin’ with Nick and Kori. First was the party at the old office of the puzzlepirates crew Saturday night. The theme was pirates vs cowboys; I decided to go cowboy. I spent a good amount of time saturday walking around Cupertino picking up pieces of a costume… nice hat / coat, little american flag to stick in the hat, white t-shirt with GUNS scrawled on the front with a fat sharpie. I also found some kind of faux wicker Miller High Life hat – baseball cap style, very ghetto – that I would have used had the larger cowboy hat become tedious (though it never did). Then I had a serious leather holster that was just big enough to securely hold a bottle of beer; that worked out well.

During the travels that day, I happened upon a small children’s toy called “PopUp Pirate”, which included a small plastic pirate lookin’ dude, and a bunch of tiny plastic pirate swords. I used that to make an ornamental necklace of the skulls and swords of pirates I had defeated in duels, ya know. I had what I thought was a very good cowboy gait, some kind of saddle-sore legs-first affair. I discovered that playing cowboy is kinda fun, especially in today’s political climate.

Kori has some photos of all that.

The place was set up nicely, and well primed for a last hurrah what with the no furniture and open bar. There were a couple of big silhouette panels with lights behind them… pretty cool party element, especially with all the interesting costumes. The party itself was a slow start, but got cookin’ pretty well eventually. We ended up leaving fairly early… maybe 1:30 or so. The idea was to rest up, since the next morning was the Bay To Breakers race / parade / moving block party which gets started pretty early.

As we left the party, I saw a most amazing sight. I guess we were right along the race route, and there were tow trucks stretching off into the distance in either direction, towing EVERYTHING. The street was full of tow trucks arriving and departing, the sidewalks were full of people sprinting after their cars. It was a scene. We crashed at Nick’s apartment after a short cab ride.

At about 8 I got up and went outside to chill on the stoop; the apartment was right on the route. It was fast runners for a little while, then loooots of joggers. There were a bunch of people on the corner to the left of us that had been partying all night, who were also pumping music into the street… Their music was good. The people doing the grilling to our right were also pumping music, but their music sucked – mostly because they played the same two songs for about an hour and a half.

I had never seen the Bay To Breakers thing before; it’s definitely a scene. It’s a combination of serious runners, casual runners, people just out to walk, groups who show up with a theme of some sort, and hard-core party people. Lots and lots of kegs were in that parade.

Race / parade pictures from me, and Kori’s set.

It was a real fun time :) As a bonus, I’ve now started looking at the new game from the puzzlepirates people, Bang Howdy. I find it to be a lot of fun; sort of a semi turn-based rts, simple to learn, but I think the strategy can get pretty deep. It’s also the most amazing java anything I’ve ever seen, with really nice OpenGL gameplay to compliment the tons of great 2d artwork for the non-action parts of the game.

On the larger scale, I’m still grinding away in Cupertino. Kinda just doin the routine, trying to get through this project… I signed up to staff WWDC again in August – I’ll be an Enterprise IT Lab llama again this year. Maybe some day I’ll start reading friend’s blogs again; sorry I’m so out of touch.

Posted in bit bucket | Tagged , | 1 Comment

X11 mobility with Xmove

X11 is a windowing system for *nix computers. There is one point about X11 that needs to be understood before anything that follows will make sense, so I’ve cribbed the following bit from the X11 wikipedia page to explain:

X features network transparency: the machine where application programs (the client applications) run can differ from the user’s local machine (the display server). X’s usage of the terms “client” and “server” is the reverse of what people often expect, in that the “server” is the user’s local display (“display server”) rather than the remote machine.

You could, for example, run an X11 application (X11 client) on a large mainframe and send the display to a lowly workstation (running an X11 server), and enjoy the full benefits of running the application on a fast machine, while also having a GUI. Another common scenario is to run both the X11 client and X11 server on the same machine, in which case the experience is similar to that of a standard desktop application.

On its own, X11 provides no facilities for ‘mobility’ that would allow you to move the GUI of a running application between hosts *while the application continues to run*. Typically, you have to tell the X11 application the location of the display server before it is launched. Enter xmove.

xmove(1)                                                              xmove(1)

NAME
       xmove - pseudoserver to support mobile X11 clients

SYNOPSIS
       xmove [ -server server_name:port ] [ -port listen_port ]

DESCRIPTION
       xmove  starts  a  pseudoserver which allows its X11 clients to be relo-
       cated from one display to another. Upon startup it will create  a  lis-
       tening  port  from  which  it  accepts new client connections. All such
       clients will be displayed on the default server, until moved elsewhere.
       Several clients may connect through a single xmove, thus requiring only
       one per machine.

I installed xmove via macports, with the command:

sudo port install xmove

xmove probably won’t be incredibly worthwhile to you unless you use X11 applications on a semi-regular basis on different machines. In order to use xmove, you’ll need at least two X11 capable hosts – Mac OS X does nicely, as long as you have the X11 package installed (it’s on the Tiger DVD), or some other X11 server.

What follows is a walkthrough of a couple common usage scenarios. I’ve also created a narrated video walkthrough that you can download here in high [52 MB, 1.4 Mb/s] or medium [29 MB, 800 Kb/s] resolution. Both videos require QuickTime 7.

First, pick a machine on which to run xmove. To minimize network traffic, this should be the machine where most of the x11 apps are running and being displayed most of the time. For the purposes of this guide, we’ll call that machine ‘idio’.

When started, xmove will fire up an X11 pseudo-server. To determine where to send display output, it will either sense the value of $DISPLAY, or pick an appropriate default – typically hostname:0. I find that xmove works fine without having $DISPLAY set before launching xmove, since Apple’s X11 server listens on hostname:0 by default.

andre@idio[~]nohup xmove &

Next, before you launch X11 programs, you need to tell the X11 app to send its display to the xmove pseudo-server. Do this by setting $DISPLAY before launching the app. By default, xmove will listen for incoming X11 connections on hostname:1, so we’ll set $DISPLAY to idio.dreness.com:1, and then launch an X11 app. This should cause the X11 app to appear on the local host after being transparently routed through xmove.

andre@idio[~]export DISPLAY=idio.dreness.com:1
andre@idio[~]nohup xeyes &

We can examine the xmove application list with xmovectrl (which was installed along with xmove):

andre@idio[~]xmovectrl idio.dreness.com:1 -list
1     xeyes                idio.dreness.com:0

Fire up some more apps, then get another list.

andre@idio[~]xmovectrl idio.dreness.com:1 -list
1     xterm                idio.dreness.com:0                                  
2     xeyes                idio.dreness.com:0                                  
3     xman                 idio.dreness.com:0                                  
4     xlogo                idio.dreness.com:0                                  
5     line #%lu of file %s idio.dreness.com:0

(for some reason, eterm shows up as that weirdness next to #5. oh well.)

Okay, now we have some stuff going. Let’s move all the displays of the apps to another machine (called, for instance, pimp).

First, we need to make sure our destination host has allowed us to connect. Fire up X11 on the destination host and do

xhost +idio.dreness.com

to allow X11 connections from idio, which is the host of our X11 apps, and where xmove is running.

Once that’s done, we’re ready to move the apps:

andre@idio[~]xmovectrl idio.dreness.com:1 -moveall pimp.dreness.com

At this point, all the X11 app displays should magically disappear from idio and reappear on pimp. Fancy! Now we’ll take another listing…

andre@idio[~]xmovectrl idio.dreness.com:1 -list                    
1     xterm                pimp.dreness.com:0                                  
2     xeyes                pimp.dreness.com:0                                  
3     xman                 pimp.dreness.com:0                                  
4     xlogo                pimp.dreness.com:0                                  
5     line #%lu of file %s pimp.dreness.com:0

Neat-o :) We can also move individual applications by referencing their index number.

andre@idio[~]xmovectrl idio.dreness.com:1 -move idio.dreness.com 1
andre@idio[~]xmovectrl idio.dreness.com:1 -list               
1     xterm                idio.dreness.com:0                                  
2     xeyes                pimp.dreness.com:0                                  
3     xman                 pimp.dreness.com:0                                  
4     xlogo                pimp.dreness.com:0                                  
5     line #%lu of file %s pimp.dreness.com:0

Now let’s do a slightly different example. Let’s say you have a machine in your cube at work, and to get there from home you have to VPN to the company network. You want to run an X11 app there and display it at home, but be able to pick it back up when you get back to work.

On the work machine:

Make sure $DISPLAY is unset and then start xmove.

andre@werk[~]echo $DISPLAY
andre@werk[~]nohup xmove &
[1] 23906
andre@werk[~]Implementing MIT-MAGIC-COOKIE-1 user authentication
XMove 2.0 ready.

set DISPLAY to :1 and start an x11 app, then run xmovectrl -list to verify that the app is running through xmove.

andre@werk[~]export DISPLAY=dre:1
andre@werk[~]nohup xeyes &
[2] 23932
andre@werk[~]
andre@werk[~]xmovectrl dre:1 -list 
1     xeyes                dre.company.com:0

Now on the home machine, we need to allow x11 connections from the work box:

andre@idio[~]xhost
access control enabled, only authorized clients can connect
andre@idio[~]xhost +dre.company.com
dre.company.com being added to access control list
andre@idio[~]xhost
access control enabled, only authorized clients can connect
INET:dre.company.com
andre@idio[~]

We’re almost ready to move the app to the local display. There is one catch, however. The VPN stipulates that all traffic from my machine at home to any IP at work must go through the VPN. Therefore, we cannot redirect the display from work to idio.dreness.com (my public IP), we have to use the IP address of the local VPN endpoint. Find that with ‘ifconfig’:

andre@idio[~]ifconfig ppp0
ppp0: flags=8051 mtu 1280
        inet 1.219.213.179 --> 1.219.212.15 netmask 0xff000000

1.219.213.179 is my VPN ip address, and this is where I’ll send the X11 display from the work machine. Because I’m doing this in the same session where I started the backgrounded instance of xmove, I’ll also see the xmove output (the lines starting with ETHAN and XMOVE. I don’t know who ETHAN is, but I would probably buy him a beer).

andre@werk[~]xmovectrl dre:1 -moveall 1.219.213.179 
ETHAN: matching depth 24 to depth 24
XMOVE:  switching client 1 to display 1.219.213.179:0
andre@werk[~]xmovectrl dre:1 -list                               
1     xeyes                1.219.213.179:0

Caveats:

  • xmove doesn’t work like GNU screen in the sense that if any X11 connections are terminated for whatever reason, the app dies. Accordingly, make sure to redirect the display to another machine before, for example, logging out of VPN.
  • Always start xmove and X11 apps by prepending ‘nohup’ and appending ‘&’. This launches the app in the background and allows the app to keep running once the terminal from which the app was launched disappears.
Posted in tutorials | 2 Comments

The Journeyman’s Guilde to Quicktime Presentations

This guide will demonstrate a method for creating multi-track, multi-media, self-contained quicktime movies. A good example of this would be the presentation format where there are multiple tracks of media that need to be coordinated with specific timings. Perhaps there is a ‘talking head’ video track, and a series of slides that need to be synchronized with the video. Herein you will learn some of the dark secrets of QuickTime Pro that allow this media to be arranged and nicely wrapped up in a single quicktime movie file, suitable for rtsp streaming, fast-start download, or any other non-network delivery mechanism.

In case you are wondering what this method has to offer above and beyond more conventional tools like iMovie, allow me to illuminate. iMovie forces all video elements into a single video track when you export to QuickTime. This means that all visual elements will be compressed with the same codec. Another problem with iMovie is that all visual elements are forced into the same time base (in the case of iMovie which works only in the DV format, that is 30 frames per second). For an efficient and good looking presentation, we want to include tracks of various types with different properties in a single quicktime wrapper. This allows our slides to have a different time base and compression characteristics than the video portions.

Normally this type of work would require a powerful quicktime authoring tool such as LiveStage Pro, but we will do it entirely with QuickTime Pro. One of the coolest things about QuickTime is the way it allows for placement of non-time-based media onto a timeline using the Add Scaled function, which we’ll be using a lot. In effect, it can stretch a single image to occupy any desired duration on the time line, and it can do this without converting the still image into a conventional video track that has a frame rate. This is similar to what you get when using iPhoto to export a quicktime slide show, except we’ll be using more than just slides.

This guide includes step-by-step instructions as well as video walkthroughs captured with Snapz Pro. My whole idea for this project came to me one day as I was surfing FreeCache and I happened up on a quicktime movie of Ben Hammersley speaking about “the semantic web” (oooh, aaah :). The movie was great, but the slides he was showing were not readable at all. This, I thought, was sadly unfortunate, as the movie did not realize the full academic value of this speaking engagement. I have seen the coolness of fancy QuickTime authoring at sites like macenterprise.org, but had never really tried my own hand at it. So, I decided to give it a go. Searching around Ben’s webiste, I found the series of slides he was showing in the video which I would attempt to roll into some sort of QuickTime preso.

Finally, before we get started, shouts out to a QuickTime-savy friend deep within that fruit company who wishes to be known only as devotion :) His knowledge of QuickTime voodoo helped quite a bit.

For this walkthrough, we’ll use the following ingredients:

  • A QuickTime movie, relatively small, with an audio and video track of the talking head variety
  • Slides to show throughout the movie. They should all have the same attributes with respect to size, co0dec, etc
  • A background image
  • Timeline.mov

Prepare the slides

  1. Open QuickTime Player.
  2. Choose “Open Image Sequence” from the File menu.
  3. Select the first of your images, which should be named sequentially.
  4. Select the default of 3 seconds per frame.
  5. Save the resulting movie, making sure to select the “self contained” button.

Queue up the video

  1. Open the quicktime movie that contains the video / audio track.
  2. Find the exact spot where you wish the *second* slide to appear, and note the time in the controller. This will be the length of the first slide.

Slice out the first slide for a new timed slides movie

  1. Select some of the first slide from the slides movie created previously (hold shift while dragging in the timeline, adjusting the crop markers as necessary; exactly how much you select doesn’t matter).
  2. Copy the selection to the clipboard.
  3. Open Timeline.mov.
  4. Make a selection from the beginning of Timeline.mov that equals the duration of the first slide. Start by shift-clicking somewhere in the timeline, then adjust the right-hand crop marker as necessary.
  5. From the Edit menu, choose “Add Scaled”.
  6. Again from the Edit menu, choose “Extract Tracks…”, and pick the Video track. A new movie is created that contains only this track (and not the text track).
  7. Close Timeline.mov without saving
  8. Save the new movie as slides_timed, being sure to select the “self contained” button.

Add more slides

  1. Go back to the original video and find the exact point in time where the third slide is to begin. Find the difference between this figure and the previous time to get the duration of the second slide.
  2. Open the original slides movie, select a bit of the second slide, copy, select the desired duration in Timeline.mov, add scaled, and extract the video track.
  3. Select all in this new movie, and copy.
  4. Go to the very end of slides_timed, and paste. slides_timed now contains the first two slides with each having a specific duration. You get the picture.
  5. Repeat this process to slice out more slides, pasting each one onto the end of slides_timed. Be sure the playhead is at the very end of the movie before you paste (and it should be if you don’t move it after pasting). Eventually you’ll end up with a slides_timed movie that is (hopefully) roughly equal in length to your main video.

Composite the slides and video

  1. In slides_timed, select all and copy to the clipboard.
  2. Return to the main video and place the playhead at the beginning.
  3. From the Edit menu, select all and then add scaled.
  4. Open the properties window by choosing “Get Movie Properties” from the Movie menu (command J).
  5. Select “Video Track 1” (which corresponds to the a/v track) and “Size” from the two menus in the Properties window.
  6. Click the “Adjust” button.
  7. Click the main video track, and then drag it around to position it as desired relative to the slide. Use the arrow keys to nudge one pixel at a time.
  8. Click the “Done” button when finished.[/list]

Add the background image

  1. Feed the background image to QuickTime Player to open it as a movie.
  2. Select All, copy, and go to Timeline.mov again.
  3. Select any range of time and Add Scaled.
  4. Extract the image track.
  5. In the resulting movie, select all and copy.
  6. Return to the main video, select all, and Add Scaled
  7. Pull open the Properties window, select the image track, and position it as described previously, this time choosing Video Track 3. Again, use the arrow keys to nudge.
  8. Use the “Layer” menu in the properties window to adjust the z axis position of the layers.

Save as Self-contained and add hints

  1. From the File menu, choose “Export”.
  2. Select “Movie to Hinted Movie” from the Export menu, and “Default Settings” from the Use menu. This will create hints allowing both rtsp streaming, and ‘fast-start’ downloads via http or ftp

That’s it! There is no step 41! You now have a self-contained, hinted quicktime presentation for the low low price of around $30, and however much 4 hours of your time is worth ;). Obviously this can be taken in about a million different directions, and the design procedures documented here should be pretty extensible.

It will probably take a few tries to get this going smoothly. The bulk of the work is creating the timed slides movie; exactly how much work depends on how many slides there are. Once the timed slides movie is done, the compositing steps are pretty easy. If you mess up in a compositing step, you can use the “Delete Tracks…” function to remove tracks individually.

The movie I produced for Ben should be available on his website, but is also linked here.

Although I will take no time here to talk about the various quicktime codecs and data rate considerations, please be sure to be as kind as possible with respect to the data rate of your movie. This is especially true if it is to be delivered over a network. Any cleanup or compression of any of the elements should be done *before* compositing them into the final movie.

As a final note: don’t try to get tricky and use clipboard editing to shorten or extend the slides. It’s always better to use the Timeline.mov method to get the length exactly right. For example, pasting a single 60 second segment of a still image is much less resource consumptive than pasting 6 copies of a 10 second segment of the same frame. You can see the evidence by experimenting with these methods and keeping an eye on the movie’s info window (pay attention to the movie size and data rate).

Lots more goodies like this can be found in the book QuickTime for the Web, which also includes a registration key for QuickTime Pro. Highly recommended for anybody who finds this article interesting.

Have fun, and feel free to reply with any additional tips or suggestions.

As a seriously final final note, if you’re ever composing a lengthy post such as this, don’t do it in your browser. If you do, and then you accidentally quit the browser before submiting the post, you might just be screwed… unless of course you knew enough to check your browser cache…

andre@gyro[Caches/Safari]grep -r 'voodoo' *
Binary file 00/01/3456279555-1460426007.cache matches
Binary file 09/15/3180696217-0503413757.cache matches
andre@gyro[Caches/Safari]strings 00/01/3456279555-1460426007.cache | less
Posted in media, OS X, tutorials | 1 Comment

Cacti in Tiger Server

Install XCode

Install and configure darwinports

Download the newest version from macosforge.

Add the darwinports paths to your shell config file. e.g.

PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:$PATH"

Update the ports collection

sudo port -d selfupdate

Install rrdtool from darwinports

Execute the following to install rrdtool and all of its dependencies for you.

sudo port install rrdtool

Local user setup

Create a local cacti user and a home directory for it. In your Terminal window, su to this new user and then move to the cacti home directory

andre@casa[~]su cacti 
Password: 
casa:/Network/Servers/casa.dreness.com/Volumes/Server/andre cacti$ cd ~ 
casa:~ cacti$

Download cacti from http://www.cacti.net/download_cacti.php and decompress the archive

casa:~ cacti$ curl -O https://www.cacti.net/downloads/cacti-0.8.6g.tar.gz 
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current 
                                Dload  Upload   Total   Spent    Left  Speed
100 1051k  100 1051k    0     0   184k      0  0:00:05  0:00:05 --:--:--  216k 
casa:~ cacti$ gunzip cacti-0.8.6g.tar.gz 
casa:~ cacti$ tar -xf cacti-0.8.6g.tar 
casa:~ cacti$ cd cacti-0.8.6g 
casa:~/cacti-0.8.6g cacti$

Create a symlink to the cacti directory from the web document root (do this as an admin user)

andre@casa[~]ln -s ~cacti/cacti-0.8.6g /Library/WebServer/Documents/cacti

Inititalize MySQL

Use the MySQL Manager application to install and enable mysql. You do not need to enable network connections. As an alternative to the MySQL Manager, do the following as an admin user:

sudo mysql_install_db 
sudo chown -R mysql /var/mysql 
sudo chmod +rx /var/mysql

Edit /etc/hostconfig, adding

MYSQL=-YES-

Start MySQL

sudo SystemStarter start MySQL

Set the mysql root password

sudo mysqladmin -u root password 

Create the cacti database

mysqladmin --user=root -p create cacti

Import the cacti database (as the cacti user while inside the cacti source folder)

casa:~/cacti-0.8.6g cacti$ mysql -u root -p cacti < cacti.sql

Create the cacti mysql user

mysql -u root -p mysql 
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password';

Configure Apache and PHP

Enable the php module in Apache. This can be done either in the "Modules" portion of the Web settings in Server Admin, or by editing the /etc/httpd/httpd.conf file and uncommenting these two lines:

LoadModule php4_module           libexec/httpd/libphp4.so
AddModule mod_php4.c

Start the Web service using Server Admin

This will start Apache and configure it to start at system boot time. As an alternative to Server Admin for enabling Apache, start or restart apache using apachectl:

sudo apachectl graceful

Verify that apache will start at system boot time by editing /etc/hostconfig to include:

WEBSERVER=-YES-

Cacti configuration

As your cacti user, while inside the cacti source directory, edit include/config.php to include the apporiate details for making mysql connections. e.g.

$database_type = "mysql"; 
$database_default = "cacti"; 
$database_hostname = "localhost"; 
$database_username = "cacti"; 
$database_password = "pass";

Configure the cacti user's crontab

Use a crontab configuration such as:

echo "*/5 * * * * php /Library/WebServer/Documents/cacti/poller.php > /dev/null 2>&1" | crontab

Cacti web-based setup

Hit the cacti page and proceed with the web-based setup, e.g. . Advance through the first screen, and at the next, choose "new install". Change the binary location for rrdtool if necessary. It should be at /opt/local/bin/rrdtool. Once the setup is complete, log in as admin / admin and change password. Be sure to change the rrd tool version to 1.2.x in the Configuration --> Settings menu.

Extending Cacti

Once installed, you may wish to create custom scripts in order to monitor / graph things that are not accounted for by default templates.

Because netsnmp in darwin (edit: even still, as of tiger) doesn't report on cpu utilization in the .1.3.6.1.4.1.2021.11 tree (basically I'm looking for user | system | idle), I had to write my own scripts to produce this data.

Here's one I'm calling 'cpumon.pl'; it's placed in ~/bin.

#!/usr/bin/perl -w 
# get iostat output 
chomp ($cpuinfo = `iostat -C -d -n 1 -c 2 | tail -n 1 | awk '{print \$4 " " \$5 " " \$6}'`); 
@cpuinfo = split(/\s/, $cpuinfo); 
#print "1 is $cpuinfo[0], 2 is $cpuinfo[1], 3 is $cpuinfo[2]\n"; 
$user = $cpuinfo[0]; 
$system = $cpuinfo[1]; 
$idle = $cpuinfo[2]; 
if ($system == "0100") { 
  print "0\n0\n100\n";
  } else {
  print "$user\n$system\n$idle\n";
}; 

Note the -c = 2 in the iostat invocation. If you only get one sample, iostat reports values that are averaged from boot time, which is not what we want. We're looking for more of a gauge style value, so the second sample is averaged over the last 1 second, which is fine. I'm also using -n 1 to restrict the number of monitored disks to exactly 1; we need this to be sure of the relative locations of the fields we actually do need (which are normally printed after the disk stats); if there were more disks, the fields we need would no longer be 4, 5 and 6. To complicate matters, if the system is 100% idle (don't ask me how that occurs while this script is running, but it does), iostat will report 0 0100 instead of 0 0 100, thus causing $system to contain 0100 and $idle to be undefined; hence the conditional at the end.

Also note that the scripts produce multi-line output, with one value per line.

Now that we have a functional "cpumon.pl" sript, we can edit snmpd.conf to add:
Code:

exec 1.3.6.1.4.1.2021.8.1.101 cpumon /Users/andre/bin/cpumon.pl

Because we are specifying an OID in the exec line, snmpd will put the resulting output into a 'table', rooted at the given OID. This basically means that each line of script output will be placed into an OID beneath the given one. ... and the resulting OIDs are:

.1.3.6.1.4.1.2021.8.1.101.101.1 
.1.3.6.1.4.1.2021.8.1.101.101.2 
.1.3.6.1.4.1.2021.8.1.101.101.3

... and if we query those OIDs:

andre@IP41-89[~]snmpget -c blah -v 1 host.com 
.1.3.6.1.4.1.2021.8.1.101.101.1 .1.3.6.1.4.1.2021.8.1.101.101.2 .1.3.6.1.4.1.2021.8.1.101.101.3 
UCD-SNMP-MIB::extOutput.101.1 = STRING: 2 
UCD-SNMP-MIB::extOutput.101.2 = STRING: 8 
UCD-SNMP-MIB::extOutput.101.3 = STRING: 90

... it does exactly what we want. .1 is user, .2 is system, and .3 is idle

Okay, getting closer. Now we have three OIDs to query for each of the three values related to CPU usage.

Now we have to create new data templates to point at our new OIDs. It's not all that easy to create new templates, it seems, so it's easier to duplicate an existing data template; makes sense to start with the ucd template for 'nice' cpu, for example. After duplicating that template with a new name (darwin-cpu-idle), we need to modify our new template to point at the OID for idle, which is .1.3.6.1.4.1.2021.8.1.101.101.3. Also, feel free to change the 'internal data source name' to something unique, such as darwin_cpu_idle. Verify that the type is set to GAUGE and the query type is Get SNMP Data.

Duplicate your new template twice more for the 'system' and 'user' OIDs, changing the OID and names as appropriate.

Now we're ready to head into "Data Sources" and set up three new sources for each of the three new values we're monitoring. Create three new sources, set the "Selected Data Template" to one of the three new templates you created (they should appear in the popout menu), and change the names as necessary. Associate the source with one of your existing polling hosts for maximum ease.

Before we build the graph, we need to modify the existing CPU Usage graph template. The template expects system, user and nice, but we have system, user and idle. Duplicate the "ucd/net - CPU Usage " template, and then edit it. Rename the "nice" column to "idle", and delete the last 4 "Graph Template Items" - they correspond to "total cpu", which we don't have. (Actually I prefer to delete idle and total, so that only system and user are graphed). Modify all of the items in the graph template to use the appropriate data sources that we created earlier. Do this by clicking on "Item # 1" under the "Graph Item" column heading, and then choosing the appropriate data source from the popout menu.

Now, finally, we are ready to actually build the graph. The good news is that by this point, you should already have collected some data :) Head over to "Graph Management", click "Add", select your new graph template and choose a host from the list. Set the "graph item inputs" to each correspond to the appropriate data source. That should be it!

Finally, thanks to axon for his innane knowledge of the ascii characterset :)

I have uploaded the Mac OS X host template file which includes all the dependencies. This should give you all the cacti configuration you need to monitor mac os x hosts for cpu, # of TCP connections, and # of NetInfo connections (I'm sure that last one will be super useful for ya ;). This template represents the cacti side of the configuration; you still need to set up the snmpd.conf files and the scripts to gather the necessary date. Examine the new data templates to make sure that the output from the scripts you call from snmpd.conf goes to the right OIDs.

http://www.dreness.com/bits/lj/cacti_host_template_mac_os_x.xml

Posted in OS X, OS X Server, tutorials | 3 Comments

Quake4 macbook benchmarks

I recorded a short multiplayer demo (recordnetdemo demo1 / stopnetdemo) on a public server – there were 5 or 6 other players (quake4 performance falls off pretty quick as you add players). The demo was recorded on my slowest-performing machine, so it’s really clusmy, so I won’t be posting it. It’s still useful as a standard for comparison.

I tested three configurations: powermac g5 running os x, macbook running os x, macbook running xp sp 2

The machine specs are:

Model CPU RAM Video Card VRAM
Powermac G5 Dual 2.3 GHz PowerPC G5 2.5 GB ATI Radeon 9650 256 MB
Macbook Pro Intel Core Duo 2.0 GHz 2 GB ATI X1600 256 MB

Each machine used low quality settings and was running at 640 x 480.

To do the benchmark, ‘playnettimedemo demo1’ on each of the configurations. The result shown in the console is the average number of frames per second drawn throughout the demo. Higher numbers are better.

Model OS Timedemo FPS
Powermac Mac OS X 10.4.6 23.69 fps
Macbook Pro Mac OS X 10.4.6 30.35 fps
Macbook Pro Windows XP SP 2 34.31 fps

I expected the windows number to be a bit higher, but it’s still enough of a difference that it’s worth maintaining a windows partition on the macbook. In 1v1 matches, the performance on the macbook is good enough to keep the fps pegged at 60 (which is the target in quake4 – there is not a magic framerate that lets you jump further like in quake3. info).

Posted in bit bucket | Tagged | 3 Comments

hi

I’m pretty much the same, with one notable exception. Went ahead and got myself one of those newfangled macbooks, and I must say it’s rather nice. My previous laptop is a g3 ibook from 2001. Almost 5 years old = basically useless, except for the simplest of tasks.

The dual core 2 GHz macbook runs quake4 better than my dual cpu 2.3 GHz g5 tower. With a desktop display, mouse, and keyboard plugged in, it feels as fast as the G5 in other ways. Certainly, the g5 will win handily when it comes to anything with very hot altivec code in it (altivec is sort of a speciality of the ‘old’ apple cpu architecture that is unequaled in x86 land)… but for every day use, I would say that this would be a suitable desktop replacement, regarding performance. The big problem with that idea of course is storage… I have two 240 GB drives in my g5, and that’s enough… stepping down to 100 GB in the laptop would be rough, but I could eek a bit more out of it with a bigger drive… (gotta be 7200 rpm though). The final test of desktop replacement potential comes when I install and use Final Cut Studio, which should be soon.

So far, the only serious complaint I have about the macbook is the noise associated with the second CPU core. The rapid transitions between power states that occur when the cpu is almost completely idle cause it to make a bit of noise. This is audible in a quiet-ish room towards the top left of the keyboard, but it’s at a frequency that allows you to keep hearing it even when there is some background noise. It is also audible out of the headphone port, unfortunately. A quick workaround is to disable the second cpu core if you want it to be totally quiet – I tend to run this way by default anyway, because I assume it uses less power… Installing apple’s CHUD tools provides a “Processor” prefpane, which lets you turn on a menu extra to easily enable / disable the second core.

Another thing is that it gets pretty warm. This is not a new criticism of laptops, but it’s kind of startling to compare a 500 g3 ibook to one of these macbooks in terms of heat output. I have one of those iCurve stands that I use when I’m at a desk, and that’s great for airflow… but at night when I’m reclining in bed, it’s basically sitting on a blanket. If I lift it up and feel the bottom of the laptop with my hand, it feels pretty damn hot for a few seconds until enough heat is transfered away… Still, this it more of an observation than a problem / complaint.

All in all, a pretty fine computer. I am pleased :)

screenshot

Posted in lj | Tagged , | 12 Comments

X11 application mobility funs

Ever wanted to have an X11 application’s GUI follow you around between various machines while the app continues to run? Believe it or not, I have wanted this. Recently I found a little app that lets you do this called xmove. It’s rather old, but… new to me, and cool enough to document; including a narrated video walkthrough [QuickTime 7, 56 MB] of xmove in action.

Now if we could just do this with OS X apps, that’d be fly…

Posted in bit bucket | Tagged , | Leave a comment

Firefly season 2?!?

http://fireflyseason2.com/

If you elect to watch it on your computer, be sure to let them know via the comments that you would prefer to download and store a copy, instead of a one-time viewing or some such.

Posted in lj | Tagged | Leave a comment