A complex active record question

Hi all,

I am developing a web frontend for a monitoring system with a legacy
database schema which we cannot change now. This monitoring system has
a table for every kind of probe it knows. Those probes are defined in
a database table too, the table is named probe.
Table creation (mysql format) is displayed at:

Some probes are added by hand and some are not. So some probes will
need creation forms. All probes performed by the monitoring server are
created by hand. This is one example of its entry in the probe table:
INSERT into pr_tcpconnect_def set id = ‘1’, description = ‘empty’;
INSERT into probe set id = ‘14’, name = ‘tcpconnect’, description =
‘Connect to a TCP port’, addbyhand = ‘yes’, class = ‘’, graphgroup =
‘ct’, graphtypes = ‘default’, comment = ‘’;

As you will see there is always a default record, don’t ask me why but
I have to maintain that.

This tcpconnect probe has several tables with information. We have the
table where the probe is created, in this case pr_tcpconnect_def as
you can see at: http://nedbsd.nl/~wijnand/pr_tcpconnect_def.sql

This is one example, other remote probes have some different fields,
but most are the same. So creating a entirely different model for each
is not very DRY so I need to find a way to create a uniform way to
create probes, whatever the type is.

All probes have results, the most current one is stored in the
pr_status table. The mysql definition is at:
As you can see it refers to a server and a class. The class is for the
probe type as found in the probe table and the probe definition is in

Most probes have a table with raw results. Lets show the raw results
of tcpconnect: http://nedbsd.nl/~wijnand/pr_tcpconnect_raw.sql

Most probes also have history tables for older results created from
the _raw table:
http://nedbsd.nl/~wijnand/pr_tcpconnect_day.sql and
There are tables like this for day, week, month, year and 5year

I want to address it all in a uniform and DRY way. That should be
possible using ruby because ruby is so dynamic. However, I am still a
ruby and rails newbie and I don’t know yet where to start and what
would be a good approach. I cannot change the schema, that is out of
the question at this moment.

Does anyone have some good pointers on how to accomplish this, or is
there anyone who already did a similar thing using rails? If so,
please help me out. The application will be open sourced and I love to
give full credits in the code for every helpfull suggestion.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs