I use grafana to show the device status in last 5 min.
If the device not send data to influxdb, I assume that device is offline.
Query select last(value) from heartbeat where SN='****' and time > now() - 5m
I created a Singlestat with value text map
0 -> Ready
1 -> Processing
null -> offline
Use the Thresholds I am able to set the color for 0 and 1.
However, is not able to set the color for null value.
Is someone know how to set the color for null value(no result in influxdb query)?
Null is not a valid field value and is unsupported. There are only 4 field types supported, int64, float64, bool and string.
Not possible. You can use Singlestat panels in particular they are useful as they treat null as zero, otherwise there's no way to color a panel with a null result. Doc
Also check the docs for valid syntax for each of those field types.
Grafana doesn't support null mapping at the moment, there's an issue for that.
Related
I am doing a simple pivot that sums a column and I need the sum(nulls) to be a null (in Google Sheets). However, I see the pivot table has zero as the value.
In the attached picture case, I expect the group 1s sum to be null, however, pivot returns 0.
Are there any workarounds? Highly appreciate any help here.
Unfortunately, the default return value / expected behavior when using the SUM() function in adding blank cells will always be 0. Based from the post Comparing blank cell with a cell containing '0' is equating to TRUE all of a sudden, 0 and null are both NOT TRUE, thus, they are the same.
Workaround Solution: Add a Calculated Field to the Values Section
You may use the following formula for the Calculated Field formula:
=if(sum(B),sum(B),"NULL")
However, this is only a workaround and will display a string NULL and not the actual null value whenever the sum is zero. The downside to this is that it will not display the value 0 even if the cells have actual values and it just happens to have a sum of 0.
Output
I'm trying to set an alert in Grafana as soon as the value is outside the range 16 to 36. I'm using influxDB
I have a simple query (A):
SELECT "value" FROM "temp"
The graph is shown correctly.
My alert config looks like this:
WHEN last() OF query(A, 1s, now) IS OUTSIDE RANGE 16 TO 36
But if I evaluate the Test Rule, I always get the state no_data. What am I doing wrong?
Well.. 3 years later.. =)
I had this same problem. To fix this, go to your Influx server and type:
use <databasename>
show field keys
The command "show field keys" will return something like this:
name: table_name
fieldKey fieldType
-------- ---------
value string
The problem is the column fieldType need to be float and not string. In my case, I dropped the database and created it again. And I inserted as decimal.
I'm want to display a KPI in a singlestat panel, based on the following query:
select count(foo) from bar where field = 'value' and time > now() - 1m
Sometimes there are no results (and that's valid), but the singlestat panel shows N/A instead of 0
What can/should I do?
You can try to map null to 0 under "Value mappings"
(You dont have to use range to text)
I have a data logging program that creates rows of data every 10 minutes. This is displayed in a chart.
The first column is a timestamp, with date and time. I want to only display the last 24 hours of data in my chart, so thought that a filter view would do the trick. I selected the column and chose "Filter by condition" and "Greater than or equal to", with "Now() -1" as the value. I tried various other combinations but nothing seems to work. Any ideas?
Your approach is correct: use the filter view
Filter by condition -> Greater than or equal to -> =now()-1
A common mistake is to omit =, possibly this is the reason it didn't work for you.
A similar-sounding "date is after" condition would not be appropriate here, as it ignores the time part of the date.
I have an Rdlc report
In this report I have a field which takes its values by this expression
(Round(((First(Fields!Occurs.Value) / First(Fields!TotalDistance.Value))* 10000),2)
but in some cases (TotalDistance.Value) = 0 so the previous expression returns Infinity,
So I need to get the next record in case of that field equals 0 ,
If also next field equals 0 , I want to get the next one
I looked for way of getting next record but didn't find
I only found (First , Last) methods,
How can I do that ?
instead of using First or Last if you don't care which record as long as it isn't 0 then couldn't you use an aggregate function. ex:
(Round(((First(Fields!Occurs.Value) / MAX(Fields!TotalDistance.Value))* 10000),2)
you could use Max, Min or Avg to get a value. I am unaware of any way within the rdlc to loop through the records like you are asking.
Another completely different way could be to load the data into a datatable then add a column to contain the calculated value and use some code to calculate the values before being passed to the report.