Chat now with support
与支持团队交流

Foglight 5.9.5 - Data Model Guide

The Foglight data model Data modeling tutorials Appendix: Groovy scripts Appendix: Internal database schema
acl_class Table acl_entry Table acl_object_identity Table acl_sid Table agent_client_defaults Table agent_config_binder Table agent_dc_manager_schedule_ids Table agent_dc_manager_state Table agent_manager_state Table alarm_alarm Table alarm_annotations Table alarm_loc_msg Table auditing_log Table baseline_config Table baseline_config_properties Table baseline_engine_profile Table baseline_observation_profile Table cartridge_cartridge_relation Table cartridge_components Table cartridge_installed_cartridges Table cartridge_items Table credential_data Table credential_lockbox Table credential_mapping Table credential_mapping_entry Table credential_order Table credential_policy Table current_version Table database_instance_id Table database_version Table derivation_calculation Table derivation_complex_definition Table derivation_definition Table fgl4_migration_agent Table fgl4_migration_data_span Table fgl4_migration_dcm Table fgl4_migration_host Table fgl4_migration_host_mapping Table fgl4_migration_log Table fgl4_migration_server Table incident_affected_objects Table incident_incident Table incident_linked_alarms Table incident_problem_ticket Table incident_problem_tickets Table licensing_licenses Table mgmt_object_size Table mgmt_observation_size Table mgmt_timeslice Table mgmt_timeslice_data_avail Table model_association Table model_property_formula Table model_query_criteria Table obs_binary_* Tables obs_metric_aggregate_* Tables obs_metric_scalar_* Tables obs_string_* Tables pcm_encoded_data Table persistable_config_model Table persistable_script Table persistence_column_mapping Table persistence_db_column Table persistence_db_schema Table persistence_db_table Table persistence_grouping_policy Table persistence_lifecycle Table persistence_lifecycle_period Table persistence_obs_key_purge_age Table persistence_obs_purge Table persistence_obs_purge_age Table persistence_observation_index Table persistence_operation Table persistence_retention_policy Table persistence_rollup_progress Table persistence_rollup_retry Table persistence_storage_config_xml Table persistence_storage_manager Table persistence_timeslice_table Table persistence_topobj_purge_age Table persistence_type_hierarchy Table registry_performance_calendar Table registry_registry_value Table registry_registry_variable Table report_output Table report_schedule Table rule_action_handler Table rule_action_message Table rule_action_registry_reference Table rule_action_variable_reference Table rule_blackout_schedules Table rule_effective_schedules Table rule_expression Table rule_firing_strategy Table rule_messages Table rule_rule Table rule_sev_to_clear_actn_hndlr Table rule_sev_to_fire_actn_hndlr Table rule_severity Table rule_severity_expression Table rule_severity_messages Table schedule_named_schedule Table script_annt Table script_annt_attr Table script_argument Table script_argument_annt Table script_argument_annt_attr Table script_example Table script_return_annt Table script_return_annt_attr Table sec_group Table sec_group_nesting Table sec_group_role_match Table sec_grouprole Table sec_jaas_source Table sec_object Table sec_object_mask Table sec_object_permission Table sec_object_type Table sec_permission Table sec_permission_def Table sec_policy Table sec_resource Table sec_role Table sec_user_alias Table sec_user_obj_permission Table sec_user_res_permission Table sec_usergroup Table sec_userrole Table sec_x_attribute Table sec_x_attribute_value Table tagging_service_mapping Table threshold_bound Table threshold_config Table topology_activity_calendar Table topology_activity_upgrade Table topology_object Table topology_object_history Table topology_property Table topology_property_annotation Table topology_property_history Table topology_property_name Table topology_property_value Table topology_service_state Table topology_type Table topology_type_annotation Table topology_type_history Table upgrade_pending_operations Table wcf_groups_by_cartridges Table wcf_resources Table

What are "KnowledgeItems"?

KnowledgeItem is a concept that allows users to attribute business-relevant information to their monitored infrastructure. This information may include (but is not limited to) cost-center attributes, business unit associations, or configuration and application management metadata.

The Management Server pre-defines an abstract type KnowledgeItem that contains basic information:

Concrete instances of sub-types can be used to extend these knowledge items for a specific purpose (for example, business unit information), and are linked to the corresponding monitored topology information via the reference 'asset'.

The Management Server will offer management of these knowledge items in the UI in a later release. At the moment, users should extend the KnowledgeItem type as desired, and create business-related knowledge content and references in scripts.

