Open Marcellii opened 7 years ago
Hi @Marcellii. thanks for the bugreport. we should ensure that grafana is actually reachable before the custom types and providers are started. The service may not be reachable if a refresh got triggered.
Something like the elastic search connection validator might work although it's a bit of a heavy stick: https://forge.puppet.com/elastic/elasticsearch#connection-validator
Shame puppet doesn't have a generic connection validator, would be useful.
OK this is a workaround:
class { "::grafana":
...
} ->
exec {"grafana-postdelay":
command => "/usr/bin/wget --spider --tries 30 --waitretry=30 --retry-connrefused --no-check-certificate http://localhost:${webport}/public/img/grafana_icon.svg",
} ->
grafana_datasource { 'influxdb':
...
}
@fadenb do you want to check if https://forge.puppet.com/puppet/healthcheck would be suitable?
@bastelfreak Oh thanks, that works great!
http_conn_validator { 'grafana-postdelay' :
host => '127.0.0.1',
port => $webport,
use_ssl => false,
test_url => '/public/img/grafana_icon.svg',
} ->
cool cool. Would you mind to document this in our README.md as an example?
I should mention that with grafana 5.x we can now use provisioning instead of the API for both dashboards and datasources. This does not suffer from this problem, as you can always write the files to the filesystem even if grafana isn't running yet.
http://docs.grafana.org/administration/provisioning/
In fact I had to switch from dashboard types to provisioning as I had all kinds of problems using the API (dashboards titles not being found despite them being installed, resulting in errors, dashboards being continuously deployed as they are not immutable...). Switching to provisioning solved all my problems.
May we should update the documentation for that too?
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
What behaviour did you expect instead
I expected to be working
Any additional information you'd like to impart