[Ruby] God monitor

Par défaut

Update: this script, from September 2007, is a bit out-dated, you can get more info on official God gem website.

Looking for a ruby programmer? Contact me

After many ways to monitor Feevy updaters, we’re finally using God gem today to manage everything with Ruby on many platforms.

Documentation is really clear, and it’s easy to adapt it to your own code. The nicest point was to be able to control our non-daemonized updaters, and monitor them all in the same tool.

Here is our script:

require 'rubygems'
require 'god'

ROOT = File.dirname(__FILE__)

God.init do |god|
  god.pid_file_directory = "#{ROOT}/pids"
end

[*0...20].each do |updater|
  God.watch do |w|
    # watch with no pid_file attribute set
    w.name = "updater_#{updater}"
    w.interval = 30.seconds # default
    w.start = "ruby #{ROOT}/updater.rb"
    w.grace = 10.seconds

    w.behavior(:clean_pid_file)

    w.start_if do |start|
      start.condition(:process_running) do |c|
        c.interval = 5.seconds
        c.running = false
      end
    end

    w.restart_if do |restart|
      restart.condition(:memory_usage) do |c|
        c.above = 150.megabytes
        c.times = [3, 5] # 3 out of 5 intervals
      end

      restart.condition(:cpu_usage) do |c|
        c.above = 50.percent
        c.times = 5
      end
    end
  end
end

[updated]: thanks to apeiros on irc://#ruby@irc.freenode.net for quick array initialization tips!

[RepRap] Extruder Kit mounted

Par défaut

Closing screw I’ve just arrived few days ago at Madrid, and I’ve had the joy to received the RepRap Extruder Kit built this summer by RRRF!

The pieces are well cut, and there is some neat mechanical design (I’m new in this domain) helping to put pieces together.

The only issue has been the middle part, containing the driving screw, with one of the part just a millimeter short. It looks one-sided, if put on the wrong side, there’s a gap at the bottom of the piece near the plastic part.

Now, I’m just missing « 40mm length of 3mm braided steel wire », some « JB Weld high-temperature epoxy glue » to finish completely to assemble this extruder kit. Thanks to Fernando from Barcelona who gave me a ferreteria address to visit in Madrid to get this kind of pieces.

The next missing part is the PIC programmation, I’ve got some issue with the Olimex PG3B pogrammer and pkp (under Ubuntu), they seem unable to communicate, and the programmer board is stuck with PRG1 led once parallel port is open… Hope to solve this during the week before to leave to Berlin with everything connecting, and come back soon with all mechnaical parts!