The following is an example of a simple business-unit related knowledge item:

To add real value to this basic knowledge item, extend this type, by renaming and customizing it appropriately — see <foglight_home>/extension/knowledge-items/acme-types.xml

The types-file can be imported into the model by copy and paste, or as a file upload in the Administration > Data > Add Topology Type dashboard.

After users define various KnowledgeItems, other knowledge items instances can be created programmatically. For example:

The Management Server shows the KnowledgeItems in the model under Services > All Model Roots > Knowledge Items and Root of Monitoring > KnowledgeItemModel >knowledgeItems. To see the data model tree, in the navigation panel, under Dashboards, click Configuration > Data.

The server comes with an example that shows how to surface the knowledge items in the UI. The example dashboard depends on a Acme example KnowledgeItem type (see <foglight_home>/extension/knowledge-items/acme-types.xml) that first needs to be imported through the Add Topology Type dashboard. The example dashboards can then be imported by using the following command:

When accessing the Service Operations Console (in the navigation panel, under Dashboards, click Services > Service Operation Console), all Acme knowledge items for elements inside the selected service are then shown in an extra tab, named ACME BU Knowledge Items.

Data modeling tutorials

This section provides a tutorial that walks you through the process of adding new functionality to Foglight, by building new models and without changing the Foglight core code.

The technique for extending Foglight is shown in the following illustration.

The process consists of the following steps:

4
Re-iterate (repeat Step 1 through Step 3) until you get the result you want.

Modeling example: The org chart

Foglight is not just a monitor, it is an object-oriented application server. Using Foglight’s modeling capabilities, you can extend Foglight to model data from pretty much any domain.

This example walks you through an exercise that extends Foglight to represent a company’s Org structure. We create the model, load it into the server, populate it using a Groovy script, and create some dashboards to visualize the result:

A company’s org chart shows all the different departments in the company, along with their relationships.

To make this exercise interesting, we are going to model the org chart and the employee reporting hierarchy. Each organization has a leader, and that leader has direct reports. Then, we are going to connect the IT department to the actual IT infrastructure. The result is a meaningful org chart that shows the state of the IT and the root cause of potential outages from an employee perspective.

Defining the org structure types

To demonstrate the power of models, we are going to create a company org structure inside Foglight.

The org structure consists of organizations that contain other organizations. The organizations are lead by managers. The managers have direct reports.

We will create a model that represents these relationships, populate the model, then visualize it using dashboards. Then, we will create a relationship between this Org Structure model and Host objects, to show how models can be connected.

There are three key types in our Org Structure example: Organization, Manager, and Employee. It seems natural that a Manager should be a specialization of an Employee. It also seems natural that there is a relationship between the organizations, and also between the employees.

As always with anything object-oriented, there are multiple ways to solve the problem of relationships between objects. Here are the key relationships we want to maintain:

To do that, we are going to create three objects: Organization, Manager, and Employee. Manager is a subclass of Employee.

All the relationships we need are going to be modeled using three collections:

Each Organization has a Manager defined by Organization.orgLeader.
Each Organization has a list of child Organizations defined by Organization.childOrgs.
Each Manager has a list of direct reports (Employee objects) defined by Manager.directReports.

Before we get into the type definitions for each of our three types, we need to figure out what defines the identity of each type. In Foglight, identity is critical, because it determines when a new object is created.

In a real-world case, the identity of each employee is defined by an employee ID. For this example, we are going to define the identity of an employee based on his or her first and last name. That feels like a unique value for an individual, at least in a small organization. For Organization, we are going to define the identity based on the name of the organization. The reasons behind choosing this option are explained in the following scenarios:

Therefore, we are going to use the following identity information for our types (as illustrated in the following diagram):

Employee: identity fields lastName and firstName.
Manager: same identity as Employee, has a directReports collection of Employees.
Organization: identity field orgName. Has an orgLeader link to the organization’s manager, and has a childOrgs list of departments that make up the organization.

Now we can finally get started on creating some types inside Foglight. After designing the object/type hierarchy, getting the types into Foglight is relatively easy.

Rather than examining the syntax for topology type definitions, we are going to study real examples.

In Foglight types, a type can extend another type. Most types extend TopologyObject in order to inherit alarm propagation and roll-up features. Each type contains a set of properties. A property can be:

We can get started by looking at the simplified definition for the Employee type. It contains two properties, lastName and firstName:

