Hi, I’m using Grafana on my server (RaspberryPI) everything is perfect, and I have a script that sends me a mail with a pdf of my daily stats, it works also, no problem…
But right before sending the correct mail to my address, for unknown reason Grafana sends also an email to postmaster@Grafana that fails and google is sending me the error. I’ve never configured this behavior, I also disabled mail in in my Grafana.ini, so I can’t figure out why is doing it!
In order to trigger the pdf I’m using cron and curl to generate it, and 5 minutes after, my server grabs the pdf and sends me the report/pdf, but when cron is triggered by the right hour, it also sends the weird mail… not when my server sends me the correct mail. It’s like something related to cron and/or curl. But if I use the curl command without cron (normally from command line) it doesn’t send the mail…
And my cron file:
@reboot cd /home/dietpi/prometheus && ./collectd_exporter --collectd.listen-address=":25827"
@reboot /root/go/bin/grafana-reporter -ip 192.168.1.6:3001 -grid-layout
#auto-update every sunday at 5am
#00 5 * * sun sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get autoremove -y && sudo apt-get autoclean -y
#OpenWrt evening report
00 19 * * * curl -J -L 'http://192.168.1.6:8686/api/v5/report/fLi0yXAWk?apitoken=*==&theme=dark&from=now-12h&to=now&var-job=prometheus&var-name=R4S&var-node=192.168.1.2&var-port=9100' --output OpenWRT.pdf
05 19 * * * echo "" | mail -s "Daily OpenWrt stats" firstname.lastname@example.org --attach=OpenWRT.pdf
#OpenWrt morning report
00 07 * * * curl -J -L 'http://192.168.1.6:8686/api/v5/report/fLi0yXAWk?apitoken=*==&theme=dark&from=now-12h&to=now&var-job=prometheus&var-name=R4S&var-node=192.168.1.2&var-port=9100' --output OpenWRT.pdf
05 07 * * * echo "" | mail -s "Daily OpenWrt stats" email@example.com --attach=OpenWRT.pdf
Someone can understand why Grafana is sending this weird mail to postmaster@Grafana when something is triggered via cron? How can I disable it?
Have you configured smtp on defaults.ini?
Yes I configured it but it should be disabled
SMTP / Emailing ##########################
;enabled = false
;host = smtp.gmail.com:587
;user = firstname.lastname@example.org
# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;"""
;password = xxx
;skip_verify = true
;from_address = email@example.com
;from_name = Grafana Alert
# EHLO identity in SMTP dialog (defaults to instance_name)
;ehlo_identity = dashboard.example.com
# SMTP startTLS policy (defaults to 'OpportunisticStartTLS')
;startTLS_policy = NoStartTLS
not sure I understand. It should be disabled?
Yes! I don’t want that Grafana sends this mail weird to Grafana@postmaster. I’ve never configured it, the mail is delivered by ssmtp on my RaspberryPI.
I can’t understand why Grafana sends this email automatically.
oh got it. Are you sure it is not from something else you have configured and forgot about such as alerts?
Stop the cron and see what happens
Hmm, no I’m using only Pushover for the alerts, where else can I have configured it that I forgot? Are there other fields?
If I stop cron it doesn’t (try) to send this weird mail, but the curious thing is that it sends the mail NOT when cron is configured to send the mail to my inbox, but when cron triggers the “curl” command!
But if I call the curl command via shell normally, I mean not using cron, this doesn’t happen, it doesn’t try to send the weird mail to “postmaster@Grafana”. It a very curious thing!
I don’t have the cron log and Grafana log doesn’t report anything wrong.
Do you have an idea of where I can look for this “Grafana@postmaster” unwanted email?
it could be you are not specifying a recipient and the api is providing one by default. And as the doco says it is not yet stabilized. Also you are doing this reporting different than what the doco says Create and manage reports | Grafana documentation
Not sure why you are trying to do it your own way when the reporting api does it for you?
I’m creating the report using GitHub - IzakMarais/reporter: Service that generates a PDF report from a Grafana dashboard because I installed Grafana on my RaspberryPI and I’m running the free version.
But if the cause is the API, why if I call the API not via curl, but using a normal terminal, it doesn’t auto-send the email? This is weird.