{"id":20566232,"url":"https://github.com/telkomdev/tob","last_synced_at":"2025-04-14T15:40:42.494Z","repository":{"id":65821371,"uuid":"600008394","full_name":"telkomdev/tob","owner":"telkomdev","description":"A Monitoring Bot","archived":false,"fork":false,"pushed_at":"2024-11-03T04:56:45.000Z","size":959,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T04:34:51.526Z","etag":null,"topics":["bot","discord","golang","monitoring","monitoring-tool","notifications","slack","smtp","telegram","webhook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/telkomdev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-10T11:27:57.000Z","updated_at":"2024-11-03T04:56:48.000Z","dependencies_parsed_at":"2024-06-21T17:31:16.047Z","dependency_job_id":"400cc48b-6cc4-41c1-b730-2ccd5f7508e9","html_url":"https://github.com/telkomdev/tob","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2Ftob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2Ftob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2Ftob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telkomdev%2Ftob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telkomdev","download_url":"https://codeload.github.com/telkomdev/tob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248907829,"owners_count":21181408,"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":["bot","discord","golang","monitoring","monitoring-tool","notifications","slack","smtp","telegram","webhook"],"created_at":"2024-11-16T04:40:41.162Z","updated_at":"2025-04-14T15:40:42.473Z","avatar_url":"https://github.com/telkomdev.png","language":"Go","readme":"\u003cdiv align=\"center\"\u003e\n\n[\u003cimg src=\"./assets/tob.PNG\" width=\"100\"\u003e](https://github.com/telkomdev/tob)\n\u003ch3\u003eTob =\u003e Bot\u003c/h3\u003e\nA Notification Bot written in Go\n\u003c/div\u003e\n\n### Architecture\n\n[\u003cimg src=\"./assets/tob_arch.PNG\" width=\"600\"\u003e](https://github.com/telkomdev/tob)\n\n### Screenshot\n\u003ch4\u003eDiscord\u003c/h5\u003e\n\n[\u003cimg src=\"./assets/discord_n.PNG\" width=\"400\"\u003e](https://github.com/telkomdev/tob)\n\n\u003ch4\u003eEmail\u003c/h5\u003e\n\n[\u003cimg src=\"./assets/email_n.PNG\" width=\"400\"\u003e](https://github.com/telkomdev/tob)\n\n\u003ch4\u003eSlack\u003c/h5\u003e\n\n[\u003cimg src=\"./assets/slack_n.PNG\" width=\"400\"\u003e](https://github.com/telkomdev/tob)\n\n\u003ch4\u003eTelegram\u003c/h5\u003e\n\n[\u003cimg src=\"./assets/telegram_n.PNG\" width=\"400\"\u003e](https://github.com/telkomdev/tob)\n\n## Getting Started\n\n### Install from the latest release (https://github.com/telkomdev/tob/releases)\nchoose the binary from the release according to your platform, for example for the Linux platform\n\n#### Download binary\n\n```shell\n$  wget https://github.com/telkomdev/tob/releases/download/2.0.5/tob-2.0.5.linux-amd64.tar.gz\n```\n\n#### Important !!!, always check the SHA256 Checksum before using it\n\nDownload `sha256sum.txt` according to the binary version you downloaded https://github.com/telkomdev/tob/releases/download/2.0.5/sha256sums.txt\n\n```shell\n$ wget https://github.com/telkomdev/tob/releases/download/2.0.5/sha256sums.txt\n```\n\n#### Verify SHA256 Checksum\n\nLinux\n\n```shell\n$ sha256sum tob-2.0.5.linux-amd64.tar.gz -c sha256sums.txt\ntob-2.0.5.linux-amd64.tar.gz: OK\n```\n\nMac OSX\n\n```shell\n$ shasum -a 256 tob-2.0.5.darwin-amd64.tar.gz -c sha256sums.txt\ntob-2.0.5.darwin-amd64.tar.gz: OK\n```\n\nYou should be able to see that the checksum value for the file is valid, `tob-2.0.5.linux-amd64.tar.gz: OK` and `tob-2.0.5.darwin-amd64.tar.gz: OK`. \nIndicates the file is not damaged, not modified and safe to use.\n\n#### Extract\n\n```shell\n$ tar -xvzf tob-2.0.5.linux-amd64.tar.gz\n```\n\n#### Run\n\n```shell\n$ ./tob -c config.json\n```\n\n### Build from source\n\nRequirements\n- Go version 1.16 or higher\n\nClone tob to your Machine\n```shell\n$ git clone https://github.com/telkomdev/tob.git\n$ cd tob/\n```\n\n```shell\n$ make build\n```\n\n`tob` options\n```shell\n$ ./tob -h\n```\n\nRunning `tob` with config file\n```shell\n$ ./tob -c config.json\n```\n\n### Service and Kind\ncurrently tob supports below `KIND` of services\n- **airflow**\n- **airflowflower**\n- **elasticsearch**\n- **kafka**\n- **mongodb**\n- **mysql**\n- **oracle**\n- **postgresql**\n- **redis**\n- **web**\n- **diskstatus**\n\n`KIND` represents one or many services. So you can monitor more than one service with the same `KIND`. For example, you can monitor multiple PostgreSQL instances. Or you can monitor multiple web applications.\n\n`checkInterval: in Seconds` is how often your service is called by tob.\n\n`enable` you set `true` when you want to monitor the service. Set it to `false`, if you don't want to monitor it.\n\n`config.json`\n\n```json\n\"postgresql_one\": {\n    \"kind\": \"postgresql\",\n    \"url\": \"postgres://demo:12345@localhost:5432/demo?sslmode=disable\",\n    \"checkInterval\": 10,\n    \"enable\": false\n},\n\n\"postgresql_two\": {\n    \"kind\": \"postgresql\",\n    \"url\": \"postgres://demo:12345@localhost:5433/demo?sslmode=disable\",\n    \"checkInterval\": 10,\n    \"enable\": false\n},\n\n\"web_internal\": {\n    \"kind\": \"web\",\n    \"url\": \"https://portal.mycompany.com/health-check\",\n    \"checkInterval\": 5,\n    \"enable\": true\n},\n\n\"web_main_1\": {\n    \"kind\": \"web\",\n    \"url\": \"https://mycompany.com/health-check\",\n    \"checkInterval\": 5,\n    \"enable\": true\n}\n```\n\n### Disk Status Monitoring\n\nTo monitor `Disk Status` on a Server Computer, `tob` requires a special `agent` that can be called by `tob`. \nSo we need to deploy an `agent`, in this case `tob-http-agent` to the Server Computer whose `Disk Status` we need to monitor.\n\n#### Download `tob-http-agent` binary\n\n```shell\n$  wget https://github.com/telkomdev/tob/releases/download/2.0.5/tob-http-agent-1.1.0.linux-amd64.tar.gz\n```\n\n#### Important !!!, always check the SHA256 Checksum before using it\n\nDownload `tob-http-agent-sha256sums.txt` according to the binary version you downloaded https://github.com/telkomdev/tob/releases/download/2.0.5/tob-http-agent-sha256sums.txt\n\n```shell\n$ wget https://github.com/telkomdev/tob/releases/download/2.0.5/tob-http-agent-sha256sums.txt\n```\n\n#### Verify `tob-http-agent` SHA256 Checksum\n\nLinux\n\n```shell\n$ sha256sum tob-http-agent-1.1.0.linux-amd64.tar.gz -c tob-http-agent-sha256sums.txt\ntob-http-agent-1.1.0.linux-amd64.tar.gz: OK\n```\n\n#### Extract `tob-http-agent`\n\n```shell\n$ tar -xvzf tob-http-agent-1.1.0.linux-amd64.tar.gz\n```\n\n#### Run `tob-http-agent` as a daemon with `systemd`\n\nCreate `tob-http-agent.service` `systemd` unit service\n```shell\n$ sudo vi /etc/systemd/system/tob-http-agent.service\n```\n\nCopy content from this file to the `/etc/systemd/system/tob-http-agent.service` and save\n```\nhttps://github.com/telkomdev/tob/blob/master/deployments/systemd/tob-http-agent.service\n```\n\nReload `systemd daemon`\n```shell\n$ sudo systemctl daemon-reload\n```\n\nStart `tob-http-agent` service\n```shell\n$ sudo systemctl start tob-http-agent\n```\n\nCheck if its running\n```shell\n$ sudo systemctl status tob-http-agent\n```\n\n#### Expose `tob-http-agent` service with `nginx`\n\nCreate `tob-http-agent.conf`\n```shell\n$ sudo vi /etc/nginx/sites-available/tob-http-agent.conf\n```\n\nCopy content from this file to the `/etc/nginx/sites-available/tob-http-agent.conf` and save\n```\nhttps://github.com/telkomdev/tob/blob/master/deployments/nginx/tob-http-agent-nginx.conf\n```\n\nCreate `/etc/nginx/sites-available/tob-http-agent.conf` symlink\n```shell\n$ sudo ln -s /etc/nginx/sites-available/tob-http-agent.conf /etc/nginx/sites-enabled/\n```\n\nMake sure the `nginx` configuration is not error\n```shell\n$ sudo nginx -t\nnginx: the configuration file /etc/nginx/nginx.conf syntax is ok\nnginx: configuration file /etc/nginx/nginx.conf test is successful\n```\n\nRestart `nginx`\n```shell\n$  sudo systemctl restart nginx\n```\n\n#### Add `diskstatus` config to the `tob` service config\n\n```json\n\"ubuntu_1_storage_status\": {\n    \"kind\": \"diskstatus\",\n    \"url\": \"http://tob-http-agent.yourdomain.com\",\n    \"checkInterval\": 5,\n    \"thresholdDiskUsage\": 90,\n    \"enable\": true\n}\n```\n\n### Notificator\n\nCurrently tob supports the following types of `Notificator`. `Notificator` is where the tob will send notifications when one or more of the services you're monitoring have problems.\n\n- **Discord**\n- **Email with SMTP**\n- **Slack (webhook)** https://api.slack.com/messaging/webhooks\n- **Telegram**\n- **Webhook** | For security reasons, your `webhook endpoint` must verify the HTTP header: `x-tob-token` that is in every incoming http request.\n\nExample of `x-tob-token` webhook verification in nodejs application\n\n```javascript\nconst express = require('express');\nconst app = express();\nconst bodyParser = require('body-parser');\n\nconst PORT = 3001;\n\nconst tobToken = \"461b919e-1bf4-42db-a8ff-4f21633bbf10\";\n\napp.use(bodyParser.urlencoded({ extended: false }));\napp.use(bodyParser.json());\n\napp.post('/webhook/tob', (req, res) =\u003e {\n    const headers = req.headers;\n    const token = headers[\"x-tob-token\"];\n    \n    const verifiedRequest = token === tobToken;\n    if (!verifiedRequest) {\n        return res.status(401).send({'message': 'token is not valid'});\n    }\n\n    console.log(req.body);\n\n    return res.status(200).send({'message': 'webbhook received'});\n});\n\napp.listen(PORT, () =\u003e console.log(`Server listening on port: ${PORT}`));\n```\n\nThe `tobToken` variable must be the same as the `tobToken` config located in the `config.json` file\n\n```json\n\"webhook\": {\n    \"url\": \"https://api.yourcompany.com/webhook/tob\",\n    \"tobToken\": \"461b919e-1bf4-42db-a8ff-4f21633bbf10\",\n    \"enable\": true\n}\n```\n\n\n`tob` will send a message/payload in the following form to the webhook endpoint that you have specified in the config above.\n\n```json\n{ \n    \"message\": \"mysql_cluster_1 is DOWN\" \n}\n```\n\n### Tob Dashboard Monitoring\n\n\nThis monitoring dashboard will automatically run on the default `port: 9115` when Tob is run. You can change the default port, dashboard title, JWT Key, username and password in the configuration file.\n\n```json\n    \"dashboardHttpPort\": 9115,\n    \"dashboardTitle\": \"My Product Monitoring Dashboard\",\n    \"dashboardJwtKey\": \"czNWm7vGU1usgoVBcuuDCDJWi4wAngTn\",\n    \"dashboardUsername\": \"tob\",\n    \"dashboardPassword\": \"5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5\",\n```\n\n\n`dashboardPassword` is generated with the SHA256 Hash function. You can regenerate dashboardPassword with the `gen_sha256_pass` script in the `scripts` folder.\n\n```shell\n$ ./scripts/gen_sha256_pass.sh my-very-secret-pass\nGenerating SHA256 from 'my-very-secret-pass'\n6386253716d4ae82864e0cfac19de10db5ba1824b1e5a63f209dcb178a9d82e3\n```\n\n\nYou can now access the Monitoring Dashboard on port 9115, or the port you specified.\n\n```\n$ http://localhost:9115\n```\n\n[\u003cimg src=\"./assets/tob_dashboard.png\" width=\"600\"\u003e](https://github.com/telkomdev/tob)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelkomdev%2Ftob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelkomdev%2Ftob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelkomdev%2Ftob/lists"}