Example
Propagating Online Status
In this example Use Case we will explore how Change Propagation can be used to propagate the online status in deployment stacks in an IT landscape. Our goal is to receive online status information from a monitoring tool, and propagate this status upwards the deployment stack until we can determine the online status of applications and finally high-level business services.
Structure
We will assume the following Structure:
-
[Asset Type] Service
-
[Property] Status
- Property Type: Enumeration ("online", "offline")
- Multiplicity: zero or one
-
[Link Type] Depends On
- Target Type: Application
- Multiplicity: zero to many
-
[Property] Status
-
[Asset Type] Application
-
[Property] Status
- Property Type: Enumeration ("online", "offline")
- Multiplicity: zero or one
-
[Link Type] Runs On
- Target Type: Virtual Machine
- Multiplicity: zero to one
-
[Link Type] Runs On
- Target Type: Physical Machine
- Multiplicity: zero to one
-
[Property] Status
-
[Asset Type] Virtual Machine
-
[Property] Status
- Property Type: Enumeration ("online", "offline")
- Multiplicity: zero or one
-
[Link Type] Runs On
- Target Type: Physical Machine
- Multiplicity: zero to many
-
[Property] Status
-
[Asset Type] Physical Machine
-
[Property] Status
- Property Type: Enumeration ("online", "offline")
- Multiplicity: zero or one
-
[Property] Status
Rule Setup
In order to propagate the online status, we define the following set of rules.
Rule for Asset Type [Service]
Output Property: Status
Dependencies (Links): [Service: Depends On Application]
Dependencies (Properties): [Application: Status]
Rule Body
// if the applications we depend on are all online...
if(entity.refs.out.dependsOn.props.status.all("online")){
// ... then our service is online
return "online"
} else {
// ... otherwise our service is offline
return "offline"
}
In the rule body for Status we demand that
all Applications on which the
Service depends must be online. Please note that
all(...) returns true if the dependsOn
Link is unassigned, i.e. if your concrete Service asset has no
dependsOn links, it will be treated as online. If a service should
be online only if it has at least one dependsOn link, you can
extend the if(...) statement like this:
if(entity.refs.out.dependsOn.props.status.all("online") && entity.refs.out.dependsOn.status.atLeast(1, "online"))
This way, we demand that all of the applications we depend on are online, and that there is at least one application on which we depend that is online.
Rule for Asset Type [Application]
Output Property: Status
Dependencies (Links): [Application: Runs On Virtual Machine], [Application: Runs On Physical Machine]
Dependencies (Properties): [Virtual Machine: Status], [Physical Machine: Status]
Rule Body
// the application is online as long as at least one of the machines (virtual or physical) we are deployed on is online...
if(entity.refs.out.runsOn.props.status.atLeast(1, "online")){
// ... then our application is online
return "online"
} else {
// ... otherwise our application is offline
return "offline"
}
Please note that in the Rule Script for Applications we used
entity.refs.out.runsOn.props and treated it as
multiplicity many (i.e. we called
atLeast(...) on it), even though the status Property
is multiplicity-one. The reason for that is the
fact that there are two different outgoing "Runs
On" Links (one to Physical Machine and one to Virtual Machine). We
did not differentiate between the two in the script. Since they
both have the same name and we provided no
narrowing by Type, we work with the
union of the status of the
Physical Machine and the status of the Virtual Machine.
Rule for Asset Type [Virtual Machine]
Output Property: Status
Dependencies (Links): [Virtual Machine: Runs On → Physical Machine]
Dependencies (Properties): [Virtual Machine: Status]
Rule Body
// if at least one of the physical machines we run on is online...
if(entity.refs.out.runsOn.props.status.atLeast(1, "online")){
// ... the VM is online
return "online"
} else {
return "offline"
}
The atLeast(...) method, as used above, is very
useful to express high availability scenarios. In this case, the
Virtual Machine exhibits high availability: as long as one of its
Physical Machines is online, the Virtual Machine itself is
online.
Note that we do not require a rule for Physical Machine, because the status of a Physical Machine represents our "ground truth". Usually, the status information for Physical Machines is obtained via a monitoring solution or imported direclty from a database.