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

Populating the model using a script

So far we have built some sophisticated types. To create instances, we have the following options:

For this exercise, we will choose the second option (which allows us to get started much faster), and run the createOrg Groovy script in the script editor. This script populates our Org Chart model with interesting data.

The most important part of that script is the following function, which allows you to create an object and set properties on the object:

This function uses the topology service to create or update an object instance. To do that, it requires a typeName and a collection of propertyValues. The typeName is used to create a potential instance of an object of that type. The TopologyService is used to create the instance. The propertyValues are a map of (name, value) pairs. The script iterates over the properties, inspects each one and tries to set that property on the object using the appropriate API.

What happens at the end is critical. Using the topSvc.mergeData() call, we send a potential instance of an object with several properties set. The TopologyService decides whether we need to create an object or simply update the definition for an existing one.

The following is an example call to this function:

This creates a new Employee object. When using this function, you must include all the identity properties at least. You can include additional properties if you want.

Here is another example:

With this function we almost have everything we need to create models using scripts. In order to enable iterative development, we need a way to delete old object instances. In this way, we can create a re-entrant Groovy script that cleans up obsolete objects.

The delete function is defined as follows:

Note that we use the createOrUpdateObject call to return the original object. Then we make a TopologyService call to delete it.

Connecting "Employees" to Host objects

At the end of the script, there is a bit of code which allows you to connect the employees to Host systems. This code simply finds some Host instances and manually attaches them to the employees. This code was included so that we can verify whether the alarm propagation works properly.

In a real example, you can add a dashboard that would allow an employee to express interest in objects. Behind the scenes, this dashboard would call code that looks something like this:

...where topologyObject is the object that the user has chosen as interesting. This is pretty much what is done in the Services Operations Console. It is all done using Dashboards and Groovy.

Visualizing the data

The last step is to build dashboards to visualize the data. The createOrg Groovy script provided in the appendix creates a nice organization.

 

Appendix: Groovy scripts

This appendix includes Groovy scripts used in the Data modeling tutorials.

相关文档