Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating dashboards in subfolders #410

Open
BenjaminSchubert opened this issue Dec 9, 2024 · 3 comments · May be fixed by #411
Open

Support creating dashboards in subfolders #410

BenjaminSchubert opened this issue Dec 9, 2024 · 3 comments · May be fixed by #411

Comments

@BenjaminSchubert
Copy link
Contributor

SUMMARY

New in Grafana 11, it is possible to nest folders for dashboards.

While this collection supports creating subfolders, it is not possible today to create a dashboard in a subfolder.

This is due to the grafana_dashboard plugin searching for folder by name in a way that only returns available folders from the root.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

grafana_dashboard

ADDITIONAL INFORMATION

I can see multiple ways of implementing the feature:

  1. By providing a new folder_uid explicitly, mutually exclusive with folder. The uid can be recovered with the grafana_folder plugin.
- name: Import Grafana dashboard zabbix in a subfolder
  community.grafana.grafana_dashboard:
    grafana_url: http://grafana.company.com
    grafana_api_key: "{{ grafana_api_key }}"
    # Allow the user to force the exact folder UID in which to create the project
    folder_uid: <folder_uid>
    dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download
  1. By providing the parent_uid off the folder in which to search, retrievable with the grafana_folder again
- name: Import Grafana dashboard zabbix in a subfolder
  community.grafana.grafana_dashboard:
    grafana_url: http://grafana.company.com
    grafana_api_key: "{{ grafana_api_key }}"
    # Allow the user to use a subfolder
    folder: public
    parent_uid: <public_folder_parent_uid>
    dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download
  1. By interpreting / in the folder names as a subfolder, and searching recursively
- name: Import Grafana dashboard zabbix in a subfolder
  community.grafana.grafana_dashboard:
    grafana_url: http://grafana.company.com
    grafana_api_key: "{{ grafana_api_key }}"
    # Allow the user to use a subfolder
    folder: parent/public
    dashboard_url: https://grafana.com/api/dashboards/6098/revisions/1/download

Options 1 and 2 would be backward compatible
Options 3 would probably be the easiest to use
Options 2 doesn't seem to bring much compared to option 1

I'd be happy to implement, if we agree on what option would be preferable first.

@Nemental
Copy link
Collaborator

Nemental commented Dec 9, 2024

Thank you for the feature request. This one probably overlaps with #388, right? You have described in much more detail, I am considering closing #388 instead.

Unfortunately, I don’t have much time to work on stuff at the moment, but maybe in the new year.

@BenjaminSchubert
Copy link
Contributor Author

Woops, apologies for the duplicate, I had read it before, and forgot -_-'

I might be able to implement the feature in the next week or two, if I can get which of the 3 options would be the most desireable

@Nemental
Copy link
Collaborator

Never mind, every issue/feature request is welcome ;)
In my opinion, solution 2 should be the best, as it is also the most compatible with the API as far as I can tell.

@BenjaminSchubert BenjaminSchubert linked a pull request Dec 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants