Tideway Community Forum

forgot password?
   
1 of 2
1
How do I assign a host to a software instance?
Posted: 29 October 2008 07:02 PM   [ Ignore ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17

How do I assign a host to a software instance? I keep seeing patterns where SIs are created but I don’t understand how the SI knows which host it belongs to.

si := model.SoftwareInstance(
        
key := key,
        
type := type,
        
name := name,
        
version := full_version,
        
product_version := product_version,
        
edition := edition); 

Where does the host get linked to the si?

Profile
 
 
Posted: 29 October 2008 07:07 PM   [ Ignore ]   [ # 1 ]  
Newbie
Avatar
Rank
Total Posts:  6
Joined  2008-02-08

The hosting relationship is inherited from the process, you dont need to do anything.

Profile
 
 
Posted: 29 October 2008 07:20 PM   [ Ignore ]   [ # 2 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17
p.anderson@tideway.com - 29 October 2008 07:07 PM
The hosting relationship is inherited from the process, you dont need to do anything.

What if the SI being created is not triggered by a process? How can the host be explicitly assigned?

Profile
 
 
Posted: 29 October 2008 08:10 PM   [ Ignore ]   [ # 3 ]  
Newbie
Avatar
Rank
Total Posts:  8
Joined  2008-03-03
wearnest@teleflora.com - 29 October 2008 07:20 PM
p.anderson@tideway.com - 29 October 2008 07:07 PM
The hosting relationship is inherited from the process, you dont need to do anything.

What if the SI being created is not triggered by a process? How can the host be explicitly assigned?

We can trigger patterns from a host being created as well, I think this page will help explain how.

Profile
 
 
Posted: 29 October 2008 08:20 PM   [ Ignore ]   [ # 4 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17

That still doesn’t answer my question. I’m not using a host trigger either. I’m customizing the example that Nik posted in another thread http://www.tideway.com/community/forum/viewthread/61/ to generate SIs instead of BAIs.

triggers
    on si 
:= SoftwareInstance createdconfirmed where type "Microsoft IIS Service";
end triggers

I am getting the websites to show up as new SIs but the host is not set. I know that the host variable is set correctly because I verified it in a log.debug message. I just can’t figure out how to assign the host attribute of the si with my host variable.

Any suggestions?

Profile
 
 
Posted: 29 October 2008 09:52 PM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

The Tideway Foundation model, and TPL, has been designed to be easy to do the common tasks with the minimum of TPL. There are a number of sections of TPL that assist this in having additional behaviour. In particular as the majority of custom pattern writing is to understand bespoke software and business applications there is a lot of additional behaviour in these areas and around the way those nodekinds are used.

In particular the call model.SoftwareInstane() does more than just find or create the node. Behind the scenes the TPL execution is tracking the triggers and data access in order to build the inference relationships for you. When you ask it to create an SI it uses this information to also find the Host.

When creating a First Order SI (that is one triggered directly off DDD) then it detects this through seeing that the trigger is to a DDD node. TPL then builds the InferredElement:Inference:Primary inference relationship for you, the InferredElement:Inference:Contributor(s) if you used any data from nodes other than the one you triggered on, supersedes the old inferences if it is an update, and also builds the RunningSoftware:HostedSoftware:Host:Host relationship. It can do this as the DDD is already related to the Host and TPL knows how to do the navigation needed. This saves you having to understand this navigation and writing many lines of TPL over and over in each pattern. Note that this works for any DDD node though by far the most frequent will be the DiscoveredProcess node.

When it comes to building a second order node (i.e. one triggered off an inferred node) then the situation is a little different. This is because the Foundation Model expects a BAI to be composed of one or many SIs. So when you call model.BusinessApplicationInstance() the TPL execution detects that in this case the trigger is an SI and knows to build the primary inference relationship for you, but does not build the InferredElement:Inference:Primary relationship. Instead you have to tell TPL which SI nodes this BAI contains using the call model.addContainment(bai, si). The TPL execution will at this point know to build the required ContainedSoftware:SoftwareContainment:SoftwareContainer:BusinessApplicationInstance relationship. It will also traverse down the hierarchy to find the Host nodes that all the component parts are running on and build the required RunningSoftware:HostedSoftware:Host:Host relationships. Thus a BAI that has component SIs across more than one host will be linked to each of the Host nodes.

Worthwhile reading would be the example application models in the Application Modelling Guide, in particular the BAI pattern. These examples are a condensed version of what we teach in our 2 day application modelling workshop.

I do recommend that as you try extending TPL you might find it easier to use a BAI rather than a SI to represent the business use of the website.

However if you want to use a second order SI then you need to build the pattern in the same way as a BAI using addContainment(). Once you are confident you have the basic pattern working you will also need to consider the maintenance of the model you are building; such that if websites are removed from the webservers the pattern also removes the node that represents them in the inferred model.

The best way to do this is in a single pattern triggered off the webserver SI to avoid any race conditions.
Then derive a list of the websites that you know are running now from the IIS SI, in fact you can simply copy the list version of the attribute it’s there for this reason.
Next search for the existing set of related SIs representing the website in the inferred model.
You can now iterate through the derived list of websites creating or updating the website SI as appropriate.
If you then correlate the two lists you will be able to determine which of the existing SIs you now need to call model.destroy() for to remove them from the inferred model.
In order to assist you in the searching I’d recommend that you set a specific type on the SIs representing the websites, maybe type = “IIS website”. This will mean that if in future you relate other types of SI to the webserver your search will not accidentally include them and remove them.

For a example of correlating two lists like this have a look at the Sun.Virtualization.Zones.SolarisZoneContainer pattern – around line 130 (I can post it if you don’t have a TKU handy)

Profile
 
 
Posted: 29 October 2008 10:03 PM   [ Ignore ]   [ # 6 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

wearnest@teleflora.com - 29 October 2008 08:20 PM
I am getting the websites to show up as new SIs but the host is not set. I know that the host variable is set correctly because I verified it in a log.debug message. I just can’t figure out how to assign the host attribute of the si with my host variable.

Any suggestions?

If you set an attribute on the SI, like SI.host, then it is only a local attribute of that node. What you want to do is to relate the SI node and the Host node by building the correct relationship, in this case the RunningSoftware:HostedSoftware:Host:Host relationship. This would be done as part of model.addContainment() as in my previous post.

In an RDBMS this relation would be represented by a foreign key relationship between the row in the Host table and the row in the SoftwareInstance table joined on a SoftwareInstance.host column. In the Datastore the relationship is an entity in it’s own right connecting the specific Host node and the specific SoftwareInstance node and there is no need for an attribute to represent this foreign key.

Profile
 
 
Posted: 30 October 2008 01:59 PM   [ Ignore ]   [ # 7 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17
However if you want to use a second order SI then you need to build the pattern in the same way as a BAI using addContainment(). Once you are confident you have the basic pattern working you will also need to consider the maintenance of the model you are building; such that if websites are removed from the webservers the pattern also removes the node that represents them in the inferred model.

This works for linking the second SI to the first SI, but it still does not populate the host attribute of the second SI. When open this second SI, I am getting a message at the bottom of the attribute list that says: Data Quality Issues: Missing fields: Host.

Is there a way to explicitly assign the host attribute of this second SI?

Profile
 
 
Posted: 30 October 2008 02:27 PM   [ Ignore ]   [ # 8 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

Using the addContainment() should build that relationship and it should be picked up as a known relationship in the UI. I’ve just double checked second order SIs on one of our 7.1.6 reference machines and it seems fine. Because of the automatic nature of this area of the model that is the way that relationship is constructed.

So eliminating possible causes…

Is there a relationship to the Host on the SI you used when you added the containment. It is this relationship that TPL will use to find the Host(s) that the second order SI is running on.

As an outside possibility have you altered the Taxonomy at all?

To help us could you post a screen shot of the second order SI you built and the IIS SI you linked it to and possibly the pattern source?

Profile
 
 
Posted: 30 October 2008 02:45 PM   [ Ignore ]   [ # 9 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17

Yes, the relationship from the first SI to the host seems to be working fine.

No, I have not yet altered the taxonomy.

Attached are the requested screen shots and tpl. Thanks for helping me out with this. This is my first attempt at a Tideway pattern, so let me know if I going about it all wrong.

tpl 1.0 module WinIISWebsites;

metadata
    __name 
:= 'Windows IIS Websites';
    
__description := 'Pattern to create Windows IIS Website Software Instances';
end metadata;

pattern WinIISWebsites 1.0
    
'''
        Pattern to detect Windows IIS Websites based on the Microsoft IIS Service Software Instance.
    '''

    
overview
        tags Website
IIS;
    
end overview;

    
triggers
        on si 
:= SoftwareInstance createdconfirmed where type "Microsoft IIS Service";
    
end triggers;

    
body

        si_host 
:= model.host(si);
        
host := model.host(si_host);

        
web_list := si.web_sites_list;

        for 
website in web_list do

            
type := "Microsoft IIS Website";
            
name := '&#xwe;bsite%';
            
description := "An instance of IIS running for website: &#xwe;bsite%";
            
version := si.version;

            
si_new := model.SoftwareInstance(
                        
key := '&#xho;st.key%/&#xty;pe%/&#xna;me%',
                        
host := host.name,
                        
type := type,
                        
name := name,
                        
description := description,
                        
version := version,
                        
product_version := version);

            
model.addContainment(sisi_new);

        
end for;
    
end body;
end pattern

Image Attachments
missing host 1.jpg
Profile
 
 
Posted: 30 October 2008 02:45 PM   [ Ignore ]   [ # 10 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17

I can’t figure out how to do multiple attachments to single post…

Image Attachments
missing host 2.jpg
Profile
 
 
Posted: 30 October 2008 02:46 PM   [ Ignore ]   [ # 11 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

The way to attach multiples is to preview the post, then you can upload another.

Profile
 
 
Posted: 30 October 2008 02:48 PM   [ Ignore ]   [ # 12 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17

Yeah, I’m getting a javascript(0) message, but no browse button. I just posted the tpl in the reply above.

Profile
 
 
Posted: 30 October 2008 03:19 PM   [ Ignore ]   [ # 13 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

Unfortunately there are a few gremlins still to be ironed out of the forum – you may have noticed the way the code tag corrupts percent symbols as well. Hopefully in a short while we will have them all ironed out, in the meantime please accept my apologies.

The good news is I think I can see what’s up, give me a short while and I’ll post you back some TPL and an explanation.

Profile
 
 
Posted: 31 October 2008 11:45 AM   [ Ignore ]   [ # 14 ]  
Administrator
Avatar
RankRankRankRank
Total Posts:  132
Joined  2008-01-25

For your first pattern you’re doing well.

The error is that you added the containment relationship the wrong way around, so you asked TPL to build it from the IIs SI to the Website SI. So the SoftwareContainment relationship was built (back to front) but the HostedSoftware couldn’t be as TPL would have looked at your new website SI to see what it was running on… which was nothing.

Relationships are directional qualified by the Roles at each end. I can see why you did this as logically websites are contained in webservers; the problem is that the model expects second order SIs and BAIs to contain lower order SIs so the UI looks for the relationship in this direction. This is why when I suggested using a BAI I talked about it in the context of thinking about gathering up all the websites that provide that business service running on those webservers.

I’ve uploaded some tpl (with a .txt. extension do the forum accepts it) here are a few comments

  • You don’t need the metadata section in the pattern module with the __attributes, that’s a legacy from the example pattern Nik had.
  • I’ve put an example metadata block in the pattern. A few reports and dashboards look for publisher and category metadata so it’s best practise to provide some (see here for more detail)
  • model.host(si) is sufficient to get to the host – it knows how to traverse the model from an SI to a Host
  • It’s good practise to use the constants block for things that are constant like type
  • I’ve changed name and key to the way we would do it as an example

I’d suggest you remove the current pattern which will remove the SIs it created and try this one.

For future thought you might like to consider

  • Considering if the website name is wholly unique within the host.
  • Checking the list of existing Website SIs with the update list from the IIs SI so that SIs are removed when needed.

File Attachments
teleflora.tpl.txt  (File Size: 2KB - Downloads: 31)
Profile
 
 
Posted: 31 October 2008 04:26 PM   [ Ignore ]   [ # 15 ]  
Jr. Member
RankRank
Total Posts:  46
Joined  2008-10-17
Relationships are directional qualified by the Roles at each end. I can see why you did this as logically websites are contained in webservers; the problem is that the model expects second order SIs and BAIs to contain lower order SIs so the UI looks for the relationship in this direction. This is why when I suggested using a BAI I talked about it in the context of thinking about gathering up all the websites that provide that business service running on those webservers.

Logically a website is a child of a webserver application. Regardless of whether I choose to implement the website CI as an SI or BAI, the parent/child relationships should be configurable, hence the possibility of either of the two lines below:

model.addContainment(si_newsi);
model.addContainment(sisi_new); 

Which again begs the question, is there a way to explicitly assign a host to an SI?

That said, I tested out the pattern you suggested, and it was able to build the relationship to the host correctly (even though it doesn’t make sense to say that a website “contains” a webserver). However, both of these model.addContainment() commands resulted in the EXACT same visualization when I view the Software Structure. I would expect there to be a difference in these two based on the order of the SIs in the model.addContainment() command. Is this correct?

Microsoft IIS Service1 SI
  
-> Host1
  
-> Website1 SI
  
-> Website2 SI
  
-> Website3 SI 

I was expecting the corrected pattern to generate something like:

Website1 SI
  
-> Microsoft IIS Service1 SI
     
-> Host1
Website2 SI
  
-> Microsoft IIS Service1 SI
     
-> Host1
Website3 SI
  
-> Microsoft IIS Service1 SI
     
-> Host1 

Where multiple Website SIs may be pointing to the same Microsoft IIS Service SI running on the same Host.

Profile
 
 
   
1 of 2
1