{"id":20390051,"url":"https://github.com/martinrusev/grafana-operator","last_synced_at":"2025-03-05T00:10:56.799Z","repository":{"id":53521079,"uuid":"349178737","full_name":"martinrusev/grafana-operator","owner":"martinrusev","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-05T20:26:27.000Z","size":103,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-15T10:06:41.388Z","etag":null,"topics":["charm","juju"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinrusev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-18T18:28:46.000Z","updated_at":"2021-05-05T20:26:29.000Z","dependencies_parsed_at":"2022-09-11T08:02:29.593Z","dependency_job_id":null,"html_url":"https://github.com/martinrusev/grafana-operator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fgrafana-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fgrafana-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fgrafana-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinrusev%2Fgrafana-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinrusev","download_url":"https://codeload.github.com/martinrusev/grafana-operator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241940580,"owners_count":20045883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["charm","juju"],"created_at":"2024-11-15T03:21:57.452Z","updated_at":"2025-03-05T00:10:56.755Z","avatar_url":"https://github.com/martinrusev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grafana-operator\n\n## Description\n\nThis is the Grafana charm for Kubernetes using the Python Operator Framework.\n\n## Usage\n\n\n### Deploying\n\n```\n$ git clone https://github.com/martinrusev/grafana-operator\n$ cd grafana-operator\n\n$ sudo snap install charmcraft --beta\n$ charmcraft build\nCreated 'grafana.charm'.\n\n\n$ juju deploy ./grafana.charm --resource grafana-image=grafana/grafana:7.4.5\n\n$ juju status                                                                                                                                                                                    canonical-grafana-charm\nModel    Controller  Cloud/Region        Version  SLA          Timestamp\ngrafana  pebble      microk8s/localhost  2.9-rc7  unsupported  16:36:06+01:00\n\nApp      Version  Status  Scale  Charm    Store  Channel  Rev  OS      Address  Message\ngrafana           active      1  grafana  local             9  ubuntu           grafana started\n\nUnit        Workload  Agent  Address       Ports  Message\ngrafana/0*  active    idle   10.1.243.208         grafana started\n```\n\nVisit that IP address at port 3000 in your browser and you should see the Grafana web UI. For example, http://10.1.243.208:3000/\n\n### Adding a data source\n\nAdding Prometheus as a data source:\n\n```\n$ juju deploy cs:~charmcraft/prometheus-3\n$ juju relate grafana prometheus\n\n\n# The juju model in which grafana is installed corresponds to the k8s namespace\n$ kubectl get pods -n grafana\n\nNAME                           READY   STATUS    RESTARTS   AGE\nmodeloperator-89dd64b8-58sbh   1/1     Running   4          2d4h\nprometheus-operator-0          1/1     Running   2          7h31m\nprometheus-0                   1/1     Running   2          7h31m\ngrafana-0                      2/2     Running   0          21m\n\n\n$ kubectl exec -n grafana grafana-0 -c grafana -- cat /etc/grafana/provisioning/datasources/datasources.yaml\n\napiVersion: 1\ndatasources:\n- access: proxy\n  isDefault: 'true'\n  name: prometheus_36\n  orgId: '1'\n  type: prometheus\n  url: http://10.152.183.88:9090\ndeleteDatasources: []\n```\n\n### Importing dashboards\n\n\n```\njuju run-action --wait grafana/0 import-dashboard dashboard=\"$(base64 mydashboard.json)\"\n```\n\n## Debugging\n\nTo check the logs generated by Grafana\n\n```\n# The juju model in which grafana is installed corresponds to the k8s namespace\n$ kubectl get pods -n grafana\n\nNAME                           READY   STATUS    RESTARTS   AGE\nmodeloperator-89dd64b8-58sbh   1/1     Running   4          2d4h\nprometheus-operator-0          1/1     Running   2          7h31m\nprometheus-0                   1/1     Running   2          7h31m\ngrafana-0                      2/2     Running   0          21m\n\n$ kubectl exec -n grafana grafana-0 -c grafana -- cat /var/log/grafana/grafana.log\n```\n\n## Developing\n\nCreate and activate a virtualenv with the development requirements:\n\n```\nvirtualenv -p python3 venv\nsource venv/bin/activate\npip install -r requirements-dev.txt\n```\n\nTo update the ingress library:\n\n```\ncharmcraft fetch-lib charms.ingress.v0.ingress\n```\n\n## Testing\n\nThe Python operator framework includes a very nice harness for testing\noperator behaviour without full deployment. Just `run_tests`:\n\n```\n./run_tests\n```\n\n## Roadmap\n\nThe Grafana Charm is still a work in progress.\n\nHere are some of the things coming soon:\n\n  - [ ] Import a Custom config file\n  - [x] Ingress Support\n  - [x] MySQL relation\n  - [x] Prometheus Datasource\n  - [x] Dashboard import action\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrusev%2Fgrafana-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinrusev%2Fgrafana-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinrusev%2Fgrafana-operator/lists"}