In the last couple of posts, I've been looking into potential uses of Smarts dynamic model functional that are simple enough to be used by mere mortals (non-developer) like myself. I've looked at how to add new properties and then how to use events to generate notifications. In this post, I'll go one step further, and take advantage of the propagation between classes.
Objective
Our use case has been monitoring of applications using synthetic transaction and generating notifications when the application is slow or down. What we have been doing so far does not take advantage of the Smarts IP Availability Managers (AM) root-cause analysis capabilities. Smarts AM server diagnosis whether the server (host) is running or not, and if a host is unresponsive what the root-cause may be, the switch, the router, etc.
So wouldn't it be useful if we can differentiate whether the problem is the application itself, or host or something else in the network? Using the propagate and relationships functionality of the MODEL language, we may be able to meet this need.
Defining the relationships
I want to be able to model the relationship between a host and an application. An application can be hosted by a host, and a host can host many applications (1 to many relationship). To model this relationship, I need to add the Host class to the model and define relationships at both classes.
refine interface Host
{
relationshipset Hosts, MyApplication, HostedBy;
}
The model code above specifies that the Host object can have many “Hosts” relationships (relationshipset) with MyApplication objects. I also need to put the same relationship in the opposite direction to the MyApplication class definition in the model.
relationship HostedBy, Host, Hosts;
The above code specifies that the MyApplication object can have a HostedBy relationship with one Host object.
Propagation
When the host an application is HostedBy is unresponsive, I need to pass the information to the MyApplication class. This is accomplished using the propagate command.
propagate attribute boolean hostUnresponsive
"is the host that the application is running on up?"
<= Host, HostedBy, IsUnresponsive;
The model code segment above creates a propagated property called hostUnresponsive for the MyApplication class. The value of the hostUnresponsive property would come from the IsUnresponsive property of the Host object the MyApplication object has a HostedBy relationship with. In other words, if Host object IsUnresponsive property is set to true, MyApplication hostUnresponsive property will also be set to true.
This way, we have a property in the MyApplication class that specifies whether the host is unresponsive or not, and I can use this property in the logic to determine what notification to generate. For example, I'll modify the model code I've used to generate the Down event using hostUnresponsive property. The logic is that if the Host is down, I don't want to create an application down notification.
computed attribute boolean isDown
"set to true if the application is not responding (Down)"
= lastResponseTime == -1 && ! hostUnresponsive;
event Down "The application seems to be down"
= isDown;
export Down;
Instead of the application down event, I may want to create a new event that states the application is down due to the host being unresponsive.
computed attribute boolean isHostDown "set to true if the host is down"
= hostUnresponsive;
event ApplicationHostDown "The application host seems to be down"
= isHostDown;
export ApplicationHostDown;
That's it for the model changes. We should now get an application down notification if the application is down but the host is responsive, and we should get ApplicationHostDown notification if the host is unresponsive (in addition to the Host Down notification that Smarts AM server would generate).
The attached zip file has the model and the modified configuration files I've used in the last couple of posts. My main objective was to highlight the potential applications of the Smarts dynamic model. Particular examples may not necessarily be meaningful or there may better ways, etc.
You may notice that when a host is unresponsive there would be two notifications (MyApplication ApplicationHostDown and Host Down). This is not ideal as we'd like to have a single root-cause.
Next in dynamic model series of posts, I'll look into how to use the SNMP instrumentation class to poll an SNMP agent and populate object properties.

