Beispiel #1
0
 public BeginAddSensorQueryParameters(Either <Device, int> deviceOrId, SensorType type, ISensorQueryTargetParameters queryParameters) :
     this(deviceOrId, type.EnumToXml(), queryParameters)
 {
 }
Beispiel #2
0
        internal BeginAddSensorQueryParameters(Either <Device, int> deviceOrId, string sensorType, ISensorQueryTargetParameters queryParameters) : base(deviceOrId.ToPrtgObject())
        {
            if (sensorType == null)
            {
                throw new ArgumentNullException(nameof(sensorType), "Sensor type cannot be null.");
            }

            if (string.IsNullOrWhiteSpace(sensorType))
            {
                throw new ArgumentException("Sensor type cannot be null or whitespace.", nameof(sensorType));
            }

            OriginalType = sensorType;

            QueryParameters = queryParameters?.ToMultiQueryParameters();

            if (QueryParameters?.QueryTarget != null)
            {
                QueryTarget = QueryParameters.QueryTarget;
            }
            else
            {
                this[Parameter.SensorType] = sensorType;
            }
        }
Beispiel #3
0
 /// <summary>
 /// Asynchronously rtrieves all sensor targets of a sensor type not currently supported by PrtgAPI.
 /// </summary>
 /// <param name="deviceOrId">The device or ID of the device to retrieve sensor targets for.</param>
 /// <param name="sensorType">The type of sensor to retrieve sensor targets for.</param>
 /// <param name="tableName">The name of the Dropdown List or Checkbox Group the sensor targets belong to. If this value is null, PrtgAPI will attempt to guess the name of the table. If this value cannot be guessed or is not valid, an <see cref="ArgumentException"/> will be thrown listing all possible values.</param>
 /// <param name="progressCallback">A callback function used to monitor the progress of the request. If this function returns false, the request is aborted and this method returns null.</param>
 /// <param name="timeout">Duration (in seconds) to wait for sensor targets to resolve.</param>
 /// <param name="queryParameters">A <see cref="SensorQueryTarget"/>, <see cref="SensorQueryTargetParameters"/> or <see cref="SensorMultiQueryTargetParameters"/> value specifying the parameters must be known prior to interrogating a sensor's dynamic parameters (such as the SNMP Library file to use or IPMI UserName and Password).</param>
 /// <param name="token">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
 /// <exception cref="TimeoutException">Sensor targets failed to resolve within the specified timespan.</exception>
 /// <returns>If the request is allowed to run to completion, a generic list of sensor targets. If the request is aborted from the progress callback, this method returns null.</returns>
 public async Task <List <GenericSensorTarget> > GetSensorTargetsAsync(Either <Device, int> deviceOrId, string sensorType, string tableName = null, Func <int, bool> progressCallback = null, int timeout = 60, ISensorQueryTargetParameters queryParameters = null, CancellationToken token = default(CancellationToken)) =>
 await client.ResolveSensorTargetsAsync(deviceOrId, sensorType, progressCallback, timeout, queryParameters, token, r => GenericSensorTarget.GetTargets(r, tableName)).ConfigureAwait(false);