ap config command

You can use the ap config command to configure alert rules, SMTP or other configuration parameters.

Usage

ap config [--host <address>] [-h] [--user <user>] [--password <password>] [--from-file <file_path>]
    export [<filename>]
    import <filename> [--force]
  --set alerts_rules --type (action|to|add_to) [--scope <alert_type>|<alert_reason_code>] --value (<action_int>|<email_list>)
  --del alerts_rules --type (action|to|add_to) [--scope <alert_type>|<alert_reason_code>]
  --test alerts_rules --reason_code <reason_code>
  --list alerts_rules
  --set smtp option <value> [option <value> [option <value> ...]]
    if any of the options below are provided, all of them must be:
      --mail_server_name
      --mail_server_port
      --sender_name
      --sender_address
    other options (all of the options below must be provided if username or password is):
      --login_method
      --login_username
      --login_password (may be provided without value, user will be interactively prompted for password in such case)
    other:
      --smtp_encryption
  --set snmp option <value> [option <value> [option <value> ...]]
     --snmp_ip_address
     --snmp_port
     --snmp_security_name
     --snmp_security_level
     --snmp_auth_key
     --snmp_auth_protocol
     --snmp_enc_key
     --snmp_enc_protocol
     --snmp_engine_id
  --list snmp
  --list smtp
  --set params [<param>=<value> [<param>=<value> [...]]]
  --list params
  --force

Optional arguments

-h|--help

Displays help for the command.

-v|--verbose

Displays some additional information from the logs.

--host <address>
Specifies the address of the system. Default value is localhost. When specifying other than default, you must also provide user and password.
--user <user>
User name to access the host.
--password <password>
Password to access the host.
--from-file <file_path>

Uses the specified file to load hostname, user and password. Values provided as options override the values from the file.

-f|--force
Does not ask before performing action.

Importing and exporting current configuration

The configuration that you set with the ap config command (alert rules, SMTP configuration, additional configuration parameters) can be exported into a file for backup and then imported into the same machine or into another one.
export [<filename>]
Exports the configuration settings into a file. You can specify a file name. If not specified, the file is saved as pm_export_YYYY-MM-DD-HH-mm-ss.dat in the current directory.
import <filename> [--force]
Imports the configuration settings from the specified file. With --force flag no confirmation is asked. After importing, you need to restart platform management for the changes to take effect.

Parameters for setting alert rules

--list alerts_rules
Lists alert rules.
--test alerts_rules --reason_code <reason_code>
Enables you to check which action is taken for a given reason code.
--set alerts_rules --type (action|to|add_to) [--scope <alert_type>|<alert_reason_code>] --value (<action_int>|<email_list>)
Enables you to set parameters for a given alert rule.
--type
Specifies the rule type:
  • action - determines action to take.
  • to - determines email list to send the email to.
  • add_to - determines email list to add to the already existing list.
--scope
Specifies rule level. For more information on the scope, see Alert rules
--value (<action_int>|<email_list>)
Specifies new value for the action to be taken for the alert rule. Depending on alert type, the value can be either a comma separated email list 'mail_1@example.com, mail_2@example.com, mail_3@example.com', or an integer standing for an action to be taken:
  • 0 - do nothing
  • 1 - send email
  • 2 - open PMR
  • 4 - send SNMP trap
  • 5 - send email and SNMP trap
  • 6 - send SNMP trap and open PMR
--del alerts_rules --type (action|to|add_to) [--scope <alert_type>|<alert_reason_code>]
Deletes selected rule. See above for parameters description.
Sample command output:
ap config --list alerts_rules

Action rules
+----------------------+----------------+----------+
| Scope                | Value          | Built-in |
+----------------------+----------------+----------+
| default              | 1 (send email) |      YES |
| ACTION_FAILED        | 0 (do nothing) |      YES |
| APPLIANCE_EVENT      | 0 (do nothing) |      YES |
| HW_SERVICE_REQUESTED | 2 (open PMR)   |      YES |
| STARTUP_FAILED       | 0 (do nothing) |      YES |
+----------------------+----------------+----------+

Email rules
+-------+------+-------+
| Scope | Mode | Value |
+-------+------+-------+
+-------+------+-------+

Parameters for setting SMTP

--set smtp option <value> [option <value> [option <value> ...]]
Sets SMTP details:
  • If any of the options below is provided, all of the options from this list must be provided:
    --mail_server_name <server_name>
    Mail server name
    --mail_server_port <port>
    Mail server port
    --sender_name <sender_name>
    Sender signature to be displayed at the end of the notification email, for example: Yours, Adam
    --sender_address <email>
    Email address of the sender
  • Other options where all of the options below must be provided if login_username or login_password is:
    --login_method <value>
    Login method to be used. The following values are supported:
    0 - no login
    1 - cram-md5
    2 - login
    3 - plain
    --login_username <username>
    User login.
    --login_password <password>
    User password. Note that the --login_password parameter might be provided without value. In such a case the user will be interactively prompted for password.
--smtp_encryption <smtp_encryption>
SMTP encryption method to be used. The following values are supported:
0 - no encryption
1 - STARTTLS
2 - SSL/TLS connection
--list smtp
Lists SMTP configuration.
Sample commands for SMTP:
[root@node0101 ~]# ap config --set smtp --login_method 2 --login_password 123 --login_username test
Updated successfully
[root@node0101 ~]# ap config --list smtp
Mail Server Name    : localhost
Mail Server Port    : 25
Sender Name         : Yours, Admin
Sender Address      : admin@company.com
Login Method        : login
Login Username      : test
Login Password      : ***

Parameters for setting SNMP

--set snmp option <value> [option <value> [option <value> ...]]
Sets SNMP details:
--snmp_ip_address <snmp_ip_address>
IP address of the host which is receiving SNMP traps.
--snmp_port <snmp_port>
SNMP traps receiver port.
--snmp_security_name <snmp_security_name>
SNMP security name.
--snmp_security_level <snmp_security_level>
Security level to be used. The following values are supported:
0 - noAuthNoPriv
1 - authNoPriv
2 - authPriv
--snmp_auth_key <snmp_auth_key>
Authentication key name.
--snmp_auth_protocol <snmp_auth_protocol>
SNMP authentication protocol. Takes one of the following values:
0 - none
1 - MD5
2 - SHA
--snmp_enc_key <snmp_enc_key>
Encryption key.
--snmp_enc_protocol <snmp_enc_protocol>
Encryption protocol. One of the following supported values:
0 - no encryption
1 - DES
2 - AES
--snmp_engine_id <snmp_engine_id>
SNMP engine ID.
--list snmp
Lists SNMP configuration.

Additional parameters

--set params [<param>=<value> [<param>=<value> [...]]]
Changes default settings for specified parameters. Use space delimited list for multiple parameters.
--list params
Lists parameters with values other than default.
Sample commands:
ap config --set params suspend_unreachable_nodes=true
Updated successfully. Changes will be effective after platform manager restart.
 ap config --list params

User config
+---------------------------+-------+
| Param                     | Value |
+---------------------------+-------+
| suspend_unreachable_nodes | True  |
+---------------------------+-------+