github.com/esnet/gdg@v0.6.1-0.20240412190737-6b6eba9c14d8/website/content/docs/gdg/getting_started.md (about) 1 --- 2 title: "Getting Started" 3 weight: 13 4 --- 5 6 ### Setup new configuration 7 8 You can create new context configuration using an interactive setup. 9 ``` 10 $ ./bin/gdg tools ctx new mycontext 11 ``` 12 13 When creating a new context, you will be asked for authorization type, your default datasource and username/password, along with which folders you wish to manage under the context. You have three options: 14 15 1. Default option ("General") 16 2. List of folders you wish to manage 17 3. Wildcard configuration (all folders) 18 19 ### Import / Download Dashboards 20 21 Minimal configuration (eg. the `importer.yml` file) that you need to download your dashboards from your Grafana endpoint: 22 23 ```yaml 24 context_name: all 25 26 contexts: 27 all: 28 url: https://grafana.example.org 29 token: "<<Grafana API Token>>" 30 # user_name: admin 31 # password: admin 32 output_path: exports 33 watched: 34 - Example 35 - Infrastructure 36 37 global: 38 debug: true 39 ignore_ssl_errors: false 40 ``` 41 You need to adjust three parts in the configuration in order to function: 42 - Grafana URL: This is just a URL where your Grafana is available. 43 - API Key OR Username / Passoword for Admin user. See [authentication](configuration.md) section if you need more information. 44 - Downloaded Folders: The `watched` field defines folders which will be considered for manipulation. You can see these folders in your Grafana Web UI, under Dashboards > Management. From there, you can simply define the folders you want to be downloaded in the `watched` list. The dashboards are downloaded as JSON files in the `$OUTPUT_PATH/dashboards/$GRAFANA_FOLDER_NAME` directory. Where `$OUTPUT_PATH` is the path defined in the `dashboard_output` configuration property and `$GRAFANA_FOLDER_NAME` the name of the folder from which the dashboards were downloaded 45 46 After you are done, and you can execute `./bin/gdg dash list` successfully, eg.: 47 ``` 48 $ ./bin/gdg dash list 49 time="2021-08-22T11:11:27+02:00" level=warning msg="Error getting organizations: HTTP error 403: returns {\"message\":\"Permission denied\"}" 50 time="2021-08-22T11:11:28+02:00" level=info msg="Listing dashboards for context: 'all'" 51 ┌────┬───────────────────────────────────┬───────────────────────────────────┬────────────────┬────────────┬────────────────────────────────────────────────────────────────────────────┐ 52 │ ID │ TITLE │ SLUG │ FOLDER │ UID │ URL │ 53 ├────┼───────────────────────────────────┼───────────────────────────────────┼────────────────┼────────────┼────────────────────────────────────────────────────────────────────────────┤ 54 │ 8 │ AWS CloudWatch Logs │ aws-cloudwatch-logs │ Infrastructure │ AWSLogs00 │ https://grafana.example.org/d/AWSLogs00/aws-cloudwatch-logs │ 55 │ 6 │ AWS ECS │ aws-ecs │ Infrastructure │ ly9Y95XWk │ https://grafana.example.org/d/ly9Y95XWk/aws-ecs │ 56 │ 5 │ AWS ELB Application Load Balancer │ aws-elb-application-load-balancer │ Infrastructure │ bt8qGKJZz │ https://grafana.example.org/d/bt8qGKJZz/aws-elb-application-load-balancer │ 57 │ 4 │ AWS RDS │ aws-rds │ Infrastructure │ kCDpC5uWk │ https://grafana.example.org/d/kCDpC5uWk/aws-rds │ 58 │ 3 │ AWS S3 │ aws-s3 │ Infrastructure │ AWSS31iWk │ https://grafana.example.org/d/AWSS31iWk/aws-s3 │ 59 │ 17 │ Cluster Autoscaling │ cluster-autoscaling │ Example │ iHUYtABMk │ https://grafana.example.org/d/iHUYtABMk/cluster-autoscaling │ 60 └────┴───────────────────────────────────┴───────────────────────────────────┴────────────────┴────────────┴────────────────────────────────────────────────────────────────────────────┘ 61 ``` 62 After executing `./bin/gdg dash import` you can find the dashboards of the `Infrastructure` folder in the local directory `dashboards/dashboards/Infrastructure` and the dashboards of the `Example` directory in the local directory `dashboards/dashboards/Example`. 63 64 ### Export / Upload Dashboards 65 66 Minimal configuration (eg. the `importer.yml` file) that you need to upload your dashboards from your Grafana endpoint: 67 ```yaml 68 context_name: all 69 70 contexts: 71 all: 72 url: https://grafana.example.org 73 token: "<<Grafana API Token>>" 74 # user_name: admin 75 # password: admin 76 output_path: exports 77 watched: 78 - Example 79 - Infrastructure 80 81 global: 82 debug: true 83 ignore_ssl_errors: false 84 ``` 85 You need to adjust three parts in the configuration in order to function: 86 - Grafana URL: This is just a URL where your Grafana is available. 87 - API Key OR Username / Passoword for Admin user. See [authentication](configuration.md) section if you need more information. 88 - Uploaded Folders: The `watched` field defines folders which will be considered for manipulation. The dashboards should be stored as JSON files in the `$OUTPUT_PATH/dashboards/$GRAFANA_FOLDER_NAME` directory. Where `$OUTPUT_PATH` is the path defined in the `dashboard_output` configuration property and `$GRAFANA_FOLDER_NAME` the name of the folder to which the dashboards will be uploaded. In case of the above configuration file, the dashboards should be stored locally in the `dashboards/dashboards/Example` and `dashboards/dashboards/Infrastructure/` directories. 89 90 ```sh 91 ├── bin 92 | └── gdg 93 └── exports 94 └── org_main-org 95 | └── dashboards 96 | └─ Example 97 | | └── cluster-scaling.json 98 | └─ Infrastructure 99 | └── aws-ecs.json 100 ``` 101 You can execute `./bin/gdg backup dash export` to upload the local dashboards to your Grafana. Afterwards, you can try running `./bin/gdg dash list` in order to confirm that your dashboards were uploaded successfully.