lastValue

Retrieves the last value of metric data.

This API queries and retrieves information from CarbonData database that is associated with Timeseries and DiamondDB Services.

URL

https://<dashboard_route>/insight/service/dataset/metric/lastValue
https://<dashboard_hostname>:<dashboard_port>/insight/service/dataset/metric/lastValue
https://<myserver.ibm.com>:31443/insight/service/dataset/metric/lastValue?
entities=ncim-217,ncim-218&metrics=snmpInBandwidth&time=last-hour

Method

The supported request type.

https GET

URL parameters

Name Required Default value Description
entities No N/A Comma-separated list of entity IDs
entityNames No N/A Comma-separated list of entity names
metrics Yes N/A Comma-separated names of the metrics. Also supports metricIDs.
parents No N/A Comma-separated list of main node IDs.
Note: Must be associated with childTypes for related metrics.
parentNames No N/A Comma-separated list of device names.
Note: Must be associated with childTypes for related metrics.
searchByProperties No N/A Properties filter in this format,
"<propertyName>"<ops>'
<propertyValue>'
Note: Property name and value are case-sensitive.
For example:
"IFTYPESTRING"='ethernet-csmacd'
searchByMetricValue No N/A It is used to filter the metric data from the timeseries database based on the condition provided.
&searchByMetricValue=ts['tavg_day_LTE.Cell.Availability']==100 
and (ts['tsum_day_LTE.VOLTE.TRF.VOL.ERL']<0.0001 or ts['tsum_day_LTE.VOLTE.TRF.VOL.MB']<0.0001)
You can include multiple metrics with and or conditions. For example,
ts[‘metricName1’] and ts[‘metricName2’] or ts[‘metricName3’]
time No N/A Specific time values are as follows:
  • last-hour
  • last-day
  • last-week
  • last-month
  • last-year
Note: You need either start/end or time parameters in the URL.
start No N/A The start time for which flow data must be returned.
end No N/A The end time for which flow data must be returned.
excludeParent No false A flag to exclude the parent ID from response.
childTypes No * Comma-separated list of entity types of nodes that must be filtered in the result. By default, it is device and interface. Supported childTypes filter values are as follows:
  • interface
  • device
  • probe
  • physicalcard
  • * (All)
entityResourceTypes No N/A Entity type of node that must be filtered in result. For example,
  • interface
  • device
  • probe
  • physicalcard
parentChildRelation No union Set operation between result from parent ID search and entity ID search. For example, intersection, union.
site No ALL Configured site name.
bizHour No ALL Configured business hours for a site. Expected values are OFF, ON and ALL.

Sample URLs

/insight/service/dataset/metric/lastValue?entities=ncim-217&metrics=snmpInBandwidth&
start=1466008260000&end=1466011860000
/insight/service/dataset/metric/lastValue?entities=ncim-217,ncim-218&metrics=snmpInBandwidth&
time=last-hour
/insight/service/dataset/metric/lastValue?entities=ncim-217&metrics=snmpInBandwidth&
time=last-hour
/insight/service/dataset/metric/lastValue?entities=ncim-217&metrics=snmpInBandwidth&
start=1466008260000&end=1466011860000
/insight/service/dataset/metric/lastValue?entityNames=T1 1/1,T1 1/2&metrics=snmpInBandwidth&
start=1466008260000&end=1466011860000
/insight/service/dataset/metric/lastValue?entities=ncim-217,ncim-218&metrics=snmpInBandwidth&
time=last-hour
/insight/service/dataset/metric/lastValue?metrics=snmpInBandwidth&time=lasthour&
searchByProperties="PHYSICALADDRESS"='30' AND "LOCATION"='KL'
/insight/service/dataset/metric/lastValue?parents=3&metrics=snmpInBandwidth&time=lastday&
childTypes=interface,device
Note:
  • At least one or more of the following parameters must be provided as follows:
    • entities
    • parents
    • entityNames
    • parentNames
    • searchByProperties
    • entityResourceTypes
  • time or a combination of start AND or OR end must be provided.
  • time parameter is superseded by combination of start AND or OR end if both combinations are present.
  • Supported operators for searchByProperties filter are as follows:
    • ,
    • =
    • <>
    • IN
    • LIKE
    • AND
    • OR
    For example,
    
    searchByProperties="sysName"='"10.55.239.40"' AND "If"='897'
    searchByProperties="sysName"='"10.55.239.40"' AND "If" IN ('897','898')
    searchByProperties="sysName" like '"10.55.239.%25"' AND "If"='897'
    
    Note: % is reserved keyword. It must be encoded with %25.

Error response

For example,
{
"errorMesg":"Either entities, parents, entityNames, parentNames or searchByProperties 
should be provided"
}

Response

The results are returned as JSON data that contains an array of the following fields:
Name Data type Description
entity number The entity that is associated with the time and metric value.
parent number The parent entity ID associated with the entity.
entityName string The entity name. This value is defaulted as unknown if enrichment fails.
parentName string The parent entity name. This value is defaulted as unknown if enrichment fails.
MetricValue map Map of metric given in input parameters their values.

JSON code


[
   {
      "parent":2,
      "entityName":"entity1",
      "parentName":"parent2",
      "health":10.0,
      "entity":1,
      "cpuUsage":10.0
   },
   {
      "parent":4,
      "entityName":"entity2",
      "parentName":"parent4",
      "health":10.0,
      "entity":2,
      "cpuUsage":10.0
   }
]