wearnest@teleflora.com - 20 October 2008 07:32 PM
So instead of maintaining the relationship within the Tideway interface, I can configure the Tideway appliance to “automatically” maintain the relationship, based on a pattern, which I have to manually create, which in turn will monitor some external table that I also manually maintain?
Can you provide any examples of external sources for this contact info?
You can put the lookup table directly into the pattern. I’ve given an example below. In Foundation 7.2, the Data Integration for Patterns feature will allow you to write patterns that pull in data from external databases (for example, your existing asset database) and annotate the Foundation model with that information.
In the example pattern below, the lookup table People contains information on people, and the table Ownership relates hosts to the people that perform different roles for that host.
The pattern triggers whenever a host is created or updated, uses the hostname to lookup the people in the Ownership table, and makes the appropriate relationships to the people. If you modify the pattern (be sure the change the email address suffix!), upload and activate it, and rescan a host, then, browse to view the Host node and look at the “Ownership & Location” section. Links to this contact info should appear.
Hope that helps,
Tim
tpl 1.0 module BigCorp.Ownership;
metadata
origin := "Demo";
end metadata;
table People 1.0
// Name -> Username/Email (fragment), Phone, Role
'Frank Thomas' -> 'frank.thomas', '+44 (0) 7777 123 123', 'Test Lab Support';
'Bill Smith' -> 'bill.smith', '+44 (0) 7777 321 321', 'Development Infrastructure';
'John Harris' -> 'john.harris', '+44 (0) 7777 987 987', 'Production Support';
'Andy Other' -> 'an.other', '+44 (0) 7777 456 755', 'Production Support';
// TODO: use real data here ...
default -> '', '', '';
end table;
table Ownership 1.0
// hostname -> Support Owner, IT Owner, Business Owner
'lon1d0200vm' -> 'Frank Thomas', 'Bill Smith', 'John Harris';
'lon1d0201app' -> 'Andy Other', 'Frank Thomas', 'John Harris';
// TODO: use real data here ...
default -> '', '', '';
end table;
pattern HostOwnership 1.0
'''Host Ownership rules'''
overview
tags Demo;
end overview;
triggers
on host := Host created, modified where hostname exists;
end triggers;
body
// Get Ownership info
owners := Ownership[host.hostname];
// Support Owner
if owners[0] then
name := owners[0];
// Lookup Support Owner
owner := People[name];
// Get Support Owner (Person) node
person := model.Person(
key := "Person/&#xna;me%",
name := name,
email := owner[0] + "@mycompany.com",
phone := owner[1],
role := owner[2],
username := owner[0] );
// Link Host to Support Owner
model.rel.Ownership(SupportOwner := person, OwnedItem := host);
end if;
// IT Ownership
if owners[1] then
name := owners[1];
// Lookup IT Owner
owner := People[name];
// Get IT Owner (Person) node
person := model.Person(
key := "Person/&#xna;me%",
name := name,
email := owner[0] + "@mycompany.com",
phone := owner[1],
role := owner[2],
username := owner[0] );
// Link Host to IT Owner
model.rel.Ownership(ITOwner := person, OwnedItem := host);
end if;
// Business Ownership
if owners[2] then
name := owners[2];
// Lookup Business Owner
owner := People[name];
// Get Business Owner (Person) node
person := model.Person(
key := "Person/&#xna;me%",
name := name,
email := owner[0] + "@mycompany.com",
phone := owner[1],
role := owner[2],
username := owner[0] );
// Link Host to Business Owner
model.rel.Ownership(BusinessOwner := person, OwnedItem := host);
end if;
end body;
end pattern;