SNMP Configuration Commands

As an AAI administrator or in-house developer, you can use the commands in this topic to define and maintain SNMP manager configurations for your AAI installation. These connection definitions are the same as those that you otherwise define on the Other tab of the AAI Configuration Tool. For more information, see Configuration Tool - Other Tab.

For information about system configuration commands, see Configuration Tool Command Line Interface.

This page includes the following:

About the SNMP Configuration Commands

AAI supports four types of SNMP connections:

  • SNMPv2 Get
  • SNMPv2 Trap
  • SNMPv3 Trap
  • SNMPv3 Inform

You can configure more than one SNMP communication connection type and you can also configure multiple Trap connections. Each connection configuration must have a unique combination of snmpHostname and snmpPort.

Where AAI stores the configurations

The SNMP connection configurations are stored in the jaws.properties file in your AAI installation directory. The full path looks like this: 

Automic_Automation_Intelligence/jboss/standalone/configuration/jaws.properties

Creating a new SNMP configuration requires three steps

Overall, to create an SNMP manager configuration, you must do three things:

  1. Define your configuration parameter values in an snmp.json file that is used as input for the create command. A template file is provided for you to use when preparing the snmp.json file.

  2. If passwords are required and you do not want to have to enter it at a prompt when the command runs, prepare a snmpPassword.properties file with the password values in it.

  3. Run the create command, with the required and optional parameters for your SNMP manager.

The SNMP commands use the config.jar

Like other system configuration commands, creating and deleting SNMP connection configurations is executed via the config.jar Java application in the AAI installation directory.

For information about system configuration commands, see Configuration Tool Command Line Interface.

snmpconfig --create

Configure a new SNMP manager for your AAI installation.

Prerequisites and dependencies

  • You are logged in as an admin user in AAI.
  • No SNMP manager with the same host and port is configured in the jaws.properties file.

Result

An SNMP manager is configured for AAI according to the configuration settings that you specify in the snmp.json file and added to the jaws.properties file. You can configure more than one SNMP manager as long as each one has a unique combination of HostName and Port.

Step 1 for SNMPv2 Managers: Define an snmp.json file

You define the configurations for SNMP managers in an snmp.json file. A template file is provided to simplify this task. Use the following steps to prepare the file for configuring an SNMPv2 manager:

  1. Go to the config directory of your AAI installation (<Full path to AAI Installation directory>/config).
  2. Make a copy of the snmpconfig.template file and name it snmp.json.

    You can move your json file anywhere you want on the same physical server where AAI is installed.   

  3. In your snmp.json file, define the following SNMP properties for an SNMPv2 manager:

    • snmpHostName (required) - The DNS hostname or IP address of the location of the SNMP manager.

      Values: A valid IPV4 address, such as "10.10.10.10" or "blrbdl003136-01.example.net"

      Default: None

    • snmpPort (required) - The port that your server has open for the SNMP connection.

      Values: Any number between 1 – 65535

      Default: 162

    • snmpCommunity (optional) - A user ID or password that allows access to data on an agent.

      Values: A string value within double quotation marks, for example "aaiCommunityUser".

      Default: blank

    • snmpMessageType (required) - The SNMP version and type of the SNMP manager

      Values for SNMPv2: "SNMPv2 Get" / "SNMPv2 Trap"

      Default: none

    These are the only parameters that are relevant to SNMPv2 managers.

  4. Save your snmp.json file.

    A configuration for the SNMPv2 manager is added to the jaws.properties file with the parameter values in your snmp.json file.

Example snmp.json input file for an SNMPv2 manager

"snmpHostName" : "10.10.10.10"

"snmpPort" : 162

"snmpCommunity" : "aaiCommunityUser"

"snmpMessageType": "SNMPv2 Trap"

Step 1 for SNMPv3 Managers: Define an snmp.json file

You define the configurations for SNMP managers in an snmp.json file. A template file is provided to simplify this task. Use the following steps to prepare the file for configuring an SNMPv3 manager:

  1. Go to the config directory of your AAI installation (<Full path to AAI Installation directory>/config).
  2. Make a copy of the snmpconfig.template file and name it snmp.json.

    You can move your json file anywhere you want on the same physical server where AAI is installed.   

  3. In your snmp.json file, define the following SNMP properties for an SNMPv3 manager:

    • snmpHostName (required) - The DNS hostname or IP address of the location of the SNMP manager.

      Values: A valid IPV4 address, such as "10.10.10.10" or "blrbdl003136-01.example.net"

      Default: None

    • snmpPort (required) - The port that your server has open for the SNMP connection.

      Values: Any number between 1 – 65535

      Default: 162

    • snmpMessageType (required) - The SNMP version and type of the SNMP manager

      Values for SNMPv3: "SNMPv3 Inform" / "SNMPv3 Trap"

      Default: none

    • snmpSecurityLevel (required for SMNPv3) - The type of access validation that is required for SNMP communication

      Values

      • noAuthNoPriv: No password authentication required and no encryption is used

      • authNoPriv: Password authentication required but no encryption is used

      • authPriv: Password authentication is required and it is encrypted  

      Default: none

    • snmpSecurityName (required for SMNPv3) - The user name of the SNMP manager

      Values: A string value

      Default: none

    • snmpPrivacyProtocol (required) - The encryption protocol that you want to use.

      Values for SNMPv3: "AES"/ "DES"

      Default: none

    • snmpAuthProtocol (required) - The authentication protocol to be used with the SNMP manager

      Values for SNMPv3: "MD5"/ "SHA"

      Default: none

    • snmpEngineID (required for SNMPv3 Inform only) - MAC or IP address that uniquely identifies the SNMP entity to the SNMP Manager

      Value for SNMPv3 Inform: A string value in hex format, for example "80:00:01:01:0a:14:1e:28".

      Default: none

    Note:

    For security reasons, the json file has no parameter for the SNMP user passwords. When the command is executed, you will be asked to enter the passwords relevant to the smnpSecurityLevel you specified. They will be added to the jaws.properties file.  

  4. Save your snmp.json file.

    A configuration for the SNMPv3 manager is added to the jaws.properties file with the parameter values in your snmp.json file.

Example snmp.json input file for an SNMPv3 manager

This example shows a configuration for an SNMPv3 Inform manager. The security level is set to authNoPriv, meaning that authentication is mandatory but no privacy password is required. Provide the authentication password in the snmpPassword.properties file and add the -pf parameter and path to the file in the command.

"snmpHostname" : "10.10.10.10",

"snmpPort" : 162,

"snmpMessageType": "SNMPv3 Inform",

"snmpSecurityLevel" : "authNoPriv",

"snmpSecurityName" : "abc",

"snmpPrivacyProtocol" : "AES",

Step 2: Prepare password input

If your SNMP mail server requires a password, the command will fail if you do not provide one. There are two options to provide the password value, and if a password is not required there are options to not provide one.

Option 1: Manual entry at runtime with the -p parameter

Use the -p parameter in the command. No preparation is necessary.

Option 2: With a properties file and the -pf parameter

Create an snmpPassword.properties file somewhere on the AAI installation server with the following two property key and the password value pairs:

  • snmpAuthPassword="<authorization_password_value>"
  • snmpPrivacyPassword="<privacy_password_value>"

Option 3: Choosing to provide no password

If your SNMP mail server does not require either or both passwords, you can configure the connection without them one in one of the following ways:

  • Use the -p parameter and when you are prompted to enter the passwords at runtime, just press Enter.

  • Use the -pf parameter and create an snmpPassword.properties file with an empty value for the passwords you do not want to define, for example:

    • snmpPrivacyPassword=""

Note:

Passwords that you define are added to thejaws.properties file in an encrypted form.

Step 3 for all SNMP versions: Create SNMP manager configuration

Command and Parameters

The following shows all required and optional parameters of the command to create an SMTP mail server configuration for an AAI installation.

java -Dswing.aatext=true -Daai.installation.dir="<Full path to AAI Installation directory>" -jar config.jar snmpconfig --create "<Full path>/smtpconfig.properties" -pf <Full path>/snmpPassword.properties" |-p

Where snmpconfig --create are the command and the method, and the following are the possible parameters:

  • -Daai.installation.dir="<Full path to AAI Installation directory>"(optional)

    The full path to the AAI installation directory to be specified when you want to run the command from somewhere on the AAI server other than <AAI Installation directory>/config.

  • "<Full path>/snmp.json"

    The full path for the snmp.json file with the all configuration settings, except the password.

  • -p (optional)

    An additional parameter that causes the command to prompt you at runtime to enter the SNMP authentication and privacy passwords.

  • -pf "<Full path>/snmpPassword.properties" (optional)

    An additional parameter that points to an snmpPassword.properties file that contains the authentication and/or privacy passwords.

  • Important!

    Do not run both the -p and the -pf parameters in the same command! 

Example commands: Create an SNMP configuration from the CLI

Example 1:

We are in the <AAI installation>/config directory when we run the command, and we want to be prompted for the passwords.

java -Dswing.aatext=true -jar config.jar snmpconfig --create "<Full path>/snmp.json" -p

When we run the command, we will be prompted to enter an authentication and privacy passwords. If a password is required, and we do not enter one, after the third prompt attempt, the configuration would fail.

Example 2:

We are outside the <AAI installation>/config directory when we run the command and we have defined the password in a properties file.

java -Dswing.aatext=true -Daai.installation.dir="<Full path to AAI Installation directory>" -jar config.jar smtpconfig --create "<Full path>/snmp.json" -pf "<Full path>/snmpPassword.properties"

When you run the command:

  • The command it checks whether a connection configuration already exists and validates the settings.

  • If you are prompted for authentication or privacy passwords, enter the required passwords. If you are prompted to add a privacy password, add one if you want to.

  • If you use the -p parameter, when the script executes, you will be prompted on the console to enter passwords are required for your SNMP type and specified snmpSecurityLevel setting. Provide the necessary input.

  • The command creates the SNMP manager configuration in the jaw.properties file.

    Tip:

    You can view the SNMP manager in the Configuration Tool (for information, see Configuration Tool - Other Tab), or in your jaws.properties file.  

Example — Creating an SNMP Configuration with a Script

You can use a script to add an SNMP manager for AAI.

Prerequisites and dependencies

Example

The following example shows the script to create the SNMP configuration on a Linux server:

run.sh snmpconfig --create "/Automic_Automation_Intelligence/config/snmpconfig.json" -pf "/Automic_Automation_Intelligence/config/snmpPassword.properties"

On a Windows server, replace run.sh with run.bat.

snmpconfig --delete

Remove SNMP manager configurations from the jaws.properties file in your AAI installation. There are two options for the snmpconfig --delete command:

  • To remove just one, specific SNMP manager configuration
  • To remove all SNMP manager configurations in one action

Steps and script examples for both options follow.

Prerequisites and dependencies

  • You are logged in as an admin user in AAI.
  • An SNMP manager configuration that you want to delete exists.

Result:

The specified SNMP manager configuration is removed from the AAI jaws.properties. For a description of the default values for the related properties, see Step 1 for SNMPv2 Managers: Define an snmp.json file or Step 1 for SNMPv3 Managers: Define an snmp.json file.

Steps: Delete an SNMP manager configuration

Use the following command to remove an SNMP manager configuration in AAI.

  1. Open the jaws.properties file and note the snmpHostName and snmpPort for the SNMP manager that you want to delete. The combination of these two fields identify the specific SNMP manager.
  2. Enter the delete command in one of the following ways:
    • Change the directory to the config directory in the AAI installation directory, and then enter the following command:

      java -Dswing.aatext=true -jar config.jar snmpconfig --delete <snmpHostName> <snmpPort>

    • To run the command from another directory, add the optional argument to define the path to the AAI installation directory as follows:

      java -Dswing.aatext=true -Daai.installation.dir="<Full path to AAI Installation directory>" -jar config.jar snmpconfig --delete <snmpHostName> <snmpPort>

    The command checks whether a configuration exists and removes it from your AAI installation.

  3. Tip:

    You can view the connection in the Configuration Tool (for information, see Configuration Tool - Other Tab), or in your AAI database, for example, by using the query command select * from JawsProperties where propertyName like '%snmp%'.   

