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 in general, see The Structure of System Configuration Commands.

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 connection configuration requires two steps

To create a new connection, you first 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.

Then, when you run the create command, you specify the location of the snmp.json file with your configurations.

If passwords are required, you are prompted to enter them at runtime and they are added to the jaws.properties file in an encrypted form. Passwords are not allowed in the snmp.json file as input because having them saved in an unencrypted form presents a security risk.

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 more information, see The Structure of System Configuration Commands.

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. Nevertheless, when you execute the command, you will be asked whether you would like to enter a password. You can choose not to, and just press Entrer

"snmpHostname" : "10.10.10.10",

"snmpPort" : 162,

"snmpMessageType": "SNMPv3 Inform",

"snmpSecurityLevel" : "authNoPriv",

"snmpSecurityName" : "abc",

"snmpPrivacyProtocol" : "AES",

Step 2 for all SNMP versions: Prepare for password input

If you do not need to provide Depending on the method

Step 3 for all SNMP versions: Create SNMP manager configuration

Use the following command to create a SNMP Manager for AAI mail communications based on the configuration settings in your snmp.json file. For information, see Step 1 for SNMPv2 Managers: Define an snmp.json file or Step 1 for SNMPv3 Managers: Define an snmp.json file.

  1. Go to the command prompt of your operating system.
  2. Enter the create 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 --create "<Full path>/snmp.json"

    • 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 --create "<Full path>/snmp.json"

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

  3. 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.

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

  4. 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 output: Create an SNMP connection

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 --create command to create an SNMP manager configurations in AAI with the following specifications:

  • The configuration settings for the SNMP manager are defined in c:/appl/Automic_Automation_Intelligence/config/snmp.json.
  • With the optional parameter, we specify the location of the AAI installation directory.

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

Starting Config Tool

19:18:34.214 INFO [termalabs.configui.Main] Running snmp config

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

19:18:34.348 INFO [configui.settings.SnmpConfigHandler] Checking if /opt/Automic_Automation_Intelligence/config/snmp.json exists and is a file

19:18:34.593 INFO [configui.settings.SnmpConfigHandler] /opt/Automic_Automation_Intelligence/config/snmp.json is a valid json file

19:18:34.593 INFO [termalabs.configui.Main] Provided snmpconfig command is valid

19:18:34.605 INFO [configui.settings.SnmpConfigHandler] Validating SNMP fields from /opt/Automic_Automation_Intelligence/config/snmp.json

Please enter SNMP Auth Password: []

Do you want to update SNMP Privacy Password? (Y/n) Y

Please enter SNMP Privacy Password:

19:19:51.649 INFO [configui.settings.SnmpConfigHandler] Successfully validated SNMP fields from /opt/Automic_Automation_Intelligence/config/snmp.json

19:19:51.650 INFO [configui.settings.SnmpConfigHandler] Adding SNMP details to /opt/Automic_Automation_Intelligence/jaws.properties

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

19:19:52.355 INFO [configui.settings.SnmpConfigHandler] Successfully added SNMP details to /opt/Automic_Automation_Intelligence/jboss/standalone/configuration/jaws.properties

Example — Creating an SNMP Configuration with a Script

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

Prerequisites and dependencies

Parameters

  • snmpconfig the command for the SNMP configuration.
  • --create is the method/mode.
  • "<Full path>/snmpconfig.json" is the required argument that provides the full path to the properties file with the configuration settings.

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"

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

For more information about the script structure, see Example: Using a Script in The Structure of System Configuration Commands.

Runtime behavior

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.

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.

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.

For more information about the script structure, see Example: Using a Script in The Structure of System Configuration Commands.

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.

For more information about the script structure, see Example: Using a Script in The Structure of System Configuration Commands.

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.