Monitoring > 3 - Management Monitoring Services Checks > Get Monitoring Services Checks

3.1 Get Monitoring Services Checks

By the method GetMonitoringServicesChecks you can retrieve the list of monitoring checks created.

Parameters
monitoringServiceID
Type: Integer
monitor service id.
/// WsMonitoring.GetMonitoringServicesChecks Method (c# .NET)
public static string GetMonitoringServicesChecks(WsMonitoringClient client,
   int monitoringServiceID)
{
    //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
 GetMonitoringServiceEntity request = new GetMonitoringServiceEntity();
 request.MonitoringServiceID = monitoringServiceID;

 // call method GetMonitoringServicesChecks 
 // obtaining a WsResultOfArrayOfMonitoringServiceDetailsEntity item
 WsResultOfArrayOfMonitoringServiceDetailsEntity result =
           client.GetMonitoringServicesChecks(request);

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

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

     // for each item print the information
     foreach (MonitoringServiceDetailsEntity item in items)
     {
  stringBuilder.Append("\n MonitoringServiceID: ");
  stringBuilder.Append(item.MonitoringServiceID);

  foreach (MonitoringCheckEntity item2 in item.MonitoringChecks)
  {
      stringBuilder.Append("\nMonitoringCheckID ");
      stringBuilder.Append(item2.MonitoringCheckID);
  }
     }
 }
 else
 {
     throw new ApplicationException(result.ResultMessage);
 }
    }
    catch (Exception ex)
    {
 // re-run the error
 throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// WsMonitoring.GetMonitoringServicesChecks Method (JAVA)
public static String GetMonitoringServicesChecks
    (IWsMonitoring client, 
    Integer monitoringServiceID) 
{
    //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 
    {
        GetMonitoringServiceEntity getMonitoringServiceEntity = 
     new GetMonitoringServiceEntity();
        getMonitoringServiceEntity.setMonitoringServiceID(monitoringServiceID);
    
        // call method GetMonitoringServicesChecks 
        // obtaining a WsResultOfArrayOfMonitoringServiceDetailsEntity item
        WsResultOfArrayOfMonitoringServiceDetailsEntity result = 
     client.getMonitoringServicesChecks(getMonitoringServiceEntity);

        //if the call is Success print values
        if (result.isSuccess()) 
 {
     ArrayOfMonitoringServiceDetailsEntity items = result.getValue(); 
     List monitoringServiceDetailsEntity = 
  items.getMonitoringServiceDetailsEntity();
 
     for (Iterator it = 
  monitoringServiceDetailsEntity.iterator(); it.hasNext();)
     {
         MonitoringServiceDetailsEntity item = it.next();
         stringBuilder.append("\nMonitoringServiceID: ");
         stringBuilder.append(item.getMonitoringServiceID());
         ArrayOfMonitoringCheckEntity entity = item.getMonitoringChecks();
         List myList =  entity.getMonitoringCheckEntity();
         for (Iterator it2 = 
      myList.iterator(); it2.hasNext();)
  {          
      MonitoringCheckEntity item2 = it2.next();
      stringBuilder.append("\nMonitoringCheckID ");
      stringBuilder.append(item2.getMonitoringCheckID());
  }
     }
        } 
 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