c
23 TopicsGet all certificates and their virtual servers and SSL profiles via API calls
Problem this snippet solves: Summary F5 will give you a decent report of all your certificates and their expiration dates. However I have not found a way to pull what Virtual Server or SSL Profile the certificates are applied to (or if they are used at all). What this code does is grabs all the virtual servers, all SSL profiles, and all certificates. Then it loops through them to find where a certificate is applied. Then it returns the certificate and virtual server info. I wrote this in C# but the logic can be used anywhere as the API calls are independent of language. How to use this snippet: You will need some way to compile C#. Easiest way is to use Visual Studio. Simply add your API credentials and IP addresses and run the code through a C# compiler. Code : https://github.com/matthewwedlow/F5_Scripts/blob/master/GetCerts.cs2.3KViews1like3CommentsHands-on C: argc and argv from main() function explained
Quick Intro Learning C is is a good way to take our understanding of Operating Systems (OS) to the next level as it touches low-level structures that other languages such as Python often abstract. I'm covering C here not only because BIG-IP runs on top of Linux but also because understanding how the OS works can help us troubleshoot more complex issues. Linux has been gaining popularity and DevOps movement certainly gave it a boost as most DevOps tools run natively on Linux. As C is the nuts and bolts of Linux 'engine', it is also no surprise that we see more Platform (DevOps) Engineers interested in learning C to extend their reach when it comes to diagnosing problems and to have a more in-depth understanding of Linux. In this article, I'm going to use a simple Hello World in C but those who already had exposure to C will also benefit from understanding more thoroughly the default arguments (argc and argv) in main() function by running the code themselves. If you already know something about C, you can skip to last section and test the code yourself. Hello World This is a hello world in Python: This is a typical hello world in C: The main() function is the way we tell C where the execution of our code should start. It is the way C language signals processor where it should look for the main piece of code to run once our program is loaded in memory. The printf() function formats and print string characters to standard output. C doesn't have an interpreter like Python as it's a compiled language. Because of this, in order to execute above code we need to compile it first, i.e. create the executable file that has the binary code ready to run. How to Compile our Hello World We usegcccommand with-oparameter pointing to the name of the executable file name. Thegcccommand compiles our code and create the executablehelloworld. It's a binary file ready to be executed. If we need to change our code, we need to re-compile our code and create another executable file. Understanding #include <library_name> Adding libraries in C is similar to other programming languages. Libraries add capabilities to your code where you can find ready-to-use functions that do something that you might need to use. C libraries end in*.h(shortfor header) and compiler searches for them in/usr/includepath by default on Linux. In this particular case here, we only added thestdio.hlibrary which is the standard C I/O library with file reading/writing/streaming handling capabilities. There are also others we might occasionally bump into in most programs: unistd.h : The Unix standard library. It has utilities for interacting with the kernel such as system calls. stdlib.h : The C standard library with many useful utilities for general data type conversion, memory allocation, etc. ctype.h : Character library with for char conversion sys/types.h : System types library which contains the most definitions for base types and structures of Linux systems. string.h : String library for C string manipulation. Why does main function have argc and argv? argc= number of arguments passed when we execute program (integer) argv= list of arguments we passed when we executed program (array) Simple answer is that this is useful stuff to have natively. It's extensively used in command line tools, for example. Let's say we're creating a command line tool and we need to retrieve the 2nd argument passed to our program. You can just retrieve it directly from main() function by callingargv[2]. No need to create an extra function for that. Let's use this simple program as an example: It should print whatever arguments I pass to it: Notice that by default, the first argument is always the program's name. Even if I don't pass any arguments that's still the case: We can conclude that every program will have at least one argument which is the name of the program itself.1.4KViews1like2CommentsSystem.InvalidOperationException was unhandled when using LocalLBVirtualServer.get_default_pool_name
Hi, I'm trying to use This snippet "C Polling Default Pool Connections" and the first half is working good until it gets to the this line "poolStats = m_interfaces.LocalLBPool.get_statistics(poolBatch);" then I get this exception : System.InvalidOperationException was unhandled HResult=-2146233079 Message=There is an error in XML document (232, 79). Source=System.Xml StackTrace: at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at iControl.LocalLBPool.get_statistics(String[] pool_names) in c:\src\iControl\2005\iControl\iControl_9_4_0\Interfaces\LocalLB\LocalLBPool.cs:line 642 .... etc can someone help me solve this problem?509Views0likes3CommentsDelete Device (C# code sample)
Problem this snippet solves: This C# client code sample uses Enterprise Manager's device inventory to delete a list of devices managed by the referenced Enterprise Manager. Code : using System; using iControl; /** * A class for testing the Management::EM::delete_devices iControl interface. */ class ManagementEMDeleteDevices { private static int MIN_ARGS = 3; private static string USAGE = "ManagementEMDeleteDevices " + "[ ]"; private static int EM_PORT = 443; /** * The main method. * * @param args command line arguments */ static void Main(string[] args) { if (args.Length < MIN_ARGS) { Console.WriteLine("Usage: " + USAGE); Environment.Exit(1); } string emAddress = args[0]; string emUsername = args[1]; string emPassword = args[2]; String[] deviceAddresses = new String[args.Length - MIN_ARGS]; for (int i = 0; i < deviceAddresses.Length; i++) { deviceAddresses[i] = args[i + MIN_ARGS]; } try { Interfaces ic = new Interfaces(); ic.initialize(emAddress, EM_PORT, emUsername, emPassword); ic.ManagementEM.delete_devices(deviceAddresses); } catch (Exception e) { Console.WriteLine("Failed to delete devices: " + e.Message); Environment.Exit(1); } Console.WriteLine("Device(s) deleted."); } // Main } // class ManagementEMDeleteDevices507Views0likes0CommentsC# Making Async Calls using the iControlAssembly
Problem this snippet solves: This C# example application shows three different ways to make iControl calls Asynchronously using the An iControlAssembly library. Each way serves a slightly different purpose depending on the needs of the application. Code : using System; using System.Collections.Generic; using System.Text; using iControl; using System.Diagnostics; using System.Threading; namespace iControlAssemblyAsyncExample { class AsyncExample { private static Thread mainThread; static void Main(string[] args) { Stopwatch sw = null; Interfaces m_Interfaces = null; IAsyncResult ar = null; string[] poolList = null; //////////////////////////////////////////////////////////////////////////////// // Synchronously connect to the BigIP Appliance Console.WriteLine("Establishing connection to Appliance."); sw = Stopwatch.StartNew(); m_Interfaces = new Interfaces("hostname", "username", "password"); Console.WriteLine("Connection completed in {0} ms\n", sw.ElapsedMilliseconds); //////////////////////////////////////////////////////////////////////////////// // Synchronously Retrieve the Pool List Console.WriteLine("Beginning syncronous Pool list retrieval."); sw = Stopwatch.StartNew(); poolList = m_Interfaces.LocalLBPool.get_list(); Console.WriteLine("Syncronous retrieval completed in {0} ms\n", sw.ElapsedMilliseconds); //////////////////////////////////////////////////////////////////////////////// // Asynchronously retrieve the Pool List, do something and then wait // for the Async call to complete. Console.WriteLine("Beginning async retrieval with wait."); sw = Stopwatch.StartNew(); ar = m_Interfaces.LocalLBPool.Beginget_list(null, null); // Do some work, which may or may not take longer than // the Async call to execute. Console.WriteLine("Done some work after {0} ms. Now waiting.",sw.ElapsedMilliseconds); ar.AsyncWaitHandle.WaitOne(); // Wait indefinitely for the Async Call to complete ar.AsyncWaitHandle.Close(); poolList = m_Interfaces.LocalLBPool.Endget_list(ar); Console.WriteLine("Asyncronous retrieval completed in {0} ms\n", sw.ElapsedMilliseconds); //////////////////////////////////////////////////////////////////////////////// // Asynchronously Retrieve the Pool List while doing something indefinitely. Console.Write("Beginning inline async retrieval"); sw = Stopwatch.StartNew(); ar = m_Interfaces.LocalLBPool.Beginget_list(null, null); while (ar.IsCompleted == false) { Console.Write("."); // Continually to something until the Async Thread.Sleep(15); // call has completed. } poolList = m_Interfaces.LocalLBPool.Endget_list(ar); Console.WriteLine("\nAsyncronous retrieval completed in {0} ms\n", sw.ElapsedMilliseconds); //////////////////////////////////////////////////////////////////////////////// // Asynchronously Retrieve the Pool List with a Callback AsyncCallback myCallBackRoutine = new AsyncCallback(MyAsyncCallback); mainThread = Thread.CurrentThread; Console.WriteLine("Beginning Callback Async retrieval"); sw = Stopwatch.StartNew(); ar = m_Interfaces.LocalLBPool.Beginget_list(myCallBackRoutine, m_Interfaces); try { while (true) { Console.Write("."); // Do something useful while we Thread.Sleep(15); // wait for the Callback to complete. } } catch (ThreadInterruptedException) { Console.WriteLine("\nAsyncronous Callback retrieval completed in {0} ms\n", sw.ElapsedMilliseconds); } Console.WriteLine("Press ANY key to exit."); Console.ReadKey(); } private static void MyAsyncCallback(IAsyncResult ar) { Interfaces m_Interfaces = (Interfaces)ar.AsyncState; string[] poolList = m_Interfaces.LocalLBPool.Endget_list(ar); int c = 0; while (c < 7) { Console.Write("X"); // Do something useful while the main Thread.Sleep(15); // thread is doing what it needs to c++; } mainThread.Interrupt(); } } }478Views0likes1CommentC# Polling Default Pool Connections
Problem this snippet solves: This C# application will display the current connections for all of the default pools. There was found to be too much overhead when sending in the list of all pools, some of which were empty so this app strips out the virtual servers with non-defined default pools and batches up requests for statistics. Code : using System; using System.Collections.Generic; using System.Text; using iControl; using System.Diagnostics; namespace PRVD.iControl.GetAllPoolCurrentConnections { class Program { static void Main(string[] args) { if (args.Length < 3 || string.IsNullOrEmpty(args[0]) || string.IsNullOrEmpty(args[1]) || string.IsNullOrEmpty(args[2])) { Console.WriteLine( "Usage: f5GetAllPoolCurrentConnections [username] [password] [hostname or ip address] optional [partition]"); return; } string user = args[0]; string pass = args[1]; string ipAddress = args[2]; string partition = ""; if (args.Length > 3 && !string.IsNullOrEmpty(args[3])) partition = args[3]; Interfaces m_interfaces = new Interfaces(); m_interfaces.initialize(ipAddress, user, pass); //Check if inialized if (!m_interfaces.initialized) Environment.Exit(Environment.ExitCode); //Get the partition list to drop into PROD bool partitionFound = false; ManagementPartitionAuthZPartition[] partitionList = m_interfaces.ManagementPartition.get_partition_list(); for (int i = 0; i < partitionList.Length; i++) { Console.WriteLine("Partition found: {0}", partitionList[ i ].partition_name); if (partitionList[ i ].partition_name == partition) { m_interfaces.ManagementPartition.set_active_partition(partitionList[ i ].partition_name); partitionFound = true; } } if (!partitionFound) { Console.WriteLine("The partition '{0}' specified was not found.", partition); return; } //Get all virtual servers string[] localVirtualServers = m_interfaces.LocalLBVirtualServer.get_list(); //PrintInfo(localVirtualServers); //Get all the active default pools string[] localDefaultPools = m_interfaces.LocalLBVirtualServer.get_default_pool_name(localVirtualServers); //PrintInfo(localDefaultPools); //Get the pool stats LocalLBPoolPoolStatistics poolStats = new LocalLBPoolPoolStatistics(); //Get the pool stat entries LocalLBPoolPoolStatisticEntry[] poolStatEntries; //Load the localDefaultPools into a List object to prune and perform batch get_statistics with List localDefaultPoolsList = RemoveNoNamePools(localDefaultPools); string[] poolBatch; int batchCount = 1; Stopwatch timer = new Stopwatch(); timer.Start(); //Break the statistics rquests into batchs of XX while(localDefaultPoolsList.Count > 0) { if(localDefaultPoolsList.Count >= 10) { poolBatch = localDefaultPoolsList.GetRange(localDefaultPoolsList.Count - 10, 10).ToArray(); localDefaultPoolsList.RemoveRange(localDefaultPoolsList.Count - 10, 10); poolStats = m_interfaces.LocalLBPool.get_statistics(poolBatch); poolStatEntries = poolStats.statistics; PrintStatistics(poolStatEntries); } else { poolBatch = localDefaultPoolsList.ToArray(); localDefaultPoolsList.Clear(); poolStats = m_interfaces.LocalLBPool.get_statistics(poolBatch); poolStatEntries = poolStats.statistics; PrintStatistics(poolStatEntries); } //Console.WriteLine("Batch {0} time elapsed: {1}", batchCount.ToString(), timer.Elapsed.ToString()); batchCount++; } Console.WriteLine("Total time elapsed: {1}", batchCount.ToString(), timer.Elapsed.ToString()); timer.Stop(); } private static List RemoveNoNamePools(string[] localDefaultPools) { List localDefaultPoolsList = new List (); foreach (string poolName in localDefaultPools) { if (poolName != "") localDefaultPoolsList.Add(poolName); } return localDefaultPoolsList; } public static void PrintInfo(string[] info) { for (int i = 0; i > info.Length; i++) { Console.WriteLine(info[ i ].ToString()); } } public static void PrintStatistics(LocalLBPoolPoolStatisticEntry[] poolStatEntries) { //Loop through each pool and print out the server side current connection stats for (int i = 0; i < poolStatEntries.Length; i++) { CommonStatistic[] commonStats = poolStatEntries[ i ].statistics; for (int x = 0; x < commonStats.Length; x++) { if (commonStats[x].type == CommonStatisticType.STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS && poolStatEntries[ i ].pool_name != "") { Console.WriteLine("Pool name: {0} Current connections: {1}", poolStatEntries[ i ].pool_name, commonStats[x].value.low.ToString()); } } } } } }476Views0likes1CommentHands-on C: Understanding Pointers step by step
Quick Intro Pointers have always been the most confusing aspect of C for new learners. As a former lecturer, I find simple hands-on examples are the best to get one started. In this article, I will explain the following: What a pointer is How a pointer is declared in C How to assign a memory address to a pointer How to change values using pointers How to move pointer to a different memory address What is a pointer? It's literally a variable that stores and point to the memory address of another variable. Don't worry, it should be clear once we go through some examples. How a pointer is declared in C How to assign a memory address to a pointer Now, imagine there's a variablexlike this: The &x just means we're assigning topthe memory address ofx: In order to retrieve the value 5 fromp, we also need to use*pbecause p (without *) retrieves the memory address ofxand*pgoes after the value stored in the memory's address. Here's the proof: Notice that C understands that adding&in front of variable retrieves its memory address. How to retrieve pointer's value Retrieving pointer's is also known asdereferencingpointer. If we change*pwe also changex. We can also assign the value that*ppoints to a different variable too (effectively changing the value ofx): How to change values using pointers When we point a pointer to an array, it will point to the memory address of array's first item at index 0: The pointer behaves in the same way as if were making the changes to the array: How to move pointer to a different memory address In this example, I pointed p to A's memory address and then pointed p to n's memory address and that's fine: Let's uncomment last line so we can see that we can't do the same with arrays, i.e. re-assigning values: Hope that clarifies a bit of the mystery behind pointers.449Views0likes2CommentsHow to programmatically activate license for Bigip using C#
I am looking for some C sample to activate license for Bigip. I have looked into the pycontrol https://devcentral.f5.com/wiki/iControl.pyControl-v2-License-BIGIP.ashx and am trying to do the similar thing in C. The wiki mentions a web service https://activate.f5.com/license/services/urn:com.f5.license.v5b.ActivationService?wsdl, but when I tries to use wsdl.exe to create a proxy class for this web service, I got the following errors: D:\temp>wsdl https://activate.f5.com/license/services/urn:com.f5.license.v5b.Act ivationService?wsdl Microsoft (R) Web Services Description Language Utility [Microsoft (R) .NET Framework, Version 4.0.30319.17929] Copyright (C) Microsoft Corporation. All rights reserved. Error: There was an error processing 'https://activate.f5.com/license/services/u rn:com.f5.license.v5b.ActivationService?wsdl'. - The document at the url https://activate.f5.com/license/services/urn:com.f5. license.v5b.ActivationService?wsdl was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The root element of a W3C XML Schema should be s chema and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'. - Report from 'DISCO Document' is 'Discovery document at the URL https://activat e.f5.com/license/services/urn:com.f5.license.v5b.ActivationService?wsdl could no t be found.'. - The document format is not recognized. - Report from 'WSDL Document' is 'There is an error in XML document (58, 16).'. - Namespace prefix 'intf:urn' is not defined. If you would like more help, please type "wsdl /?". Does anyone know if how to solve the problem? or is it the right way to access the web service at all in C? thanks Wai410Views0likes1CommentUp/Down Nodes: Visual C#
Problem this snippet solves: This app enables and disables nodes. It installs and runs as a stand alone windows application. It connects to an LTM, collects the pools, collects pool members, and allows the user to toggle the enabled/disabled state of nodes. This is my first iControl App. It is also my first run at C# and Visual Studio. It is pretty basic and a little rough around the edges. I am posting it because I did not find many examples of C# using Visual Studio. I plagiarized from other code examples found on DevCentral so you may see some similarities if you look around. The entire project is attached as a .zip. Code : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public class poolmember { public string poolname { get; set; } public string address { get; set; } public Int64 port { get; set; } public iControl.LocalLBSessionStatus status { get; set; } public iControl.CommonAddressPort addressport { get; set; } } List _poolmember = new List (); //iControl.CommonAddressPort my_addressport() = ""; iControl.Interfaces interfaces = new iControl.Interfaces(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void label6_Click(object sender, EventArgs e) { } private void label7_Click(object sender, EventArgs e) { } private void label5_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { lblVersion.Text = "Connecting ..."; lblFailover.Text = ""; lblHostname.Text = ""; if (interfaces.initialize(txtIPAddr.Text, txtAccount.Text, txtPasswd.Text)) { lblVersion.Text = interfaces.SystemSystemInfo.get_version(); lblFailover.Text = Convert.ToString(interfaces.SystemFailover.get_failover_state()); lblHostname.Text = Convert.ToString(interfaces.ManagementDevice.get_local_device()); string[] pools = interfaces.LocalLBPool.get_list(); foreach (string pool in pools) { lstBxPools.Items.Add(pool); } } else { lblVersion.Text = "Connection Failure"; } } private void lstBxPools_SelectedIndexChanged(object sender, EventArgs e) { if (lstBxPools.SelectedIndex >= 0) { btnGetMembers.Enabled = true; } else { btnGetMembers.Enabled = false; } } private void button1_Click_1(object sender, EventArgs e) { lstbxMembers.Items.Clear(); // List > members = new List >(); string[] pool = new string[1] { lstBxPools.Text }; // lstbxMemUp.Items.Add(lstBxPools.Text); iControl.CommonAddressPort[][] memberlist = interfaces.LocalLBPool.get_member_v2(pool); foreach (iControl.CommonAddressPort member in memberlist[0]) { poolmember node = new poolmember { poolname = lstBxPools.Text, address = member.address, port = member.port, addressport = member, }; _poolmember.Add(node); } foreach (poolmember member in _poolmember) { //Method requires a multi-dimensional array for input. Add CommonAddressPort to new List List convertedserverlist = new List { member.addressport }; //Convert List to Array for input into the next method iControl.CommonAddressPort[] targetarry = convertedserverlist.ToArray(); //Call the BIG-IP - Inputs are an array of Pool Names and a multi-dimensional array of CommonAddressPorts iControl.LocalLBSessionStatus[][] targetstatus = interfaces.LocalLBPool.get_member_session_status(new[] { member.poolname }, new[] { targetarry }); //Only requested a single pool, so specify the first dimension and collect data for output. foreach (iControl.LocalLBSessionStatus status in targetstatus[0]) { lstbxMembers.Items.Add(member.address + ":" + member.port + " " + status); member.status = status; } } _poolmember.Clear(); } private void btnDown_Click(object sender, EventArgs e) { if (lstbxMembers.Text.Contains("SESSION_STATUS_ENABLED")) { label7.Text = "saw Session Status ENABLED"; // string[] poolname = { lstBxPools.Text }; // interfaces.LocalLBPool.set_member_session_enabled_state(poolname[0], my_addressport[1][1], iControl.CommonEnabledState.STATE_DISABLED); string node = lstbxMembers.Text.Split(':')[0]; label7.Text = node; string[] node_a = {node}; iControl.CommonEnabledState[] states = new iControl.CommonEnabledState[] { iControl.CommonEnabledState.STATE_DISABLED }; interfaces.LocalLBNodeAddressV2.set_session_enabled_state(node_a, states); } else if (lstbxMembers.Text.Contains("SESSION_STATUS_ADDRESS_DISABLED")) { string node = lstbxMembers.Text.Split(':')[0]; string[] node_a = { node }; iControl.CommonEnabledState[] states = new iControl.CommonEnabledState[] { iControl.CommonEnabledState.STATE_ENABLED }; interfaces.LocalLBNodeAddressV2.set_session_enabled_state(node_a, states); } else { } lstbxMembers.Items.Clear(); // List > members = new List >(); string[] pool = new string[1] { lstBxPools.Text }; // lstbxMemUp.Items.Add(lstBxPools.Text); iControl.CommonAddressPort[][] memberlist = interfaces.LocalLBPool.get_member_v2(pool); foreach (iControl.CommonAddressPort member in memberlist[0]) { poolmember node = new poolmember { poolname = lstBxPools.Text, address = member.address, port = member.port, addressport = member, }; _poolmember.Add(node); } foreach (poolmember member in _poolmember) { //Method requires a multi-dimensional array for input. Add CommonAddressPort to new List List convertedserverlist = new List { member.addressport }; //Convert List to Array for input into the next method iControl.CommonAddressPort[] targetarry = convertedserverlist.ToArray(); //Call the BIG-IP - Inputs are an array of Pool Names and a multi-dimensional array of CommonAddressPorts iControl.LocalLBSessionStatus[][] targetstatus = interfaces.LocalLBPool.get_member_session_status(new[] { member.poolname }, new[] { targetarry }); //Only requested a single pool, so specify the first dimension and collect data for output. foreach (iControl.LocalLBSessionStatus status in targetstatus[0]) { lstbxMembers.Items.Add(member.address + ":" + member.port + " " + status); member.status = status; } } _poolmember.Clear(); } } }400Views0likes1CommentQuerying the status of a discovery task
Problem this snippet solves: The script you need for this task must: Identify the Enterprise Manager system on which you want to initiate a query discovery task status process, specifying username and password as needed. Specify the task ID of the task you are interested in. Initialize the API. Run the API. How to use this snippet: To query the status of a discovery task: Create a script similar to the code sample shown below. From a command prompt, run your script. When the code finishes running, the query status task(s) are added to the user interface on Enterprise Manager. The tasks you queried are also listed on the command line interface window. Code : /** * A class for testing the Management::EM::get_task_status iControl interface. */ public class ManagementEMGetTaskStatus { private static int MIN_ARGS = 3; private static String USAGE = "ManagementEMGetTaskStatus " + "[ ] ..."; 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) { System.err.println("Usage: " + USAGE); System.exit(1); } String emAddress = args[0]; String emUsername = args[1]; String emPassword = args[2]; String[] taskIds = new String[args.length - MIN_ARGS]; for (int i = 0; i < taskIds.length; i++) { taskIds[i] = args[i + MIN_ARGS]; } iControl.ManagementEMTaskStatus[] statuses = null; try { iControl.Interfaces ic = new iControl.Interfaces(); ic.initialize(emAddress, EM_PORT, emUsername, emPassword); statuses = ic.getManagementEM().get_task_status(taskIds); if (statuses.length != taskIds.length) { throw new Exception("wrong number of status values returned"); } } catch (Exception e) { System.err.println("Failed to get task status: " + e.getMessage()); System.exit(1); } for (int i = 0; i < taskIds.length; i++) { System.out.print("Task "); System.out.print(taskIds[i]); System.out.print(": "); System.out.println(statuses[i]); } } // public static void main } // public class ManagementEMGetTaskStatus357Views0likes0Comments