hvralertconfig
Usage
hvralertconfig [-Rurl] hub
List all the alerts configured on the hub.hvralertconfig [-Rurl] hub alert
List the properties of the alert configured on the hub.hvralertconfig [-Rurl] [-ojsonfile] hub alert [property]...
Print the specified alert properties (property...) configured on the hub, or all if none are specified.hvralertconfig [-Rurl] [-ijsonfile] hub alert [property=[value]]...
Set or unset the specific alert properties supplied in the jsonfile and/or directly on the command line.hvralertconfig [-Rurl] -a [-ijsonfile] hub alert [property=value]...
Replace all the existing properties of the alert configured on the hub with a new set of properties supplied in the jsonfile and/or directly set on the command line (property=value...).hvralertconfig [-Rurl] -c hub alert property=value...
Create an alert on the hub with specified properties and set values for the properties (property=value...).hvralertconfig [-Rurl] -d hub alert
Delete the alert configured on the hub.hvralertconfig [-Rurl] -D hub alert
Disable the alert configured on the hub.hvralertconfig [-Rurl] -C hub alert
Clear the alert configured on the hub.hvralertconfig [-Rurl] -t hub alert
Test the alert configured on the hub.hvralertconfig [-Rurl] -e hub alert
Execute the alert configured on the hub.
Description
The hvralertconfig command allows you to create an alert and manage the existing alerts. HVR alerts scan the hub server log files and, according to their configuration properties, send notifications about any issues encountered (errors, warnings, latency threshold exceeded).
Argument hub
specifies the name of a hub on which an alert(s) are configured. Argument alert
specifies the name of an alert.
When you create an alert (using option -c
), an alert configuration file (alert_name.conf) is created in the HVR_CONFIG/hubs/hub/alerts directory. The file contains the alert configuration properties specified when the alert was created, i.e. every alert has a certain set of alert properties. For an alert, you always must specify the type of notification: Email, SNS, Slack, or SNMP. If you want to receive alert notifications of different types, e.g. via email and Slack, separate alerts need to be configured.
The hvralertmanager command is responsible for executing all the alerts configured on the hub server.
For the alert properties that can be configured using this command, see section Alert Properties.
Command hvralertconfig corresponds to the Alerts dialog in the User Interface.
Options
This section describes the options available for the hvralertconfig command.
Parameter | Description |
---|---|
-a | Replace the existing alert properties with a new set of alert properties. The new set of alert properties may be supplied directly in the command line or from a JSON file using option The following syntaxes are applicable:
|
-c | Create an alert. This option requires alert property Notification_Type to be specified, and other properties depending on the notification type you specify. For specific examples, see Create Email alert, Create SNS alert, Create SNMP alert. In the User Interface, this option corresponds to the New Alert dialog. |
-C | Clear and enable an alert. This option enables an alert (if disabled) and disregards any pending errors, so that only new errors will be reported the next time the alert is run. If an alert is already enabled, it just disregards pending errors.
For example, the following command enables alert myalert. hvralertconfig -C myhub myalert |
-d | Delete an alert. For example, the following command deletes alert myalert: hvralertconfig -d myhub myalert |
-D | Disable an alert. It will not be executed until it is enabled again. For example, the following command disables alert myalert: hvralertconfig -D myhub myalert |
-e | Execute an alert. For example, the following command executes alert myalert:hvralertconfig -e myhub myalert |
-Ex | Override automatic encoding/decoding of string properties when reading a property from file using When this option is not used, the Valid values of
|
-ijsonfile | Read property values from a JSON file hvralertconfig -i alert_props.json -c myhub myalert |
-ojsonfile | Write the specified properties to a JSON file For example, the following command writes the listed properties into the alert_props.json file (this should be a single line without wrapping). hvralertconfig -o alert_props.json myhub myalert Notification_Type=EMAIL Email_SMTP_Server=smtp.mycorp.com Email_SMTP_Starttls=true hvralertconfig -o myalert_props.json myhub myalert |
-Rurl | Remote hub server. Access the hub server running on a remote machine, via the REST interface. This option is required for remote CLI access. When using this option, command hvrlogin should be run first, for authentication. For example, the following command deletes alert myalert on a remote hub server:hvralertconfig -R http://node:port -d myhub myalert |
-t | Test an alert to verify if notification settings (Slack, email, etc) are properly configured. For example, the following command sends a test notification defined in alert myalert: hvralertconfig -t myhub myalert |
-Vaccessmeth | Handle classified data.
|
Examples
This section provides examples of using the hvralertconfig command.
Example 1. Get alert properties
The following command prints the value of property Repeat_Interval of alert myalert.
hvralertconfig myhub myalert Repeat_Interval
Example 2. Set alert properties
The following command sets property Repeat_Interval to value 500 for alert myalert.
hvralertconfig myhub myalert Repeat_Interval=500
The following command sets the properties specified in the alert_props.json file for alert myalert.
hvralertconfig -i alert_props.json myhub myalert
The following command sets properties specified in the alert_props.json file and property Repeat_Interval for alert myalert.
hvralertconfig -i alert_props.json myhub myalert Repeat_Interval=500
If the agent_props.json file contains properties that are already set for alert, option
-i
will override these properties.For example, the following properties are currently set: Notification_Type, SNS_Destination, SNS_Access_Key_Id, SNS_Secret_Access_Key, and Repeat_Interval. The agent_props.json file contains property Repeat_Interval. Option
-i
will override the current value of property Repeat_Interval only.
Example 3. Unset alert properties
The following command unsets property Repeat_Interval of alert myalert.
hvralertconfig myhub myalert Repeat_Interval=
Example 4. Replace alert properties
The following command replaces the properties of alert myalert with the properties supplied in the alert_props.json file.
hvralertconfig -a -i alert_props.json myhub myalert
The following command replaces the current email recipient with a new recipient joe@mycorp.com (this should be a single line without wrapping).
hvralertconfig -a myhub myalert Notification_Type=EMAIL Email_SMTP_Server=smtp.mycorp.com Email_Recipients[0]=joe@mycorp.com
The following command replaces the properties of alert myalert with the properties supplied in the alert_props.json file and property Repeat_Interval.
hvralertconfig -a -i alert_props.json myhub myalert Repeat_Interval=500
The properties supplied directly on the command line will override the relevant properties in the alert_props.json file.
Example 5. Create Email alert
The following command creates an Email alert myalert with multiple properties that sends email notifications to joe@mycorp.com and jane@mycorp.com (this should be a single line without wrapping).
hvralertconfig -c myhub myalert Notification_Type=EMAIL Email_Recipients[++]=joe@mycorp.com Email_Recipients[++]=jane@mycorp.com Email_SMTP_Server=smtp.mycorp.com Email_SMTP_Starttls=true Ignore_Patterns=F_JT* Message_Error_Limit=10 Add_HVR_Event=true Repeat_Interval=10 Specific_Locations[++]=myloc Specific_Channels[++]=mychannel
Example 6. Create SNS alert
The following command creates an SNS alert (this should be a single line without wrapping).
hvralertconfig -c myhub sns_alert Notification_Type=SNS SNS_Destination=arn:aws:sns:eu-west-1:6675700182:test SNS_Access_Key_Id=KNDTMY7FTX0KSDRRNTPV SNS_Secret_Access_Key=K9D7G6mm6ZOi9DReodELDmLNC/1Fc
Example 7. Create SNMP alert
The following command creates an SNMP alert (this should be a single line without wrapping).
hvralertconfig -c myhub snmp_alert Notification_Type=SNMP SNMP_Hostname=localhost SNMP_Port=189 SNMP_Community=public SNMP_Heartbeat=true SNMP_Version=V2C