Questo contenuto non è disponibile nella lingua selezionata.
25.3. Alert Responses
25.3.1. Notifying Administrators and Responding to Alerts Copia collegamentoCollegamento copiato negli appunti!
- Email, to one or multiple addresses
- SNMP traps
- Messages to JBoss ON users
- Running a resource operation (on the alerting resource or any other resource in inventory)
- Running a resource script (specific type of resource operation)
- JBoss ON CLI scripts
25.3.2. Detailed Discussion: Initiating an Operation Copia collegamentoCollegamento copiato negli appunti!
- Alert operations are fired responsively to address any alert or event.
- Alert operations can be initiated on any resource in the JBoss ON inventory, not only the resource which sent the alert. That means that an operation can be run for a different application on the same host server or even on an entirely different server.
25.3.2.1. Using Tokens with Alert Operations Copia collegamentoCollegamento copiato negli appunti!
<%space.param_name%>
<%space.param_name%>
Information about ... | Token | Description |
---|---|---|
Fired Alert | alert.willBeDisabled | Will the alert definition be disabled after firing? |
Fired Alert | alert.id | The id of this particular alert |
Fired Alert | alert.url | Url to the alert details page |
Fired Alert | alert.name | Name from the defining alert definition |
Fired Alert | alert.priority | Priority of this alert |
Fired Alert | alert.description | Description of this alert |
Fired Alert | alert.firedAt | Time the alert fired |
Fired Alert | alert.conditions | A text representation of the conditions that led to this alert |
Alerting Resource | resource.id | ID of the resource |
Alerting Resource | resource.platformType | Type of the platform the resource is on |
Alerting Resource | resource.platformName | Name of the platform the resource is on |
Alerting Resource | resource.typeName | Resource type name |
Alerting Resource | resource.name | Name of the resource |
Alerting Resource | resource.platformId | ID of the platform the resource is on |
Alerting Resource | resource.parentName | Name of the parent resource |
Alerting Resource | resource.parentId | ID of the parent resource |
Alerting Resource | resource.typeId | Resource type id |
Target Resource | targetResource.parentId | ID of the target's parent resource |
Target Resource | targetResource.platformName | Name of the platform the target resource is on |
Target Resource | targetResource.platformId | ID of the platform the target resource is on |
Target Resource | targetResource.parentName | Name of the target's parent resource |
Target Resource | targetResource.typeId | Resource type of the target resource id |
Target Resource | targetResource.platformType | Type of the platform the target resource is on |
Target Resource | targetResource.name | Name of the target resource |
Target Resource | targetResource.id | ID of the target resource |
Target Resource | targetResource.typeName | Resource type name of the target resource |
Operation | operation.id | ID of the operation fired |
Operation | operation.name | Name of the operation fired |
25.3.2.2. Setting Alert Operations Copia collegamentoCollegamento copiato negli appunti!
Figure 25.5. Senders
Figure 25.6. Resource Selection
Figure 25.7. Operation Settings
25.3.3. Detailed Discussion: Initiating Resource Scripts Copia collegamentoCollegamento copiato negli appunti!
Figure 25.8. Resource Script Settings
25.3.4. Detailed Discussion: Launching JBoss ON CLI Scripts from an Alert Copia collegamentoCollegamento copiato negli appunti!
25.3.4.1. Notes for Using CLI Script Notifications Copia collegamentoCollegamento copiato negli appunti!
CLI Scripts Are Content
Unlike resource scripts, CLI scripts are not treated as resources in the inventory. These are tools available to and used by the JBoss ON server itself (not limited or associated with any given resource).
CLI Scripts and the Remote API
The CLI script must use the proper API to perform the operation on the server. JBoss ON has several different API sets, depending on the task being performed. To connect to a server and run a script requires the remoting API, which allows commands to be executed on the server remotely.
Referencing Alert Objects in a CLI Script
The CLI script can actually reference an alert object for the alert which triggers the script by using a pre-defined alert variable.
var myResource = ProxyFactory.getResource(alert.alertDefinition.resource.id)
var myResource = ProxyFactory.getResource(alert.alertDefinition.resource.id)
Limits on CLI Scripts
The resources themselves may impose limits on where a CLI script can be run or what operations it can perform. For example, for security reasons, a CLI script cannot perform a JNDI lookup on a local resource (performing a lookup on the server running the CLI script), but it can perform a remote JNDI lookup. Another common issue is that a JBoss ON server cannot run a restart operation on itself.
25.3.4.2. Writing Alert-Relevant CLI Scripts Copia collegamentoCollegamento copiato negli appunti!
/alert-scripts/
.
25.3.4.3. Configuring a CLI Script Notification Copia collegamentoCollegamento copiato negli appunti!
- Upload the script to a content repository.NoteCreate a separate repository for alert CLI scripts.
- Search for the resource, and configure the basic alert definition, as in Section 25.1.2, “Basic Procedure for Setting Alerts for a Resource”.
- In the Notifications tab for the alert definition, give the notification method a name, and select the CLI Script method from the Alert Senders drop-down menu.
- First, select the JBoss ON user as whom to run the script. The default is as the user who is creating the notification.
- Select the repository which contains the CLI script. If you are uploading a new script, this is the repository to which the script will be added.
- Select the CLI script to use from the drop-down menu, which lists all of the scripts in the specified repository. Alternatively, click the Upload button to browse to a script on the local machine.
- Click OK to save the notification. The line in the Notifications tab shows the script, the repository, and the user as whom it will run.
25.3.5. Configuring SNMP for Notifications Copia collegamentoCollegamento copiato negli appunti!
- Configuring the SNMP alert plug-in for the server.
- Configuring the actual alert with an SNMP notification.
25.3.5.1. JBoss ON SNMP Information Copia collegamentoCollegamento copiato negli appunti!
/etc/RHQ-mib.txt
. The default configuration for the MIB is shown in Example 25.1, “Default Alert Object in JBoss ON MIB”. The base OID for the JBoss ON alert is 1.3.6.1.4.1.18016.2.1 (org.dod.internet.private.enterprise.jboss.rhq.alert).
Example 25.1. Default Alert Object in JBoss ON MIB
snmptrapd -m RHQ-MIB -M/opt/local/share/mibs/ietf
[root@server ~]# snmptrapd -m RHQ-MIB -M/opt/local/share/mibs/ietf
-M
gives the path to the SNMP server's MIB directory.
Jul 8 15:13:31 snert snmptrapd[42372]: 127.0.0.1: Enterprise Specific Trap (.0) Uptime: 0:00:00.00, RHQ-MIB::alertName = STRING: test, RHQ-MIB::alertResourceName = STRING: snert, RHQ-MIB::alertPlatformName = STRING: snert, RHQ-MIB::alertCondition = STRING: - Condition 1: Free Memory < 1.024,0MB - Date/Time: 2013/07/08 15:13:05 MESZ - Details: 12,9MB , RHQ-MIB::alertSeverity = STRING: medium, RHQ-MIB::alertUrl = STRING: http://localhost:7080/coregui/CoreGUI.html#Resource/10001/Alerts/History/12204, RHQ-MIB::alertHierarchy = STRING: snert
Jul 8 15:13:31 snert snmptrapd[42372]: 127.0.0.1: Enterprise Specific Trap (.0) Uptime: 0:00:00.00, RHQ-MIB::alertName = STRING: test, RHQ-MIB::alertResourceName = STRING: snert, RHQ-MIB::alertPlatformName = STRING: snert, RHQ-MIB::alertCondition = STRING:
- Condition 1: Free Memory < 1.024,0MB
- Date/Time: 2013/07/08 15:13:05 MESZ
- Details: 12,9MB
, RHQ-MIB::alertSeverity = STRING: medium, RHQ-MIB::alertUrl = STRING: http://localhost:7080/coregui/CoreGUI.html#Resource/10001/Alerts/History/12204, RHQ-MIB::alertHierarchy = STRING: snert
22:06:19.043208 IP localhost.56445 > localhost.snmptrap: Trap(352) E:18016.2.3 0.0.0.0 enterpriseSpecific s=0 0 E:18016.2.1.1="test" E:18016.2.1.2="snert" E:18016.2.1.3="snert" E:18016.2.1.4="^J- Condition 1: Free Memory < 4,0GB^J- Date/Time: 2013/07/10 22:06:01 MESZ^J - Details: 179,2MB^J" E:18016.2.1.5="medium" E:18016.2.1.6="http://localhost:7080/coregui/CoreGUI.html#Resource/10001/Alerts/History/10038" E:18016.2.1.7="snert"
22:06:19.043208 IP localhost.56445 > localhost.snmptrap: Trap(352) E:18016.2.3 0.0.0.0 enterpriseSpecific s=0 0 E:18016.2.1.1="test" E:18016.2.1.2="snert" E:18016.2.1.3="snert" E:18016.2.1.4="^J- Condition 1: Free Memory < 4,0GB^J- Date/Time: 2013/07/10 22:06:01 MESZ^J - Details: 179,2MB^J" E:18016.2.1.5="medium" E:18016.2.1.6="http://localhost:7080/coregui/CoreGUI.html#Resource/10001/Alerts/History/10038" E:18016.2.1.7="snert"
25.3.5.2. Configuring the SNMP Alert Plug-in Copia collegamentoCollegamento copiato negli appunti!
- In the top menu, select the Administration tab.
- In the System Configuration menu, select the ServerPlugins item.
- Click the name of the SNMP plug-in in the list.
- In the plug-in details page, expand the Plugin Configuration section.
- Fill in the required SNMP configuration:
- Select the appropriate SNMP version.
- Give the hostname, port number, and transport protocol for the SNMP trap server. The default settings point to the localhost for the JBoss ON server and port 162.
- Set the trap OID. This is, by default, the RHQ OID.
- For SNMP 1 and 2. Give the name of the community.
NoteThis sets global defaults for SNMP alert notifications. Different settings can be given to individual alert notifications when an alert definition is created. - SNMP version 1 and version 3 both require additional configuration, as listed in Table 25.3, “SNMP v1 Configuration Settings” and Table 25.4, “SNMP v3 Configuration Settings”. Expand the version-specific configuration section and fill in the information about the SNMP agent.It may be necessary to unselect the Unset checkbox to allow the fields to be edited.
Field | Description |
---|---|
Generic ID | The ID of the trap. The SNMP standards defines numbers from 0-6, with 6 meaning "enterprise specific," which is the default. |
Enterprise OID | The OID of the JBoss ON server itself. The default value is taken from the RHQ MIB as SMIv2.enterprise.jboss.rhq.rhqServer. |
Specific OID | A custom OID to use with the trap notification. This can be empty. |
Agent address | The IP address of the alert sender, which means the IP address of the JBoss ON server. |
Field | Description |
---|---|
Auth protocol | The encryption algorithm for authentication requests. Setting this requires a corresponding authentication passphrase to be set. If there is no passphrase, this value must be none. |
Privacy protocol | Sets the encryption method used with trap messages. This is used with the authentication proocol. |
Engine Id | |
Target Context name | |
Auth passphrase | Sets the password used for authentication; this has a miminum length of eight (8) characters. This is required if an Auth Protocol value is set. |
Privacy passphrase | Sets the password used for managing encrypted communication. This is required if authentication is used. |
Security name | Gives the username to use for authentication to the trap receiver. |
25.3.5.3. Configuring the SNMP Alert Notification Copia collegamentoCollegamento copiato negli appunti!
Figure 25.9. JBoss ON SNMP Trap Information
- The hostname for the SNMP manager. If this is not set, the default from the global configuration is used.
- The port number for the SNMP manager. If this is not set, the default from the global configuration is used.
- A variable binding prefix. Optional. This prepends the given string to the beginning of the individual variables sent by the trap. This can be a way to identify the JBoss ON server, resource, or alert which is sending the trap. The default is set in the RHQ MIB, SMIv2.enterprise.jboss.rhq.alert.
- The trap OID. This is the specific OID to use with the trap definition. If this is not set, the default from the global configuration is used; by default, this is the RHQ-MIB, 1.3.6.1.4.1.18016.2.1.