Discovering BIG-IP devices
Problem this snippet solves:
The script you need for this task must:
- Identify the Enterprise Manager system on which you want to initiate the device discovery process, specifying username and password as needed.
- Initialize the API.
- Run the API.
Important: Although you can use this API to discover devices using either the TMM or the management interface, you must discover devices through an internal traffic interface (TMM) if you want to use the iControl Proxy to send messages to managed devices.
How to use this snippet:
To discover devices:
- Create a script similar to the code sample shown below.
- From a command prompt, run your script.
- When the code finishes running, a list of discovered BIG-IP devices is added to the user interface on Enterprise Manager.
Code :
/** * A class for testing the Management::EM::discover_devices iControl interface. */ public class ManagementEMDiscoverDevices { private static int MIN_ARGS = 3; private static int NUM_DEVICE_ARGS = 3; private static String USAGE = "ManagementEMDiscoverDevices " + "[] ..."; private static int EM_PORT = 443; /** * The main method. * * @param args command line arguments */ public static void main(String[] args) { if ((args.length < MIN_ARGS) || (((args.length - MIN_ARGS) % NUM_DEVICE_ARGS) != 0)) { System.err.println("Usage: " + USAGE); System.exit(1); } String emAddress = args[0]; String emUsername = args[1]; String emPassword = args[2]; int numDevices = (args.length - MIN_ARGS) / NUM_DEVICE_ARGS; String[] deviceAddresses = new String[numDevices]; String[] deviceUsernames = new String[numDevices]; String[] devicePasswords = new String[numDevices]; for (int i = 0; i < deviceAddresses.length; i++) { int index = MIN_ARGS + (i * NUM_DEVICE_ARGS); deviceAddresses[i] = args[index]; deviceUsernames[i] = args[index + 1]; devicePasswords[i] = args[index + 2]; } String taskId = null; try { iControl.Interfaces ic = new iControl.Interfaces(); ic.initialize(emAddress, EM_PORT, emUsername, emPassword); taskId = ic.getManagementEM().discover_devices(deviceAddresses, deviceUsernames, devicePasswords); } catch (Exception e) { System.err.println("Failed to discover devices: " + e.getMessage()); System.exit(1); } System.out.println("Discovery task started with task ID: " + taskId); } // public static void main } // public class ManagementEMDiscoverDevices
Published Mar 07, 2015
Version 1.0CodeCentral_194
Cirrus
Joined May 05, 2019
CodeCentral_194
Cirrus
Joined May 05, 2019
No CommentsBe the first to comment