[storm] schema question how to do in storm ?

mark.a.brand mark.a.brand at gmail.com
Sun Mar 16 13:15:31 GMT 2008


hi:

i want to learn storm. so the problem i am trying to solve with it is:

requirements:
--------------------------------------------------------------------------------------
* for a arbitrary group of windows computers:
   extract the list of all automatic but stopped services
   store this list in a database for historical purposes (dont' ask why).

 * the generation of this list can be run several times per day.
 * at any time in the future be able to execute a query to return the
information generated by the previous code.

notes:-------------------------------------------------------------------------------------------------
 * i have only used the services table as an example, there will be in fact
several other tables eg. processes, operating-systems, events, diskspace,
freememory etc, but whatever is applicable for services will work for these
other tables as they have a similar structure.

currently i have this setup (below), where a group can have 1..n computers
and a computer can have 1..n service records. Now if the list was only
generated once per day, this schema would be fine (i think) as  sometime in
the future i would just query on the service table for for all records for a
particular day the list was generated - but the list can be generated
several times per day.

so i thought about having a  "class Job" so everytime the list is generated
a unique job_id would be generated and would be stored in a link Class
JobComputer
create table jobs (id integer, name varchar), create table  jobs_computers
(job_id integer, computer_id integer).

but i thought it was starting to look ugly - confusion started to reign so i
thought i would ask here about the best way to achieve my goal and if a
linktable is the go, how do i tie the link table / class to the services
table/class and similar tables/classes.

thanks
mark

class Computer(Storm):
    __storm_table__ = "computers"
    id = Int(primary = True)
    processes = ReferenceSet(id, "Service.computer_id")
    group_id = Int()
    name = Unicode()

    def __init__(self, group_id, name):
        self.group_id = group_id
        self.name = unicode(name)

class Service(Storm):
    __storm_table__ = "services"
    id = Int(primary = True)
    computer_id = Int()
    caption = Unicode()
    date = Datetime()

    def __init__(self, date, **args):
        self.caption = args['caption']
        self.date = date

class Group(Storm):
    __storm_table__ = "groups"
    id = Int(primary = True)
    computers = ReferenceSet(id, "Computer.group_id")
    name = Unicode()

    def __init__(self,name):
        self.name = name

        store.execute("CREATE TABLE groups " \
        "(id INTEGER PRIMARY KEY, name VARCHAR)", \
        noresult = True \
        )
        store.execute("CREATE TABLE computers "
        "(id INTEGER PRIMARY KEY, group_id INTEGER, name VARCHAR)", \
        noresult = True \
        )
        store.execute("CREATE TABLE services " \
        "(id INTEGER PRIMARY KEY, computer_id VARCHAR, Caption VARCHAR,
Date, DATETIME)", \
        noresult = True \
        )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/storm/attachments/20080317/0008479a/attachment.htm 


More information about the storm mailing list