1 Reply Latest reply on Jun 8, 2017 6:17 AM by tomas.vrabel

    Is it possible to update the volume capacity thresholds via the REST API?


      I am looking to make updates to volume capacity thresholds in Orion. I have hundreds of volumes to update thresholds on and am looking to utilize the REST Api to make the changes quickly and accurately. Is this possible?


      I am pretty familiar with the API but am stumbling trying to even pull the existing thresholds via the SWIS Uri (example below):


      Uri for volume from forecast capacity table:



      Respose from GET to https://<SolarWinds>:17778/SolarWinds/InformationService/v3/Json/swis://<solarwindsFQDN>/Orion/Orion.Nodes/NodeID=79/Volumes/VolumeID=5942/ForecastCapacity/EntityType="Orion.Volumes",MetricId=3


        "Message": "Invalid key properties specified for entity Orion.VolumesForecastCapacity.\r\nParameter name: filter",
        "ExceptionType": "System.ArgumentException",
        "FullException": "System.ArgumentException: Invalid key properties specified for entity Orion.VolumesForecastCapacity.\r\nParameter name: filter\r\n   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveFilter(IEntityType entity, SwisUriFilter filter, Boolean isHosted)\r\n   at SolarWinds.InformationService.Core.SwisUriResolver.ValidateAndResolveUri(SwisUri uri, IQueryExecutionContext context)\r\n   at SolarWinds.InformationService.Core.CrudProcessor.Read[T](SwisUri uri, IQueryExecutionContext context)\r\n   at SolarWinds.InformationService.Core.InformationService.Read(String uri)"


      Using the core Volume Uri I was able to pull all sorts of properties back but not the Volume Capacity Thresholds.


      Any help would be much appreciated!

        • Re: Is it possible to update the volume capacity thresholds via the REST API?

          Below I pasted Python script that set forecast settings.

          You need to use SWIS CRUD update operation on Orion.ForecastCapacitySettings entity.


          Please check what metricId is used in your environment, in my environment metricId = 3 is used for Forecast.Metric.PercentDiskUsed. Metrics are represented by Orion.ForecastMetrics entity.



              swis = SwisClient(server, username, password)
              volumeId = 14
              metricId = 3
              results = swis.query("SELECT Uri FROM Orion.ForecastCapacitySettings WHERE InstanceId=@id and MetricId=@metricId", id = volumeId, metricId = metricId)['results']  # set valid InstanceId
              if len(results) == 0:
                 print("no entry with given ID found")
              capacitySetting = results[0]
              capacitySettingUri = capacitySetting['Uri']
              print ("found capacitySettingUri: " + capacitySettingUri)
              swis.update(capacitySettingUri, CriticalThreshold=60, WarningThreshold=50)
              newValue = swis.read(capacitySettingUri)
              print ("Critical threshold:", newValue['CriticalThreshold'])
              print ("Warning threshold:", newValue['WarningThreshold'])