# Alerting with NoData results in DataSourceError

**URL:** <https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987>\
**Category:** Alerting\
**Tags:** influxdb\
**Created:** [September 8, 2022, 4:21am UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987 "2022-09-08T04:21:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![osterjour](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/osterjour/32/25826_2.png) [@osterjour](https://community.grafana.com/u/osterjour)\
**Post date:** [September 8, 2022, 4:21am UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/1 "2022-09-08T04:21:11Z")

</div>

I’m having issues that seem to have started with an update of Grafana (I’m running v9.1.2 now).  
I have multiple alerts which are expected to see NoData coming from InfluxDB as a datasource.  
This is an example of such an alert:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/4/1/419d2f39aaca1f65794bab35784853f07413d123.png)

When I’m running those queries I get:

```auto
failed to execute conditions: can only reduce type series, got type noData

```

As said: I’m expecting to get a noData but for some reason Grafana doesn’t treat this as a noData alert anymore (it did work perfectly in older versions!) but tries to transform the noData inside of die Classic condition which fails and results in a DataSourceError which obviously isn’t the result I’m expecting.  
I first thought this would be due to the use of classic condition but when I try to use “Reduce” and “Math” to get the same effect I get the exact same issue.

Does somebody know if this is a but that was introduced in one of the last versions or how to circumvent this behavior?

---

<div class="post-metadata">

**Author:** ![osterjour](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/osterjour/32/25826_2.png) [@osterjour](https://community.grafana.com/u/osterjour)\
**Post date:** [September 27, 2022, 4:07pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/2 "2022-09-27T16:07:50Z")

</div>

I’m still trying to figure out why this doesn’t work anymore.  
It seems like with a change somewhere between 9.0 and 9.1.3 alerting on time series data that might be not existing is impossible.  
I can’t use “Reduce” or “Classic Condition” as this might result in an error when I have no data but I also can’t use “Math” directly as the result from InfluxDB is a time series when data is available which also results in an error. So can please someone from the developers at Grafana tell me if this a bug or if I’m missing something here?

---

<div class="post-metadata">

**Author:** ![hernanj2](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hernanj2](https://community.grafana.com/u/hernanj2)\
**Post date:** [January 24, 2023, 1:07pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/3 "2023-01-24T13:07:17Z")

</div>

I’m also running grafana 9.3.2 with influxdb 1.8.10 and am also seeing this DataSourceError emails. I was just trying to initially set my environment up and add alerts for AIX and RHEL servers and these email alerts started coming out of the system. I’m not sure what is causing this either.

---

<div class="post-metadata">

**Author:** ![ldrascic](https://avatars.discourse-cdn.com/v4/letter/l/aca169/32.png) [@ldrascic](https://community.grafana.com/u/ldrascic)\
**Post date:** [January 24, 2023, 7:23pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/4 "2023-01-24T19:23:18Z")

</div>

> [@hernanj2](#):
>
> seeing this DataSourceError emails

Hi @hernanj2,  
Data source error indicates that Grafana can’t connect to the data source (e.g. database is down, no permission to read…). Can you query the database from grafana (e.g create a panel)?

If not:  
Test connection to data source from grafana:

```auto
Configuration -> Datasources -> <datasource name> -> Re-enter URL/username/password and click Save & Test

```

Check that user have read permission on databases:

```auto
influx auth list
influx dbrp list

```

Best regards,  
ldrascic

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [January 24, 2023, 7:52pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/5 "2023-01-24T19:52:35Z")

</div>

I think there is some sort of regression bug?

---

<div class="post-metadata">

**Author:** ![georgerobinson](https://avatars.discourse-cdn.com/v4/letter/g/ad7895/32.png) [@georgerobinson](https://community.grafana.com/u/georgerobinson)\
**Post date:** [January 25, 2023, 8:46pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/6 "2023-01-25T20:46:54Z")

</div>

Hi! You are on quite an old version of Grafana. We have fixed a number of bugs around NoData since then. Could you upgrade to the latest version of Grafana 9.3 and see if the issue is still present?

---

<div class="post-metadata">

**Author:** ![hernanj2](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hernanj2](https://community.grafana.com/u/hernanj2)\
**Post date:** [January 31, 2023, 1:45pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/7 "2023-01-31T13:45:28Z")

</div>

I just updated from Grafana v9.3.2 to v9.3.6. At 1:01am I received an alert where at the bottom it shows Sent by Grafana v9.3.6 and then at 1:35am I received another alert that says it was sent from Grafana v9.3.2. That’s the previous version of Grafana.

---

<div class="post-metadata">

**Author:** ![hernanj2](https://avatars.discourse-cdn.com/v4/letter/h/ea5d25/32.png) [@hernanj2](https://community.grafana.com/u/hernanj2)\
**Post date:** [January 31, 2023, 1:52pm UTC](https://community.grafana.com/t/alerting-with-nodata-results-in-datasourceerror/71987/8 "2023-01-31T13:52:29Z")

</div>

When I run influx auth list this is what I get:

[root@trhatsys01 ~]# influx auth list  
unknown arguments: auth list  
Usage of influx:  
-version  
Display the version and exit.  
-path-prefix ‘url path’  
Path that follows the host and port  
-host ‘host name’  
Host to connect to.  
-port ‘port #’  
Port to connect to.  
-socket ‘unix domain socket’  
Unix socket to connect to.  
-database ‘database name’  
Database to connect to the server.  
-password ‘password’  
Password to connect to the server. Leaving blank will prompt for password (–password ‘’).  
-username ‘username’  
Username to connect to the server.  
-ssl  
Use https for requests.  
-unsafeSsl  
Set this when connecting to the cluster using https and not use SSL verification.  
-execute ‘command’  
Execute command and quit.  
-type ‘influxql|flux’  
Type specifies the query language for executing commands or when invoking the REPL.  
-format ‘json|csv|column’  
Format specifies the format of the server responses: json, csv, or column.  
-precision ‘rfc3339|h|m|s|ms|u|ns’  
Precision specifies the format of the timestamp: rfc3339, h, m, s, ms, u or ns.  
-consistency ‘any|one|quorum|all’  
Set write consistency level: any, one, quorum, or all  
-pretty  
Turns on pretty print for the json format.  
-import  
Import a previous database export from file  
-pps  
How many points per second the import will allow. By default it is zero and will not throttle importing.  
-path  
Path to file to import  
-compressed  
Set to true if the import file is compressed

Examples:

```
# Use influx in a non-interactive mode to query the database "metrics" and pretty print json:
$ influx -database 'metrics' -execute 'select * from cpu' -format 'json' -pretty

# Connect to a specific database on startup and set database context:
$ influx -database 'metrics' -host 'localhost' -port '8086'

```

I’m running influx 1.8.10. Should I be running influxdb v2?
