Search:
Where I Work
NKS
Subscribe
Add to Google
RSS 0.91
RSS 1.0
RSS 2.0
ATOM 1.0
RSS 2.0 and ATOM
Network
View Ian's profile on LinkedIn
Archives
2007 April (1)
2007 February (1)
2007 January (4)
2006 December (2)
2006 November (2)
2006 September (5)
2006 August (4)
2006 July (1)
2006 June (3)
2006 May (2)
2006 March (4)
2006 February (4)
2006 January (1)
2005 December (8)
2005 November (26)
2005 October (10)
2005 September (17)
2005 August (87)
2005 July (48)
2005 June (34)
2005 May (24)
2005 April (243)
2004 April (1)
2004 February (3)
2003 August (2)
2003 June (2)
2003 May (8)
2003 January (1)
2002 September (1)
2002 July (4)
2002 June (2)
2002 May (5)
2002 April (15)
2002 March (15)
Projects
CornFS
DENSO NAV
Rage Powered
Tampa Bay
TampaBad
SLUG
ob-buttons
Creative Commons OpenSource Linux Individual-i GeoURL Linux Speakeasy Speed Test
Twitter

follow icblenke at http://twitter.com
Google
Ian's shared items in Google Reader (subscribe)

iPad SDK 3.2 Beta 4 Clears Up Facts About iPad Camera And Give Some Gestures TO Developers.

OCZ drops SSDs to below $100

Google Maps Adds Biking Directions

App Engine joins the Google over IPv6 Program

Good Artists Copy, Great Artists Steal

Tech Tour: Cambridge Innovation Center

Nippon Oil and Hitachi aim at mass-producing microbe-derived biofuel

Get your Jetpack soon!

exmwSxv7XJI

(title unknown)

SCALE8x, OpenVZ goodies, and new kernels (including 2.6.32)

Strategy: Planning for a Power Outage Google Style

The island phone system adventure… « Baby is 60 – Tim Panton on voice and computers

Frameless laptop screens expected soon

The blind camera shows you someone else’s pictures

Princeton TPM-ICN series Bluetooth bracelet.

YouTube Blog: The Future Will Be Captioned: Improving Accessibility on YouTube

Put a Spark into your Presentations with Ignite

muCPjK4nGY4&hl=en_US&fs=1&

Google Code Blog: Google PowerMeter API introduced for device manufacturers

Geektalk

Sparkfun free day tomorrow: 1/7

websockets

C thulu ftagn recursion

Need a recursive DNS server? Use 8.8.8.8 and 8.8.4.4

Google Public DNS

JIQL - Java JDBC wrapper for Google DataStore

OpenNebula

Trillions

ZFS L2ARC ZIL on SSD

Swimming in OpenCL

Unicorn == Mongrel delayed_job

Remus - Transparent HA for Xen

Go

What DNS is not

Crossbow Virtual Wire Demo Tool

Banner ads on flies

PoolParty

Eucalyptus MySQL SOLR RabbitMQ Varnish == Nebula.nasa.gov

Nebula.nasa.org

Ubuntu Enterprise Cloud (UEC)

Evernote

Apple drops ZFS due to legal concerns

Peering disputes between Cogent and Hurricane Electric

Equinix to acquire Switch and Data for $689 million

We Are All Connected

Project kxen renamed project HXEN

Pomegranate Phone

Lessconf Jacksonville - followed the next day by Barcamp

Stick-figure guide to advanced AES crypto

Why you should pay attention to Google Wave

rails-primer - how to easily host rails projects on appengine

AppEngine-JRuby on google code

Ruby on Google AppEngine: appengine-jruby video

Dataliberation.org - The Data Liberation Front - a group concerned with moving data in and out of google

Detecting Spammers with SNARE: Spatio-temporal Network-level Automatic Reputation Engine

Proxmox VE - OpenVZ KVM Cluster appliance management

Sun/Oracle kill of SXCE: Sysadmins everywhere cry in horror.

Essentials of Metaheuristics

making water drinkable through nano-filtration

Pigin 2.6.1 adds Xmpp voice and video support

Opera Unite

Setting up a Layer-3 tunnel VPN using ssh 4.3 and -w option tun devices

shadowserver.org - botnet hunting resources

