{"id":13522164,"url":"https://github.com/slok/grafterm","last_synced_at":"2026-01-12T02:38:36.187Z","repository":{"id":36401697,"uuid":"179440789","full_name":"slok/grafterm","owner":"slok","description":"Metrics dashboards on terminal (a grafana inspired terminal version)","archived":false,"fork":false,"pushed_at":"2022-06-10T00:17:48.000Z","size":9228,"stargazers_count":1044,"open_issues_count":11,"forks_count":29,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-04T01:07:48.833Z","etag":null,"topics":["dashboard","grafana","graphs","metrics","observability","prometheus","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","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/slok.png","metadata":{"files":{"readme":"Readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-04-04T07:03:35.000Z","updated_at":"2025-03-31T19:22:30.000Z","dependencies_parsed_at":"2022-07-16T05:30:28.721Z","dependency_job_id":null,"html_url":"https://github.com/slok/grafterm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgrafterm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgrafterm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgrafterm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slok%2Fgrafterm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slok","download_url":"https://codeload.github.com/slok/grafterm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248634228,"owners_count":21137007,"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":["dashboard","grafana","graphs","metrics","observability","prometheus","terminal"],"created_at":"2024-08-01T06:00:43.240Z","updated_at":"2026-01-12T02:38:36.181Z","avatar_url":"https://github.com/slok.png","language":"Go","funding_links":[],"categories":["8. Visualization","开源类库","Go","Table of Contents","terminal","\u003ca name=\"monitor\"\u003e\u003c/a\u003eSystem monitoring"],"sub_categories":["Dashboarding","监控告警"],"readme":"# Grafterm [![CircleCI][circleci-image]][circleci-url] [![Go Report Card][go-reportcard-image]][go-reportcard-url]\n\nVisualize metrics dashboards on the terminal, like a simplified and minimalist version of [Grafana] for terminal.\n\n![grafterm red dashboard](/img/grafterm-red-compressed.gif)\n\n## Features\n\n- Multiple widgets (graph, singlestat, gauge).\n- Multiple datasources usage.\n- User stored datasources.\n- Override dashboard datasource ID to different datasource ID configured by the user.\n- Custom dashboards based on JSON configuration files.\n- Extensible metrics datasource implementation (Prometheus and Graphite included).\n- Templating of variables.\n- Auto time interval adjustment for queries.\n- Auto unit formatting on widgets.\n- Fixed and adaptive grid.\n- Color customization on widgets.\n- Configurable autorefresh.\n- Single binary and easy usage/deployment.\n\n## Installation\n\nDownload the binaries from [releases]\n\n## Running options\n\nExit with `q` or `Esc`\n\n### Simple\n\n```bash\ngrafterm -c ./mydashboard.json\n```\n\n### Relative time\n\n```bash\ngrafterm -c ./mydashboard.json -d 48h\n```\n\n### Refresh interval\n\n```bash\ngrafterm -c ./mydashboard.json -r 2s\n```\n\n### Debugging\n\nWhen grafterm doesn't show anything may be that has errors getting metrics or similar. There is available a `--debug` flag that will write a log on `grafterm.log` (this path can be override with `--log-path` flag)\n\nRead the log\n\n```bash\ntail -f ./grafterm.log\n```\n\nAnd run grafterm in debug mode.\n\n```bash\ngrafterm -c ./mydashboard.json  -d 48h -r 2s --debug\n```\n\n### Fixed time\n\nSetting a fixed time range to visualize the metrics using duration notation. In this example is start at `now-22h` and end at `now-20h`\n\n```bash\ngrafterm -c ./mydashboard.json -s 22h -e 20h\n```\n\nSetting a fixed time range to visualize the metrics using timestamp [ISO 8601] notation.\n\n```bash\ngrafterm -c ./mydashboard.json -s 2019-05-12T12:32:11+02:00 -e 2019-05-12T12:35:11+02:00\n```\n\n### Replacing dashboard variables\n\n```bash\ngrafterm -c ./mydashboard.json -v env=prod -v job=envoy\n```\n\n### Replacing dashboard datasource configuration\n\nReplace dashbaord `prometheus` datasource with user datasource `thanos-prometheus` (check [Datasources](#datasources) section):\n\n```bash\ngrafterm -c ./mydashboard.json -a \"prometheus=thanos-prometheus\"\n```\n\nReplace dashboard `prometheus` datasource with user datasource `thanos-prometheus` available on `/tmp/my-datasources.json` user datasource configuration file:\n\n```bash\ngrafterm -c ./mydashboard.json -a \"prometheus=thanos-prometheus\" -u /tmp/my-datasources.json\n```\n\n## Dashboard\n\nCheck [this][cfg-md] section that explains how a dashboard is configured. Also check [dashboard examples][dashboard-examples]\n\n## Datasources\n\nDatasources are the way grafterm knows how to retrieve the metrics for the dashboard.\n\ncheck available types and how to configure in [this][cfg-md] section.\n\n**If you want support for a new datasource type, open an issue or send a PR**\n\n### Overriding dashboard datasources\n\nDashboard referenced datasources on the queries can be override.\n\n#### User datasource\n\nGrafterm dashboards can have default datasources but the user can override these datasources using a datasources config file. This file has the same format as the dashboard configuration file but will ignore anything other than the `datasources` block. Example:\n\n```json\n{\n  \"version\": \"v1\",\n  \"datasources\": {\n    \"prometheus\": {\n      \"prometheus\": { \"address\": \"http://127.0.0.1:9090\" }\n    },\n    \"localprom\": {\n      \"prometheus\": { \"address\": \"http://127.0.0.1:9091\" }\n    },\n    \"thanos\": {\n      \"prometheus\": { \"address\": \"http://127.0.0.1:9092\" }\n    },\n    \"m3db\": {\n      \"prometheus\": { \"address\": \"http://127.0.0.1:9093\" }\n    },\n    \"victoriametrics\": {\n      \"prometheus\": { \"address\": \"http://127.0.0.1:8428\" }\n    },\n    \"wikimedia\": {\n      \"graphite\": { \"address\": \"https://graphite.wikimedia.org\" }\n    }\n  }\n}\n```\n\nIf the dashboard has defined a datasource configuration with the ID `my-ds` reference, and the user datasources has this same datasource ID, grafterm will use the user defined one when the queries in the dashboard reference this ID.\n\nThe user datasources location can be configured with this priority (from highest to lowest):\n\n- If `--user-datasources` explicit flag is used, it will use this.\n- If `GRAFTERM_USER_DATASOURCES` env var is set, it will use this.\n- As a fallback location will check `{USER_HOME}/grafterm/datasources.json` exists.\n\n#### Alias\n\nApart from overriding the dashboard datasources IDs that match with the user datasources, the user can force an alias with the form `dashboard-ds-id=user-ds-id`.\n\nFor example, the dashboard uses a datasource named `prometheus-2b`, and we want to use our local prometheus configured on the user datasources as `localprom`, we could use the alias flag like this: `-a \"prometheus-2b=localprom\"`, now every query the dashboard widgets make to `prometheus-2b` will be made to `localprom`.\n\n## Kudos\n\nThis project would not be possible without the effort of many people and projects but specially [Grafana] for the inspiration, ideas and the project itself, and [Termdash] for the rendering of all those fancy graphs on the terminal.\n\n[circleci-image]: https://img.shields.io/circleci/project/github/slok/grafterm/master.svg\n[circleci-url]: https://circleci.com/gh/slok/grafterm\n[go-reportcard-image]: https://goreportcard.com/badge/github.com/slok/grafterm\n[go-reportcard-url]: https://goreportcard.com/report/github.com/slok/grafterm\n[grafana]: https://grafana.com/\n[termdash]: https://github.com/mum4k/termdash\n[releases]: https://github.com/slok/grafterm/releases\n[cfg-md]: /docs/cfg.md\n[dashboard-examples]: /dashboard-examples\n[iso 8601]: https://en.wikipedia.org/wiki/ISO_8601\n[prometheus]: http://prometheus.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslok%2Fgrafterm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslok%2Fgrafterm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslok%2Fgrafterm/lists"}