Monitoring > 2 - Management Monitoring Services > Modify Monitoring Service

2.3 Modify Monitoring Service


By the method SetModifyMonitoringService you can modify a Monitoring Service.

Parameters
monitoringServiceID
Type: Integer
monitoring Service id.

monitorMaxHourNotification
Type: Integer
max number of notifications for each hour.

monitorName
Type: String
service's name.

/// WsMonitoring.SetModifyMonitoringService Method (c# .NET)
public static string SetModifyMonitoringService(WsMonitoringClient client,
    int monitorMaxHourNotification, int monitoringServiceID, 
    String monitorName)
{
    //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
 ModifyMonitoringServiceEntity request = new ModifyMonitoringServiceEntity();
 request.MonitoringServiceID = monitoringServiceID;
 request.Name = monitorName;
 request.MaxHourNotification = monitorMaxHourNotification;                

 // call method SetModifyMonitoringService 
 // obtaining a WsResult item
 WsResult result = client.SetModifyMonitoringService(request);

 //if the call is Success print value
 if (result.Success)
 {
     // get Value returned from server
     stringBuilder.Append(" Operation successfully. Result Code : ");
     stringBuilder.Append(result.ResultCode);
 }
 else
 {
     throw new ApplicationException(result.ResultMessage);
 }
    }
    catch (Exception ex)
    {
 // re-run the error
 throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
/// WsMonitoring.SetModifyMonitoringService Method (JAVA)
public static String SetModifyMonitoringService(IWsMonitoring client, 
    Integer monitorMaxHourNotification,
    Integer monitoringServiceID, String monitorName)
{
    //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
    {
        ModifyMonitoringServiceEntity modifyMonitoringServiceEntity = 
           new ModifyMonitoringServiceEntity();
        modifyMonitoringServiceEntity.setMaxHourNotification
            (monitorMaxHourNotification);
        modifyMonitoringServiceEntity.setMonitoringServiceID(monitoringServiceID);
        modifyMonitoringServiceEntity.setName(monitorName);

        WsResult result = 
            client.setModifyMonitoringService(modifyMonitoringServiceEntity);

        if (!result.isSuccess())
        {
            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