OpenBSC - a Siemens BS-11 microBTS or a ip.access nanoBTS == your own GSM tower

Voxbone's 883 country code

Apple keyboard firmware hack

Karesansui Project - a Xen management harness from Japan

eunicycle

Pygowave Server - Run your own Google Wave server

Happy Sysadmin Day!

Bokode

Bass cannon

Xen clocksource0 time went backwards

Internet vs World Population stats

BBC article on sat-3 cut

sat-3 cut

iPeak - RAIN

Asankya - RAIN

Apple pulls Google Voice app from iPhone - AT&T's fault

HadoopDB

live-android boot ISO - very neat

How to update your GeoIP information in addition to SWIPping

EATR

Google Wave hackathon on 20th/21st, if you happen to be in Mountainview

Did I mention OTOY here before?

NeatX - NX for Ganeti

STuPiD - STUN/TURN using PHP in Dispair

Aviary.com

Browser based Server-side 3D gaming from OTOY

Cisco's replacement for the WRT54GL is the WRT160NL

Spinn3r.com - Index the blogosphere

Team ARIN

Parts of galaxy Messier 87 are missing

DRAEGER ALCOTEST 7110 MKIII-C Evaluation of Breathalizer Source Code

Cyclops

Google's AJAX playground

How Michael Osinski Helped Build the Bomb That Blew Up Wallstreet

Bruce Perens - A Cyber-Attach on an American City

How Google and Facebook are using R

adito - the new gpl fork of the old sslexplorer project

A date idea: forklift sunset

Psytechnics - VVoiP QoE

r1soft cdp

IP Address geolocation for free

Shapeways - $50 "3-D poem rings" until the end of the month

GrandCentral to become Google Voice

Wolframalpha is coming

Hosted Xen Project

VirtualGL X11 transport

TurboVNC VirtualGL == FAST network GL

Ben Rockwood's presentation at the OpenSolaris Storage Summit: ZFS in the trenches

The Crisis of Credit Visualized on Vimeo

10gen - a java based app hosting infrastructure

Engineyard Vertebra - another cloud infrastructure management harness

Eucalyptus - an opensource EC2 compatible hosting infrastructure

asciicasts.com

railsbrain.com <-- ajaxified rdoc

AP IMPACT: SWAT Teams Deployed in 911 fraud

Lessons learned by people who have quit Google

Makwana indicted for Fanny Mae malware

"physicalized" servers

Zentific svn repo: alpha available

Holographic Space-Time ?

DACS - Distribution and Configuration System - version 2.0

Video of Cisco IOS attack talk at Chaos Computer Conference

Cosmic radio background noise 6 times higher than expected

We get a leap second tonight

Grow your own bioluminescent algae

Johnson and Ruby/Javascript

Two turntables and a git repo

Quartz Composer and Cruise Control status

Truthy and stupid.rb

The nature of truth

Get2Human

Sunay Tripathi's Solaris Networking Blog

Merry Christmas from XKCD

Merry Christmas from Chiron Beta Prime

Prius Emergency Generator

German folk tune Jazz improv

Memcached speed improvements

FSF sues Cisco

Asterisk Vishing Alert

Google's Native Client... the next ActiveX?

Waterballs

YAGNI development assistant

HA-xVM demo video posted

Kemari 1.0 released - HA Xen

The Decline and Fall of Agile

Zone Alarm 2009 Free Tomorrow

kenai.com - xVM Server Project site

58% Spam Drop from one colo shutdown

Xenomips - a Xen friendly domU version of Dynamips - Emulate a Cisco 7200

Debian and Android dual-boot on the G1

Sipper (SIPr) - a SIP testing framework in ruby

DBslayer - a SQL abstraction layer using JSON

Clojure - JVM based LISP dialect with immutable persistent data structures that are inherently thread safe

Fingerworks keyboard in a MacBookPro

NfSen - Netflow Sensor

The Phoenix BIOS hypervisor is Xen

Do you live in a Constitution-Free zone?

Puppet presentation at NYCOSUG this month

Kemari - Xen lock-step HA

XenSmartIO - Infiniband IO for Xen

Starting with b100, OpenSolaris has virtual consoles

OpenSolaris testfarm build server interface now available

Firefox M9 Fenric - Maemo alpha