1
On the navigation panel, under Dashboards, click Administration > Data > Add Topology Type.
The Add Topology Types dashboard appears.

If the code passes the validation, the Successful dialog box appears, confirming the validation result.
4
Click Close.
The Successful dialog box appears, confirming the result of importing the new type definition.
6
Click Close.

The Employee type definition is now part of the Foglight topology types. We should highlight the following characteristics:

Employee extends TopologyObject. This means that it inherits all the alarm roll-up capabilities that most Foglight objects use. We want this capability because we want to be able to show the state of the systems managed by an Employee.
Both lastName and firstName are String properties.
Both lastName and firstName are identity properties. This means that the combination of first and last name define a unique Employee object instance. You can have two Employee objects with the same last name, or the same first name. But the combination is considered unique.

Next, we are going to look at a slightly extended version of the Employee object:

This (partial) definition includes new properties, which hold basic contact information for each employee. We have added jobTitle, phoneNumber, and emailAddress. These properties are a little different than lastName and firstName. Specifically, they are not identity properties. What that means is:

An Employee is not uniquely defined by his or her phone number, for example. A change to a phoneNumber property does not create an Employee instance.

The next interesting definitions are for ownedItems and interestingItems, which are used to model an employee’s system responsibilities. If Bob in IT is responsible for three machines, we want to be able to represent that relationship. We have chosen to add two collections to represent this relationship:

ownedItems: represents those items for which an employee is responsible. The state of these items impact the state of the employee. If Bob in IT has three machines, and one of them is in a Fatal state, then the Employee object representing Bob is in a Fatal state. This is made to happen by setting is-containment to true.
interestingItems: represents things that an employee finds interesting, but for which they are not responsible. This allows us to maintain a relationship between an employee and other things that does not result in alarm state rolling up. This is made to happen by setting is-containment to false.
NOTE: Both ownedItems and interestingItems are set to type TopologyObject. Remember that TopologyObject is the base type for most objects in Foglight. By using this as the type for a collection, we are allowing nearly any object to be added to the collection. In this case, it makes sense, as it allows for an Employee to include services, hosts, application servers, databases, and agents in their ownedItems list.

There is one last technique to show related to model definitions. The value of a property can be set at run-time by agent or script, but we can also supply code to create a property. As a simple example, consider the fact that we have stored lastName and firstName separately. It is likely that we want to put the two names together when we build dashboards. To do that, we could add a fullName property that has a copy of the data in lastName and firstName, but they might get out of sync. It makes much more sense for us to make fullName a derived property, and to provide a Groovy code to calculate its value:

The code is straight forward and should be familiar to everyone who knows either Groovy or Java®. We are building a string that puts the first and last names together, and returns that value. When we access fullName, this script is run.

The Manager type extends Employee; its simplified definition contains one property, directReports.

This adds the ability to have a list of direct reports. By setting the is-many attribute to true, we allow a Manager to have zero or more Employees.

The Organization type (simplified) definition contains several properties:

An Organization inherits TopologyObject. Each Organization has an orgName that uniquely defines its identity. All Organization instances must have different values for orgName.

Each Organization has a relationship with a Manager through the orgLeader property. Each Organization can only have one manager. This might be a flaw in our model, but we will keep it as-is, for now. Also note that is-containment is set to true. This means that an Organization inherits the state of its Manager, who in turn inherits the state of his or her Employees.

Each Organization also has a relationship with zero or more child Organization objects through the childOrgs property. This property has is-many attribute set to true, in order to allow an Organization to have zero or more child Organizations.

Objects can be created easily in Foglight. However, unless some thought is given to their structure, objects can be easily lost or become orphans.

2
Expand the topology tree to show the Management Server > All Data > All Type Instances > TopologyObject collection.

3
Open TopologyObject > Sub Types, then (for example) open Organization to see all Organization object instances.

But this is the hard way to find things. And if your objects are orphaned, you cannot write dashboards. What you want to do is to anchor all your new objects into a collection somewhere. To do that, you need a type definition as follows:

This creates a model that contains all Organization instances. As we create our objects (see Full definitions for the org structure types), we need to make sure that we add them to OrganizationModel.organizations. But how does this help? The key is the ModelRoot. This is a special marker class that tells Foglight to include this model in the list of ModelRoots. This means it displays as shown in the following illustration.

As a result of including something in ModelRoots, you can now refer to your model in a query like this:

This section presents the full type definitions for the new topology types discussed in the previous sections.

相关文档