Questo contenuto non è disponibile nella lingua selezionata.
6. Resource Configuration
There are two areas of resource configuration:
- The plug-in configuration. In the web UI, this is called the connection setting; it is the information which the agent uses to discover and connect to the resource, such as a PID file path or a port number.Every resource has some kind of plug-in configuration.
- Resource configuration. Configuration properties are drawn from the configuration files for a resource, such as
.conf
or.xml
. The configuration files and properties that are exposed within JBoss ON are defined in the plug-in descriptor.Resource configuration is optional, and many resources do not support configuration editing or only expose a subset of possible properties.
Note
When changing the configuration for a resource, it is simplest to use the configuration editor with a proxy resource, as in Example 7, “Changing Configuration Properties”.
The configuration editor is only available with the interactive CLI; for running an alert script or script automatic changes to resource configuration, the remote API can be used directly.
6.1. Viewing Current Configuration Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
Plug-in (connection settings) configuration and resource configuration are both defined per resource type, in the resource type's plug-in descriptor.
The
get*ConfigurationDefinitionForResourceType
methods can display the descriptor-defined templates used for the resource type's configuration. These are the configuration properties available to every resource of that type.
Example 9. Viewing Plug-in Configuration for a Resource Type
The
propertyDefinitions
parameter contains the information about the configuration properties that can be set, including details about the configuration property setup. For example, for the event logs configuration:
logs=[id=11792, name=logs, config=Linux, group=Event Logs]
logs=[id=11792, name=logs, config=Linux, group=Event Logs]
The property name is logs, and the type of property is a list, PropertyDefinitionList. The property list ID is 11792, though not every type of property has a template ID. The event log properties are organized together in the Event Logs group.
The cache timeout property has a slightly different configuration. This is a simple property type (SimpleProperty), and the expected value is given in the Type: element. The group for the property is Content.
metadataCacheTimeout=SimpleProperty[metadataCacheTimeout] (Type: INTEGER)(Group: Content)
metadataCacheTimeout=SimpleProperty[metadataCacheTimeout] (Type: INTEGER)(Group: Content)
Group settings for a property are mainly used to create a logical organization in the web UI. For the event logs configuration, all of the members in the properties list belong to the group, and only those values. For the cache timeout, it belongs to the content group but other, discrete properties also belong to the group, so the way the group is defined is different.
The resource configuration template can be retrieved similarly to retrieving the plug-in configuration template.
Example 10. Viewing the Configuration Properties for the Resource Type
The property values for a specific resource can be viewed using the
get*Configuration
methods.
Note
If you are only viewing the resource configuration and are running the interactive CLI, this is done more easily using a proxy resource, as in Example 7, “Changing Configuration Properties”.
Example 11. Viewing a Resource's Configuration Settings
6.2. Changing Simple Configuration Properties Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The way that a configuration property is edited depends on the type of property, whether it is simple, list, or map. The process for changing configuration is the same for both plug-in configuration properties and resource configuration properties.
The steps in this script:
- Search for the resource.
- Create a configuration object.
- Set the new property value. The method to set the property value depends on the format of the property. In this case, it uses
setSimpleValue
since this is a simple property. For a simple property, the value is set by passing ('property','value'). - Run an update operation for the resource. For a resource configuration update, the method is
updateResourceConfiguration
. For a plug-in configuration update, it isupdatePluginConfiguration
.
Example 12. Changing a Simple Property