SystemZ - aka Sirius - a port of OpenSolaris to IBM System Z mainframe OS running in z/VM mode

40.8% efficient solar cell

FREDNET

World sunlight map

Solaris and ZFS on a Dell 2950, tweaking notes

Logstalgia

Early Access Windows PV drivers for xVM

Economics: The Theory of Interstellar Trade

COMSTAR Admin Guide PDF file

The Financial Crisis: What Happened and What's Next?

3.5" DIY SSD drive

Microsoft usurping ODF

Cisco to run Windows 2008 on their appliance virtually for services

Packetfence: an OpenSource Network Access Control system

Public.resource.org

persist.js - an alternative to gears

Chinese building "impossible" EM drive

Supertinykeyboard

COMSTAR SMTF - solaris FC, SAS, and iSCSI targets

Flexiscale - yet another control panel?

RightScale - cloud control panels?

GoGrid, a servepath company.

OSCON in 37 minutes

Criticial ESXi remote vulnerability in openwsman

Parasitic power

Microsoft FUD on VMWare: vmwarecostswaytoomuch.com

nmap builds zenmap topology maps

Don't forget about BarCampTampaBay

RubyConf08, In Orlando

The LHC accelerates, and that's what it's all about.

Fun with mechanical turk

Sun's launch of xVM, live webinar

Microsoft to give away Hyper-V for free, live migration by 2010

Ubuntu's Intrepid Ibex will be followed by Jaunty Jackalope

Why Xen traps negative segment offsets

Rails 2.1.1 more REXML bug fixes

ISO torrent for OS2008.11

Indiana OS2008.03 RN3 released - based on nv_b96

Skype Mobile Phone (Not in the US)

Youtube gets closed captioning support

Getting xVM to work on OpenSolaris 2008.05

Xen Memory Overcommit

Algae farming for biofuels

Mozilla Ubiquity

How a VoIP E911 call is handled

A critique of RDMA

MonetDB - a column based RDBMS, ideal for time series data

BarcampTampaBay

Intel's programmable matter

Nexenta Hackathon

The value of side projects

VMfaq's comparison of virtual storage IO

Xen 3.3 released

USB3.0 cables

Intel wireless power.

Xen and Solaris, a log of experience.

Adeona.cs.washington.edu

OpenSolaris CR#6654713 - 32G limit bug stemmed from bad USB hardware? Perhaps fixed?

Xen CPUID example config

OpenSolaris CommonArrayManager

Multiple zero capacity quantum communication channels can actually transmit non-zero amounts of data thanks to entanglement

Sharity-Light - smbfs derived samba clone

Drizzle, a thin mysql, generating buzz

VMWare to offer ESX hypervisor for free

Veedeeeyes

Dr Horrible's Sing-Along-Blog

Fan, the programming language.

Blackberry Thunder with Haptics keyboard

iPhone App Store Live Walkthrough now available

Google Protocol Buffers

Time to patch your DNS

Recent JVM benchmarks

Overclocking tool for the Mac Pro

