Examples
- Query
- Result
query MachinesWithActiveAlarms {
machines(
where: {
currentAlarms: {
metricKey: { _eq: "system" }
label: { _nin: ["NORMAL", "UNAVAILABLE"] }
}
}
) {
name
currentAlarms(
where: {
metricKey: { _eq: "system" }
label: { _nin: ["NORMAL", "UNAVAILABLE"] }
}
) {
nativeCode
startAt
label
}
}
}
{
"data": {
"machines": [
{
"name": "Star 1",
"currentAlarms": [
{
"nativeCode": "2197",
"startAt": "2022-06-09T22:49:52.444+00:00",
"label": "WARNING"
},
{
"nativeCode": "2200",
"startAt": "2022-06-09T22:49:52.444+00:00",
"label": "WARNING"
},
{
"nativeCode": "2040",
"startAt": "2022-06-09T13:51:14.583+00:00",
"label": "WARNING"
},
{
"nativeCode": "2341",
"startAt": "2022-06-09T09:45:37.143+00:00",
"label": "WARNING"
}
]
},
{
"name": "Lathe 2",
"currentAlarms": [
{
"nativeCode": "ALARM",
"startAt": "2022-06-10T09:21:56.898+00:00",
"label": "FAULT"
}
]
}
]
}
}
- Query
- Result
query AggregatedQuantitiesExample {
aggregatedQuantities(
args: {
machineRef: 99999
metricKey: "X1load"
windowWidth: "24h"
bucketWidth: "1h"
}
order_by: { bucketStartAt: asc }
) {
bucketStartAt
eventCount
maxValue
avgValue
}
}
{
"data": {
"aggregatedQuantities": [
{
"bucketStartAt": "2022-06-09T18:01:28.646434+00:00",
"eventCount": 1057,
"maxValue": 149,
"avgValue": 10.0047303689688
},
{
"bucketStartAt": "2022-06-09T19:00:00+00:00",
"eventCount": 981,
"maxValue": 142,
"avgValue": 8.5881753312946
},
{
"bucketStartAt": "2022-06-09T20:00:00+00:00",
"eventCount": 794,
"maxValue": 137,
"avgValue": 8.79596977329975
},
{
"bucketStartAt": "2022-06-09T21:00:00+00:00",
"eventCount": 974,
"maxValue": 151,
"avgValue": 9.23100616016427
},
{
"bucketStartAt": "2022-06-09T22:00:00+00:00",
"eventCount": 399,
"maxValue": 53,
"avgValue": 5.22305764411028
},
{
"bucketStartAt": "2022-06-09T23:00:00+00:00",
"eventCount": 960,
"maxValue": 152,
"avgValue": 9.01041666666667
},
{
"bucketStartAt": "2022-06-10T00:00:00+00:00",
"eventCount": 968,
"maxValue": 151,
"avgValue": 9.86673553719008
},
{
"bucketStartAt": "2022-06-10T01:00:00+00:00",
"eventCount": 965,
"maxValue": 162,
"avgValue": 10.7150259067358
},
{
"bucketStartAt": "2022-06-10T02:00:00+00:00",
"eventCount": 950,
"maxValue": 164,
"avgValue": 10.1505263157895
},
{
"bucketStartAt": "2022-06-10T03:00:00+00:00",
"eventCount": 986,
"maxValue": 149,
"avgValue": 9.17139959432049
},
{
"bucketStartAt": "2022-06-10T04:00:00+00:00",
"eventCount": 872,
"maxValue": 165,
"avgValue": 9.96330275229358
},
{
"bucketStartAt": "2022-06-10T05:00:00+00:00",
"eventCount": 1000,
"maxValue": 164,
"avgValue": 10.505
},
{
"bucketStartAt": "2022-06-10T06:00:00+00:00",
"eventCount": 987,
"maxValue": 153,
"avgValue": 10.2168186423506
},
{
"bucketStartAt": "2022-06-10T07:00:00+00:00",
"eventCount": 1026,
"maxValue": 142,
"avgValue": 9.82261208576998
},
{
"bucketStartAt": "2022-06-10T08:00:00+00:00",
"eventCount": 1081,
"maxValue": 163,
"avgValue": 9.61424606845513
},
{
"bucketStartAt": "2022-06-10T09:00:00+00:00",
"eventCount": 1072,
"maxValue": 161,
"avgValue": 10.1529850746269
},
{
"bucketStartAt": "2022-06-10T10:00:00+00:00",
"eventCount": 1002,
"maxValue": 151,
"avgValue": 9.56487025948104
},
{
"bucketStartAt": "2022-06-10T11:00:00+00:00",
"eventCount": 1004,
"maxValue": 155,
"avgValue": 9.28585657370518
},
{
"bucketStartAt": "2022-06-10T12:00:00+00:00",
"eventCount": 983,
"maxValue": 156,
"avgValue": 9.73041709053917
},
{
"bucketStartAt": "2022-06-10T13:00:00+00:00",
"eventCount": 966,
"maxValue": 144,
"avgValue": 8.96790890269151
},
{
"bucketStartAt": "2022-06-10T14:00:00+00:00",
"eventCount": 972,
"maxValue": 141,
"avgValue": 9.49485596707819
},
{
"bucketStartAt": "2022-06-10T15:00:00+00:00",
"eventCount": 991,
"maxValue": 164,
"avgValue": 10.0565085771948
},
{
"bucketStartAt": "2022-06-10T16:00:00+00:00",
"eventCount": 682,
"maxValue": 167,
"avgValue": 8.24780058651026
},
{
"bucketStartAt": "2022-06-10T17:00:00+00:00",
"eventCount": 864,
"maxValue": 146,
"avgValue": 9.28240740740741
},
{
"bucketStartAt": "2022-06-10T18:00:00+00:00",
"eventCount": 25,
"maxValue": 123,
"avgValue": 11.84
}
]
}
}
Fetch corrections to the part count by date range:
- Query
- Result
{
partCountCorrections(
where: { effectiveAt: { _gte: "2022-05-25", _lt: "2022-06-01" } }
) {
machine {
machineRef
name
}
effectiveAt
value
}
}
{
"data": {
"partCountCorrections": [
{
"machine": {
"machineRef": 9000,
"name": "Star-1"
},
"effectiveAt": "2022-05-28T09:01:19.000+00:00",
"value": -2
}
]
}
}