{"id":21130810,"url":"https://github.com/sz9751210/tick_stack-tutorial","last_synced_at":"2026-05-10T15:38:06.369Z","repository":{"id":149604190,"uuid":"424822020","full_name":"sz9751210/TICK_Stack-tutorial","owner":"sz9751210","description":"使用docker-compose建立起tick-stack的架構","archived":false,"fork":false,"pushed_at":"2023-01-20T09:13:07.000Z","size":1723,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T06:11:34.782Z","etag":null,"topics":["chronograf","docker","docker-compose","influxdb","kapacitor","telegraf"],"latest_commit_sha":null,"homepage":"https://sz9751210.github.io/posts/tick-stack-tutorial/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sz9751210.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-05T03:58:49.000Z","updated_at":"2023-01-23T11:50:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"db629e15-a314-4880-bac4-29931b861312","html_url":"https://github.com/sz9751210/TICK_Stack-tutorial","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/sz9751210%2FTICK_Stack-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sz9751210%2FTICK_Stack-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sz9751210%2FTICK_Stack-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sz9751210%2FTICK_Stack-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sz9751210","download_url":"https://codeload.github.com/sz9751210/TICK_Stack-tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243573495,"owners_count":20312883,"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":["chronograf","docker","docker-compose","influxdb","kapacitor","telegraf"],"created_at":"2024-11-20T05:39:13.861Z","updated_at":"2026-05-10T15:38:01.324Z","avatar_url":"https://github.com/sz9751210.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TICK-stack\n\n## 👨‍💻簡介\n🔰ELFK-stack：使用docker-compose建立起tick-stack的架構，撈取的指標從config/telegraf.conf設定，並送往influxdb從起來，chronograf為ui介面，查看撈取的時間序列指標狀態，最後kapacitor則是處理告警的部分．\n\n## 流程\n- ⚙️TICK-stack : telrgraf(送資料) -\u003e influxdb(存資料) -\u003e chronograf(ui) -\u003e kapacitor(alert)\n\n## 環境建置\n### telegraf設定\n使用telegraf.conf設定輸出資料庫\n```conf\n[[outputs.influxdb]]\n  urls = [\"http://influxdb:8086\"]\n  database = \"telegraf\" # 要使用的資料庫\n  username = \"admin\"\n  password = \"admin\" \n  ```\n### influxdb設定\n使用configuration.env設定帳密以及資料庫\n```conf\n# InfluxDB options\nINFLUXDB_DB=telegraf\nINFLUXDB_ADMIN_USER=admin\nINFLUXDB_ADMIN_PASSWORD=admin\n```\n### kapacitor設定\n使用kapacitor.conf\n* 設定讀取的資料庫\n```conf\n[[influxdb]]\n  enabled = true\n  name = \"telegraf\"\n  default = false\n  urls = [\"http://influxdb:8086\"]\n  username = \"admin\"\n  password = \"admin\"\n```\n* 設定告警telegram\n```conf\n[telegram]\n  enabled = true\n  url = \"https://api.telegram.org/bot\"\n  token = \"bot-token\"\n```\n### 啟動環境\n```shell\ndocker-compose up\n```\n接著去本地chronograf `http://IP:8888`\n設定influxdb以及kapacitor\n* http:// IP :8086 for influxdb\n* http:// IP :9092 for kapacitor\n![Alt text](./img/setup_influx.png)\n![Alt text](./img/setup_kapacitor.png)\n\n## 告警設計\n參考cpu_alert.tick.example\n## 使用告警\n### 透過kapacitor\n```shell\ncd /var/lib/kapacitor\n# cpu_alert為任務task_id\n# 定義任務\nkapacitor define cpu_alert -tick cpu_alert.tick -type stream -dbrp telegraf.autogen\n# 啟動任務\nkapacitor enable cpu_alert\n# 停止任務\nkapacitor disable cpu_alert\n# 刪除任務\nkapacitor delete tasks cpu_alert\n# 列出所有任務\nkapacitor list tasks\n```\n### 透過chronograf\n\n選到左邊的alerting -\u003e write TICKscript\n![Alt text](./img/alert.png)\n輸入task_id -\u003e 把script貼上 -\u003e 選擇類型為stream -\u003e 選擇db -\u003e 按下儲存後下方會判斷script是否正常\n![Alt text](./img/script.png)\n完成後可回到manage task管理當前task 可透過點擊enabled下方圓點一鍵啟動/停用任務\n![Alt text](./img/manage_task.png)\nalert history可查看告警訊息\n* green:OK \n* white:INFO,WARN \n* red:CRIT\n![Alt text](./img/alert_history.png)\n\n============================\n\n### 查看alert寫回db訊息\n![Alt text](./img/chronograf.png)\n\n### 參考資料\n* https://github.com/sz9751210/docker-telegraf-influx-grafana-stack\n* https://www.influxdata.com/time-series-platform/kapacitor/\n* https://tanjiti.github.io/2018/12/18/%E5%BC%80%E6%BA%90kapacitor%E6%93%8D%E4%BD%9C%E6%89%8B%E5%86%8C/\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsz9751210%2Ftick_stack-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsz9751210%2Ftick_stack-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsz9751210%2Ftick_stack-tutorial/lists"}