ADO.NET Entity Framework (Microsoft's new ORM) given a non-confidence vote by beta testers

Ruby interpreter flaws make the case for JRuby

The Stalled Server Room

AdvFS - Tru64 filesystem ported to Linux

OpenSolaris 2005.05 repository update to b91 - follow these instructions carefully

SXCE can ZFS install as of b90

Vertebra: EngineYard's Next Generation Cloud Computing Platform

Skype 4.0 beta overhauls video chat

Mozilla org receives traditional IE cake

Toyota Prius to go entirely Electric

Bill Gates steps down permanently for philanthropic activities

Men write code from Mars, Women write more helpful code from Venus

SproutCore - a GUI event driven model javascript web development platform, rails based by the looks of it.

Finding ARPANET

DRBD LVM Xen = Bug. A rather nasty one at that.

Intel unveils Ct as an extension for C/C to encourage threaded programming for multiple cores

VMWare ThinApp - Run any Windows app on any version of Windows

JDBC adapter for HBase

JRuby-Rack <-- a JRuby port of Rack

Rack <-- a lighter cousin to Merb, fully threaded and no Mutex.

Datamapper.org <-- ActiveRecord like, with no need to do migrations, it just kind of handles that by itself internally automagically.

Solaris Cluster Express (SCX) 6/08 released.

a-i-studio.com/cmd

CMDLogParserDemo

Changing solaris' default password hashing

Texas based service provider explosion affects 9,000 servers and 7,500 customers.

Jruby on Rails on Tomcat deployed as as WAR file

Rubinius

Milkfish.org SIP Router

42 more of the best Linux games

42 of the best Linux games

XenWindowsGplPv drivers

Use Google's cached ajax libraries

Arduino microcontroller with OS/X

The metasploit page describing the full impact of the poor RNG.

Holger Bert's blog post on the openssl RNG fiasco

Cayac - Cherokee MySQL PHP5 phpMyAdmin

ZFS very slow under an xVM kernel

VMWare's review-board.org

Google DocType

Dynamically editing libvirt xml configs while a VM is running to redefine reboot flags.

Chronoton - the time travelling robot who's best friend is a talking pie game

Endace DAG

Your pizza is done

Rietveld - Google's code review tool

Opensource multitouch displays

RTL8139 drivers supporting QEMU tcp segmentation offloading (XP's default driver does not) - doubles networking speed of Xen HVM networking without using the GPLPV drivers

Corporate map.

Ono - an efficient way to locate nearby peers

Solaris CIFS integrated AD with ZFS acls

Samba Winbind and ZFS acl working together

Why's unholy Ruby to Python .pyc compiler

Zentific poll daemon 1.0 beta

Solaris SAM-QFS NFS and OS/X

OpenSolaris 2008.05 final ISO image

Fri, 11 Nov 2005

As a pluggable daemon, mcp needs a flexible command syntax to permit both control of the plugins and passthrough of commands to the plugins for scripting.

First, we make a usage function to advise the user:

        def usage(argv,stdin,stdout,stderr)
                stderr.puts "Usage: mcp {command}
Where {command} is one of:

        plugin stop {plugin name}           - Stop a plugin thread
        plugin start {plugin name}          - Start a plugin thread
        plugin load {plugin name}           - Load a named plugin
        plugin unload {plugin name}         - Unload a named plugin
        plugin tell {plugin name} {command} - Tell a plugin a command
        thread list                         - List currently running threads
        exit                                - Kill mcpd
"
                1
        end

You probably want to use a "here document" for that multi-line print, but I'm having problems getting it to render in bluecloth (markdown) at the moment.

Now for the real fun. All of the commands are passed to the command() method. This is where we handle each of the above:

        def command(argv,stdin,stdout,stderr)
                @command=argv.join(' ')
                begin
                        log("mcp #{@command}")
                        case @command
                                when /^quit$/i, /^exit$/i
                                        # Need more exit handling here!
                                        exit
                                when /^plugin list$/i
                                        @plugins.each_key { |plugin| stdout.puts "#{plugin}\n" }
                                when /^thread list$/i
                                        stdout.puts Thread.list.map { |t| "#{t.to_s} #{t['name']}\n" }
                                when /^plugin tell (\S+) (.*)$/i
                                        log("Telling #{$1} to #{$2}")
                                        @plugins[$1].command($2,stdin,stdout,stderr)
                                when /^plugin start (.*)$/i
                                        @plugins[$1].start()
                                when /^plugin stop (.*)$/i
                                        @plugins[$1].stop()
                                when /^plugin load (.*)$/i
                                        plugin_load($1)
                                when /^plugin unload (.*)$/
                                        plugin_unload($1)
                                else
                                        usage(argv,stdin,stdout,stderr);
                        end
                rescue => detail
                        stderr.puts detail.message + "\n"
                        stderr.puts detail.backtrace.join("\n") + "\n"
                        1
                end
        end

Simple, eh? Now plugins are controllable from the command line.

Not bad for ~100 lines of ruby so far.

The next step is setting the thread['name'] properties for the "thread list" command. I'll cover that in the next post.

Thu, 10 Nov 2005

The next step in MCP development is getting the plugins to load/unload dynamically.

Each plugin will be a .rb file in the "plugins.d/" directory. Each plugin will consist of a class named like the file, containing 5 basic methods:

  • initialize() Called whenever a plugin is loaded.
  • start() Called to start a plugin.
  • command() Called by mcpd to relay commands from mcp.
  • stop() Called to stop a plugin (stop threads)
  • unload() Called to unload a plugin cleanly

The loaded plugin must also have an attribute "mtime", which will be used by mcp to track the mtime on the loaded file to make sure it matches that of the .rb file in the "plugins.d/" directory during the periodic dynamic plugin scan.

Here is an example plugin called Tron, as it would appear in "plugins.d/Tron.rb":


class Tron
        attr_accessor :running, :mtime, :thread, :daemon

        def command(arg,stdin,stdout,stderr)
                @daemon.log("Tron received command #{arg}")
                "Greetings user. Nothing to report.\n"
        end

        def unload
                @running=false
        end

        def stop
                @running=false
                @thread.join
                "Tron thread stopped.\n"
        end

        def start
                if not @running
                        @running=true
                        @thread=Thread.new do
                                @daemon.log("Tron thread started (#{@mtime})")
                                Thread.current['name']="Tron thread"
                                while @running do
                                        sleep 10
                                end
                                @daemon.log("Tron thread ending (#{@mtime})")
                        end
                        "Tron thread started\n"
                else
                        "Tron thread already running\n"
                end
        end

        def initialize(daemon)
                @daemon=daemon
                start()
        end

end

Now to add the dynamic plugin functionality to mcpd.

The first step is to define some constants and create an attribute to enumerate all loaded plugins.


#
# Constants
#
PLUGINS_DIR = 'plugins.d'

class MCPDaemon
        attr_accessor :plugins

Now we will add a method for loading plugins:


        def plugin_load(name)
                if not @plugins[name]
                        @file="#{PLUGINS_DIR}/#{name}.rb"
                        begin
                                load "#{@file}"
                                eval "@plugin=#{name}.new(self)"
                                @plugin.mtime=File.stat(@file).mtime
                                @plugins[name]=@plugin
                                log("Loaded plugin: #{name} (#{@plugin.mtime})")
                        rescue => detail
                                log("Error loading plugin: #{name}: #{detail.message}")
                        end
                end
                @plugins.has_key?(name)
        end

This will load a plugin if it is not already loaded, and will return the boolean true if the plugin is successfully loaded.

The plugin_unload method likewise unloads plugins on demand by calling the plugin's unload() method and deleting it from the @plugins hash.


        def plugin_unload(name)
                if @plugins[name]
                        begin
                                @plugins[name].unload()
                                log("Unloaded plugin: #{name} (#{@plugins[name].mtime})")
                                @plugins.delete(name)
                        rescue => detail
                                log("Error unloading plugin: #{name}: #{detail.message}")
                        end
                        not @plugins.has_key?(name)
                end
        end

The most complex method is plugins_scan(). It is responsible for checking the mtime of each plugin's source file against the loaded mtime of each plugin.


        def plugins_scan()
                begin
                        @plugin_files={}

                        Dir["#{PLUGINS_DIR}/*"].each do |file|
                                name=File.basename(file).sub!(/\.rb\Z/,'')
                                @plugin_files[name]=file
                        end

                        @plugin_files.each do |name,file|
                                if @plugins && @plugins.has_key?(name)
                                        if File.stat(file).mtime != @plugins[name].mtime
                                                plugin_unload(name)
                                                plugin_load(name)
                                        end
                                else
                                        plugin_load(name)
                                end
                        end

                        @plugins.each do |name,plugin|
                                if not @plugin_files.has_key?(name)
                                        plugin_unload(name)
                                end
                        end
                rescue => detail
                        log(detail.backtrace.join("\n"))
                end
        end

The final bit of code is added to MCPDaemon's initialize() method to initialize the @plugins hash and start the plugin scanner thread:


                @plugins={}

                # Plugin handler thread
                Thread.new do
                        while true do
                                plugins_scan()
                                sleep 1
                        end             
                end     

Now, go ahead and start mcpd, you should some output like the following:


$ ./mcpd
mcpd: Tron thread started ()
mcpd: Loaded plugin: Tron (Thu Nov 10 00:54:54 EST 2005)
mcpd: Daemon started

If you touch the plugin, it will automagically reload:


mcpd: Unloaded plugin: Tron (Thu Nov 10 00:54:54 EST 2005)
mcpd: Tron thread started ()
mcpd: Loaded plugin: Tron (Thu Nov 10 00:56:22 EST 2005)
mcpd: Tron thread ending (Thu Nov 10 00:54:54 EST 2005)

Likewise, if you remove the plugin, it is unloaded:


mcpd: Unloaded plugin: Tron (Thu Nov 10 00:56:22 EST 2005)
mcpd: Tron thread ending (Thu Nov 10 00:56:22 EST 2005)

Fun! Next step: command() syntax for mcp

Wed, 09 Nov 2005

Distributed Ruby (DRb)'s closest equivalent is probably Java's Remote Method Invocation (RMI). Written in only 200 lines of native Ruby, DRb is an incredibly easy way of communicating between processes in disparate systems.

For the Master Control Program (MCP) project, I needed a way for the command line "mcp" userspace tool to talk to the running "mcpd" daemon. Rather than make this a true heavyweight client/server setup, I plan on making the "mcp" client little more than a stub that talks to the "heavy" server. Using this method, far less code is actually required to provide the same function.

To that end, the "mcp" client script initially looked like this:


#!/usr/bin/env ruby

require 'drb'
require 'drb/unix'

begin
        DRb.start_service
        mcpd = DRbObject.new nil, "drbunix:/tmp/mcpd.sock"
        print mcpd.command(ARGV)
rescue
        print "ERROR: unable to communicate with mcpd\n"
end

and the server side was little more than this:


#!/usr/bin/env ruby

require 'syslog'
require 'drb'
require 'drb/unix'

class MCPDaemon
        def log(message)
                @syslog.info(message)
        end  

        def command(argv)
                @command=argv.join(' ')
                log("Client said to run #{@command}")
                "You said to run #{@command}"
        end

        def initialize
                @syslog=Syslog.open( File.basename(__FILE__),
                                                   Syslog::LOG_PERROR |
                                                   Syslog::LOG_NDELAY )
                # More initialization here.
                DRb.start_service "drbunix:/tmp/mcpd.sock", self
                log("Daemon started")
                DRb.thread.join
        end
end

MCPDaemon.new

If you spawn "mcpd" from one window, you can run "mcp" from another window and watch mcpd log the commands you tell it to run.

This doesn't fulfil the entire problem, however. In its current form, calls to the running mcpd's "command" method are marshalled. This means that ARGV is copied when being passed to command() remotely, and the return string is copied back as well.

Ideally, we want to be able to stream stdin/stdout/stderr from the mcp client to the running mcpd daemon by handing over object references. The trick to this is to mark those objects as "DRbUndumped" and pass them along on the function call. This will proxy those objects instead of marshalling them, treating them as if they were local:


#!/usr/bin/env ruby

require 'drb'
require 'drb/unix'

begin
        DRb.start_service
        mcpd = DRbObject.new nil, "drbunix:/tmp/mcpd.sock"
        $stdin.extend DRbUndumped
        $stdout.extend DRbUndumped
        $stderr.extend DRbUndumped
        return mcpd.command(ARGV, $stdin, $stdout, $stderr)
rescue
        print "ERROR: unable to communicate with mcpd\n"
end

Now the running mcpd can be modified to use these new proxied objects directly:


#!/usr/bin/env ruby

require 'syslog'
require 'drb'
require 'drb/unix'

class MCPD
        def log(message)
                @syslog.info(message)
        end  

        def command(argv,stdin,stdout,stdout)
                @command=argv.join(' ')
                begin
                        log("Client said to run #{@command}")
                        stdout.puts "You said to run #{@command}\n"
                        0
                rescue => detail
                        stderr.puts detail.message + "\n"
                        stderr.puts detail.backtrace.join("\n") + "\n"
                        1
                end
        end

        def initialize
                @syslog=Syslog.open( File.basename(__FILE__),
                                                   Syslog::LOG_PERROR |
                                                   Syslog::LOG_NDELAY )
                # More initialization here.
                DRb.start_service "drbunix:/tmp/mcpd.sock", self
                log("Daemon started")
                DRb.thread.join
        end
end

MCPDaemon.new

Whenever those proxied objects are referenced in the command() method, the client's stdin/stdout/stderr are actually used.

Neat, huh? :)

Next step: plugins.

Google
 
Web ian.blenke.com