-
Notifications
You must be signed in to change notification settings - Fork 16.8k
[stable/grafana] Adding dashboards to specific folders w/ the sidecar? #10183
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions. |
bump I'm trying to find the answer to this too. |
bump, I also would like to know how to do this. |
I did got this mostly working by forking the k8s-sidecar and adding the ability to specify the destination directory for each configmap in annotations. I then left dashboard management up to a wrapper chart that handles dashboard configmap creation and sets the appropriate k8s-sidecar annotations to match the directories expected by the various dashboard provisioner definitions w/ the correct grafana folder. |
@mmiller1 Your patch looks very useful -- IMO, it would be good to get it into upstream |
I created a PR in the upstream project kiwigrid/k8s-sidecar#15 |
So as I understand correcly, using k8s-sidecar >=0.0.12 gives me the option to use an annotation to have the sidecar put the dashboards into different directories. |
Yeah I just played around with this and it looks like the dashboardProviders parameter will need to be broken away from the sidecar creation in order for the k8s-sidecar >=0.0.12 changes to be usable. I also noticed that the k8s-sidecar only has permissions to create files within the directory specified by the |
@jwenz723 I try too, but strangely my dashboard are not put in folder in Grafana, sometime yes, sometime no. On the filesystem everything is correct in the right folder. Not sure how to solve that. |
@shinji62 the problem is that the helm chart doesn't create the proper dashboard providers (about half way down the page. |
@jwenz723 If you have any solution just make a PR :) that's will help I guess many people. |
I created PR #12927 to fix this issue. I am using it now from a hosted chart repo, and its working as expected. |
@richmondwang as someone else mentioned in your PR:
Our team wanted to have multiple dashboard folders managed through the dashboard sidecar, so unfortunately your PR didn't help us out. We were able to get around these issues by:
That said the solution is a bit hacky and sometimes the grafana UI will render the dashboards in different folders (probably because the grafana filesystem provider recurses into each subdirectory to look for dashboard json so there is a race between which provider picks up the dashboard first) |
@grantatspothero |
@richmondwang just tried it out, thanks for your work! |
@grantatspothero could you provide your config? I cannot seem to find enough information on adding additional dashboards to grafana. I deployed grafana with the prometheus operator chart. I'm now wanting to add additional dashboards through values.yaml. I attempted the following with no luck. The prometheus-grafana pod errors with no useful container logs. To summarize I simply want to configure a couple diff dashboards ;) grafana:
sidecar:
dashboards:
defaultFolderName: /var/lib/grafana/dashboards/default
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
prometheus-stats:
gnetId: 2 revision: 2
datasource: Prometheus ceph-cluster:
gnetId: 2842 revision: 2
ceph-osd: gnetId: 5336
ceph-pools:
gnetId: 5342
revision: 2 |
Refer to this above comment: #10183 (comment) If you want to put dashboards in different grafana folders you need to configure multiple dashboard providers in your values file (one provider per grafana folder):
Then you need to specify to the sidecar container that dashboards from specific configmaps should be written to different filesystem directories (which will then place the dashboards in the specified grafana folder as you configured above).
The trick is the annotation, which tells the sidecar to not place the dashboards in the default directory, but instead place them in a custom directory. |
There's something fishy about this, I tried your setup, the dashboard is being placed in "General" folder, and even though the sidecar reports this in logs:
And if I exec inside the pod, I can see that the json file got deployed in the correct folder:
And in
Here's what I see in UI: Any ideas?
|
It's been awhile since I've futzed with this chart but IIRC your two dashboardproviders.yaml files are stepping on each other. The |
I think you are right, the two dashboardprovider definitions are stepping on each other, but creating an entry for General doesn't seem to help, I tried putting it in the top or bottom of the list, also tried to put a "root" definition like below, also didn't help:
The only workaround that actually works is commenting out mounting I wonder, does it even make sense for this chart to mount |
Ah yeah, you are correct, looking back this is what I actually ended up
doing myself.
…On Tue, May 14, 2019 at 9:15 AM Maxim Baz ***@***.***> wrote:
I think you are right, the two dashboardprovider definitions are stepping
on each other, but creating an entry for General doesn't seem to help, I
tried putting it in the top or bottom of the list, also tried to put a
"root" definition like below, also didn't help:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
options:
path: /tmp/dashboards
The only workaround that actually works is commenting out mounting
sc-dashboardproviders.yaml from deployment.yaml entirely, then everything
consistently works.
I wonder, does it even make sense for this chart to mount
sc-dashboardproviders.yaml if custom dashboardProviders are configured?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10183?email_source=notifications&email_token=AGCTIAFZDF66YSDDXCM26SLPVK3ORA5CNFSM4GLS642KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVLN5NQ#issuecomment-492232374>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGCTIAFKFMQFQIQSZCYNZTDPVK3ORANCNFSM4GLS642A>
.
|
@maximbaz Hi, the commit 46e541b was because the checks made the sc-dashboardproviders.yaml removed, so the custom dashboards could not loaded in my case.
But it looks like because I was having a default dashboardProvider:
So this looks like my mistake. I'll fix this. |
Here's the fix: #15550 |
@infa-ddeore My changes were merged to master. I've just checked again and looks like the changes have been removed. Please check git log to see how that was made. |
Yep, we had to rollback to |
Yes there is with version
and then in each configmap you have for each dashboard you need the
|
i meant will this work in the latest helm chart version |
@infa-ddeore the breaking change was in a later PR #15770 so AFAIK dashboard provisioning in multiple folders is still broken as of |
I have been using the prometheus-operator 6.2.1 chart (which itself uses the grafana 3.7.3 chart) with the following grafana configuration values.yaml. It provisions and loads the dashboards which are part of prometheus-operator, as well as downloading dashboards from grafana.net at the same time. This behavior was fixed by PR #15770 (it did not work before the PR was merged).
|
Hey @irasnyd, were you able to get it working using the |
Yes, I have used grafana 3.7.3 (as part of prometheus-operator 6.2.1) successfully using both the
|
For adding the dashboard providers, I was wondering if it would be possible to add them via configmaps and whether that would be doable without having to restart grafana everytime. |
Hello everybody. So I have read through this issue and was still experiencing the issue where dashboards are being placed in their correct folders, but are also placed in the To fix this, in the config for the sidecar container make sure that ...
# Sidecar configuration
sidecar:
image:
repository: kiwigrid/k8s-sidecar
tag: 0.1.151
imagePullPolicy: IfNotPresent
skipTlsVerify: true
dashboards:
enabled: true
# Set SCProvider to false to solve the General folder issue.
SCProvider: false
... |
Same here. With Note that you indeed need to put all dashboards into subdirectories in the docker volume, even the ones that are supposed to be placed in root
|
Got a similar config here, but I keep the grafana:
sidecar:
dashboards:
defaultFolderName: general
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: custom
type: file
folder: Custom
disableDeletion: true
editable: true
options:
path: /tmp/dashboards/custom A tiny bit more concise 😇 |
I suppose that lots of cases will be fixed by allowing to configure multiple dashboards providers via configmap. |
I've opened a PR on k8s-sidecar to allow relative paths in the folder annotation. This allows you to use only the sidecar without any specified |
Is this a request for help?:
yes
Version of Helm and Kubernetes:
helm: 2.12
k8s: 1.10.11
Which chart:
stable/grafana
What happened:
I would like to add dashboards from configmaps to specific folders in grafana (the grafana UI, I don't really care about the file location inside the pod). Is this possible using the sidecars deployed with grafana? looking through the provided values.yaml, I don't see an obvious solution.
The text was updated successfully, but these errors were encountered: