hi:<br><br>i want to learn storm. so the problem i am trying to solve with it is:<br><br>requirements: --------------------------------------------------------------------------------------<br>* for a arbitrary group of windows computers:<br>
extract the list of all automatic but stopped services<br> store this list in a database for historical purposes (dont' ask why).<br><br> * the generation of this list can be run several times per day. <br> * at any time in the future be able to execute a query to return the information generated by the previous code. <br>
<br>notes:-------------------------------------------------------------------------------------------------<br> * 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. <br>
<br>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. <br>
<br>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<br>create table jobs (id integer, name varchar), create table jobs_computers (job_id integer, computer_id integer).<br>
<br>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. <br>
<br>thanks<br>mark<br><br>class Computer(Storm):<br> __storm_table__ = "computers"<br> id = Int(primary = True)<br> processes = ReferenceSet(id, "Service.computer_id")<br> group_id = Int()<br>
name = Unicode()<br><br> def __init__(self, group_id, name):<br> self.group_id = group_id<br> <a href="http://self.name">self.name</a> = unicode(name)<br><br>class Service(Storm):<br> __storm_table__ = "services"<br>
id = Int(primary = True)<br> computer_id = Int()<br> caption = Unicode()<br> date = Datetime()<br><br> def __init__(self, date, **args):<br> self.caption = args['caption']<br> self.date = date<br>
<br>class Group(Storm):<br> __storm_table__ = "groups"<br> id = Int(primary = True)<br> computers = ReferenceSet(id, "Computer.group_id")<br> name = Unicode()<br><br> def __init__(self,name):<br>
<a href="http://self.name">self.name</a> = name<br><br> store.execute("CREATE TABLE groups " \<br> "(id INTEGER PRIMARY KEY, name VARCHAR)", \<br> noresult = True \<br> )<br>
store.execute("CREATE TABLE computers "<br> "(id INTEGER PRIMARY KEY, group_id INTEGER, name VARCHAR)", \<br> noresult = True \<br> )<br> store.execute("CREATE TABLE services " \<br>
"(id INTEGER PRIMARY KEY, computer_id VARCHAR, Caption VARCHAR, Date, DATETIME)", \<br> noresult = True \<br> )<br>