Monitoring > 1 - Understanding the platform > Get monitoring IP Address

1.4 Get monitoring IP Address


By the method GetMonitoringIPAddress you can retrieve the list of IP Addresses for the monitoring services.


/// WsMonitoring.GetMonitoringIPAddress Method (c# .NET)
public static string GetMonitoringIPAddress(WsMonitoringClient client,
    String ip, int regionId)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
 // create the request object
 MonitoringIPAddressEntity request = new MonitoringIPAddressEntity();
 request.RegionID = regionId;
 request.IP = ip;

 // call method GetMonitoringIPAddress 
 // obtaining a WsResultOfArrayOfMonitoringIPAddressEntity item
 WsResultOfArrayOfMonitoringIPAddressEntity result =
     client.GetMonitoringIPAddress(request);

 // if the call is Success print returned values
 if (result.Success)
 {
     stringBuilder.Append("Operation ends successfully\n");

     // get Value returned from server
     MonitoringIPAddressEntity[] items = result.Value;

     // for each item print the information
     foreach (MonitoringIPAddressEntity item in items)
     {
  stringBuilder.Append("\nRegionID: ");
  stringBuilder.Append(item.RegionID);
  stringBuilder.Append("\nIp: ");
  stringBuilder.Append(item.IP);
     }
 }
 else
 {
     throw new ApplicationException(result.ResultMessage);
 }
    }
    catch (Exception ex)
    {
 // re-run the error
 throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// WsMonitoring.GetMonitoringIPAddress Method (JAVA)
public static String GetMonitoringIPAddress(IWsMonitoring client, 
    String ip, Integer regionId) 
    {
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
 .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try 
        {
        MonitoringIPAddressEntity monitoringIPAddressEntity = 
            new MonitoringIPAddressEntity();
        monitoringIPAddressEntity.setIP(ip);
        monitoringIPAddressEntity.setRegionID(regionId);
        // call method GetMonitoringIPAddress 
        // obtaining a WsResultOfArrayOfMonitoringIPAddressEntity item
        WsResultOfArrayOfMonitoringIPAddressEntity result = 
            client.getMonitoringIPAddress(monitoringIPAddressEntity);

        //if the call is Success print values
        if (result.isSuccess()) 
     {
     ArrayOfMonitoringIPAddressEntity items = result.getValue(); 
     List monitoringIPAddress = 
  items.getMonitoringIPAddressEntity();
 
     for (Iterator it = 
  monitoringIPAddress.iterator(); it.hasNext();)
         {
         MonitoringIPAddressEntity item = it.next();
         stringBuilder.append("\nRegionID: ");
         stringBuilder.append(item.getRegionID());
         stringBuilder.append("\nIp: ");
         stringBuilder.append(item.getIP());
                }
        } else {
            throw new Exception(result.getResultMessage());
        }
    } catch (Exception ex) {
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.services.cloud.it/wsMonitoring/v2.8/wsMonitoring.svc?wsdl
See also