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>] [--only alerts_rules|smtp|snmp|params [alerts_rules|smtp|snmp|params ...]]
    import <filename> [--force] [--dry_run]
  --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
  --reset alerts_rules
  --set smtp option <value> [option <value> [option <value> ...]]
    if any of below options are provided, all of them must be:
      --mail_server_name
      --mail_server_port
      --sender_name
      --sender_address
    authentication options (all of 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
  --del smtp
  --list smtp
  --test smtp --value <email_list>
  --set snmp option <value> [option <value> [option <value> ...]]
      --snmp_driver
      --snmp_notification_type
      --snmp_ip_address
      --snmp_port
      --snmp_version
      --snmp_community
      --snmp_security_name
      --snmp_security_level
      --snmp_auth_key
      --snmp_auth_protocol
      --snmp_enc_key
      --snmp_enc_protocol
      --snmp_engine_id
  --del snmp
  --list snmp
  --test snmp
--set cc_auth_proxy option <value> [option <value> [option <value> ...]]
  if any of below options are provided, all of them must be:
    --proxy_username
    --proxy_password
--del cc_auth_proxy
--list cc_auth_proxy
  --set params [<param>=<value> [<param>=<value> [...]]]
  --list params

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.
--port <number>
Specifies the port to use, default: 5001.
--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 Service Request
  • 4 - send SNMP trap
  • 5 - send email and SNMP trap
  • 6 - send SNMP trap and open Service Request
--del alerts_rules --type (action|to|add_to) [--scope <alert_type>|<alert_reason_code>]
Deletes selected rule. See above for parameters description.
--reset alerts_rules
Restores defaults for given configuration.
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 Service Request) |      YES |
| STARTUP_FAILED       | 0 (do nothing)           |      YES |
| SW_SERVICE_REQUESTED | 2 (open Service Request) |      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.
--del smtp
Deletes SMTP configuration.
--test smtp --value <email_list>
Tests 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_driver <snmp_driver>
Software used to create and send SNMP trap.
netsnmp - uses net-snmp-utils from the Net-SNMP project
pysnmp - uses pysnmp from the SNMP Labs
--snmp_notification_type <snmp_notification_type>
Notification type to use.
trap - sends TRAP (unacknowledged)
inform - sends INFORM (acknowledged on receive)
--snmp_ip_address <snmp_ip_address> [<snmp_ip_address> ...]
SNMP IP address/hostname.
--snmp_port <snmp_port> [<snmp_port> ...]
SNMP port.
--snmp_version <snmp_version>
SNMP trap version. The following values are supported:
1 - 1
2 -2c
3 - 3
--snmp_community
SNMP community string to use in SNMPv1/SNMPv2 traps.
--snmp_security_name <snmp_security_name>
SNMP security name.
--snmp_security_level <snmp_security_level>
Security level to be used. 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.
--del snmp
Deletes SNMP configuration.
--test snmp
Tests 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.
--only {alerts_rules,smtp,snmp,params} [{alerts_rules,smtp,snmp,params} ...]
Limits type(s) of config exported to listed ones
--dry_run
To be used with import. It processes the config file, but does not truly import it.
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  |
+---------------------------+-------+