Example output: Delete an SNMP manager

In the following example, the first line in italics is the command we enter. The rest is returned by the program.

With this command entry, we run the snmpconfig --delete command to remove teh SNMP manager with the hostName 10.10.10.10 and Port 162. We also use the optional parameter to specify the location of the AAI installation directory.

java -Dswing.aatext=true -Daai.installation.dir="/opt/Automic_Automation_Intelligence" -jar config.jar snmpconfig

--delete 10.10.10.10 162

Starting Config Tool

19:21:43.694 INFO [termalabs.configui.Main] Running snmp config

19:21:43.694 INFO [termalabs.configui.Main] Checking if provided snmpconfig command is valid

19:21:43.695 INFO [termalabs.configui.Main] Provided snmpconfig command is valid

19:21:43.808 INFO [configui.settings.SnmpConfigHandler] Deleting SNMP entry from /opt/Automic_Automation_lntelligence/jboss/standalone/configuration/ jaws.properties

19:21:44.315 INFO [common.config.JawsPropertiesFileHandler] Saved updated properties file: /opt/Automic_Automation_Intelligence/jboss/standalone/configuration/jaws.properties

19:21:44.315 INFO [configui.settings.SnmpConfigHandler] Successfully deleted SNMP entry from /opt/Automic_Automation_Intelligence/jboss/standalone/configuration/jaws.properties

Example — Deleting an SNMP Manager with a Script

You can use a script to remove an SNMP manager configuration.

Prerequisites and dependencies

  • You are logged in as an admin user in AAI.
  • An SNMP manager configuration exists.
  • Before you run the script, you start in the start in the config directory in the AAI Installation directory.

Parameters

  • snmpconfig the command for the snmp configuration.
  • --delete is the method/mode.
  • <snmpHostName> and <snmpPort> values are the parameters that uniquely identify the SNMP manager to be deleted.

Important!

If there are multiple SNMP managers with the same combination of <snmpHostName> and <snmpPort>, they will all be deleted. In this case, after executing the delete action, re-create the ones you want to continue to use.

Example

The following example shows the script to delete the SNMP configuration on a Linux server:

run.sh snmpconfig --delete 10.10.10.10 162

On a Windows server, replace run.sh with run.bat.

Steps: Delete All SNMP Manager Configurations

Use the following command to remove all SNMP manager configurations from AAI at one time.

  1. Enter the delete command in one of the following ways:
    • Change the directory to the config directory in the AAI installation directory, and then enter the following command:

      java -Dswing.aatext=true -jar config.jar snmpconfig --delete-all

    • To run the command from another directory, add the optional argument to define the path to the AAI installation directory as follows:

      java -Dswing.aatext=true -Daai.installation.dir="<Full path to AAI Installation directory>" -jar config.jar snmpconfig --delete-all

    The command checks whether any configurations exists and removes them all from the jaws.properties file in your AAI installation.

Example — Deleting All SNMP Managers with a Script

You can use a script to remove all SNMP manager configurations at one time.

Prerequisites and dependencies

  • You are logged in as an admin user in AAI.
  • At least one SNMP manager configuration exists.
  • Before you run the script, you start in the start in the config directory in the AAI Installation directory.

Parameters

  • snmpconfig the command for the snmp configuration.
  • --delete is the method/mode.

Example

The following example shows the script to delete all SNMP manager configurations on a Linux server:

run.sh snmpconfig --delete-all

On a Windows server, replace run.sh with run.bat.

Updating an SNMP Manager Configuration

There is no specific update command for changing an existing SNMP manager configuration. If you want to change the configuration of an SNMP manager, you need to delete it and the create it again with the new configuration settings.

For information, see snmpconfig --delete and snmpconfig --create.