{"id":19008019,"url":"https://github.com/teleivo/diskmon","last_synced_at":"2025-04-22T19:25:50.633Z","repository":{"id":37941487,"uuid":"402760615","full_name":"teleivo/diskmon","owner":"teleivo","description":"Cheap monitoring for mount points","archived":false,"fork":false,"pushed_at":"2025-03-05T22:11:15.000Z","size":186,"stargazers_count":5,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-17T13:30:39.335Z","etag":null,"topics":["digitalocean","digitalocean-droplets","disk-space","monitoring","monitoring-tool"],"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/teleivo.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,"zenodo":null}},"created_at":"2021-09-03T12:20:51.000Z","updated_at":"2025-03-05T22:11:18.000Z","dependencies_parsed_at":"2024-02-07T23:27:41.968Z","dependency_job_id":"3529ceda-2142-4fd1-930b-392ce5401b55","html_url":"https://github.com/teleivo/diskmon","commit_stats":{"total_commits":103,"total_committers":2,"mean_commits":51.5,"dds":0.3203883495145631,"last_synced_commit":"24daf9f840f23e9f5ab667002c7d5388bff422db"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teleivo%2Fdiskmon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teleivo%2Fdiskmon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teleivo%2Fdiskmon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teleivo%2Fdiskmon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teleivo","download_url":"https://codeload.github.com/teleivo/diskmon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250307490,"owners_count":21409088,"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":["digitalocean","digitalocean-droplets","disk-space","monitoring","monitoring-tool"],"created_at":"2024-11-08T18:40:16.068Z","updated_at":"2025-04-22T19:25:50.605Z","avatar_url":"https://github.com/teleivo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Diskmon\n\n[![Build and Test](https://github.com/teleivo/diskmon/actions/workflows/build_test.yml/badge.svg)](https://github.com/teleivo/diskmon/actions/workflows/build_test.yml)\n[![golangci-lint](https://github.com/teleivo/diskmon/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/teleivo/diskmon/actions/workflows/golangci-lint.yml)\n[![codecov](https://codecov.io/gh/teleivo/diskmon/branch/main/graph/badge.svg?token=1VFP7UVS4Z)](https://codecov.io/gh/teleivo/diskmon)\n[![Release](https://img.shields.io/github/release/teleivo/diskmon.svg)](https://github.com/teleivo/diskmon/releases/latest)\n[![Powered By: GoReleaser](https://img.shields.io/badge/powered%20by-goreleaser-green.svg)](https://github.com/goreleaser)\n\nDiskmon will notify you via [Slack](https://slack.com) if a disk has reached\n(\u003e=) a configurable size limit.\n\n## Design Rationale\n\nDiskmon was created to monitor volumes on [Digital Ocean](https://www.digitalocean.com/).\nDigital ocean does not provide that feature in its droplet metrics (as of 09/2021).\n\nWe chose to implement this ourselves in the simplest way we could think of. We\ndid not want to setup [Prometheus](https://prometheus.io/) for this. If you\nhave prometheus already please use the [node exporter](https://github.com/prometheus/node_exporter).\nIt provides mount point monitoring and much more!\n\nSince volumes are mounted under one directory on Digital Ocean (at least in our\nsetup) we chose to just get the disk usage for all its child directories\n(non-recursive). In contrast, `node_exporter` will look at disk usage of your\nmount points and let you for example ignore filesystems or mount points you are\nnot interested in.\n\nWe make a system call to [statfs](https://man.archlinux.org/man/statfs.2) to\nget filesystem statistics. You can try `stat -f go.mod` locally to see what\nusage information we get.\n\n## Get started\n\nDowload a [pre-built binary](https://github.com/teleivo/diskmon/releases).\n\nCopy the binary to a path that is dicoverable by your shell via the $PATH\nenvironment variable.\n\nRun it\n\n```sh\ndiskmon -basedir \u003cdirectory\u003e -limit 65\n```\n\nRun `diskmon --help` to see all the available flags and their defaults.\n\n### Notifications\n\nNotifications can be sent to\n* stdout (by default)\n* or Slack using a [Slack App](https://api.slack.com/start/building)\n\nFor Slack please follow the Slack documentation on how to create a Slack App Bot.\nYou can also follow this YouTube tutorial [Golang Tutorial: Build a Slack Bot](https://youtu.be/n-7l-N541u0).\n\nYou will then need to pass the Slack **Bot User OAuth Token** and the channel\nID to the binary via CLI flags.\n\nPrefer passing credentials for example like so\n\n```sh\ndiskmon -basedir \u003cdirectory\u003e -limit 65 \\\n  -slackToken $SLACK_TOKEN \\\n  -slackChannel $SLACK_CHANNEL\n```\n\nso that the credentials are not in your shell history.\n\n### Running as a service\n\nRead [Running diskmon as a service](./examples/README.md).\n\n## Build from source\n\nYou need to have [Go 1.16](https://golang.org) installed to build the binary yourself.\n\nTo build you can run\n\n```sh\ngo build -o diskmon\n```\n\nOr build and run diskmon directly\n\n```sh\ngo run main.go -basedir \u003cdirectory\u003e -limit 65\n```\n\nto familiarize yourself with the flags. The above will write usage reports to\nstdout.\n\n## Limitations\n\nThe diskmon is not a general purpose disk monitor. It is specifically designed\nfor the use case we had ([see Design Rationale](#design-rationale)).\n\nIf you have prometheus already please use the [node exporter](https://github.com/prometheus/node_exporter).\nIt provides mount point monitoring and much more!\n\n* Notifications can only be sent to Slack using a [Slack App](https://api.slack.com/start/building)\nor to stdout.\nYou can of course adapt the code to send notifications anywhere :smile:\n* It will not discover all mount points for you like the [node exporter](https://github.com/prometheus/node_exporter).\nYou can only provide one directory in which your mount points should be.\nFor our use case the volumes we wanted to monitor were all in one directory.\n* Does not work on Windows due to the syscall we are making\n* Only checks disk usage for non-privileged users. A privileged user might have\n  more disk space available. This might not work for you as it depends on the\n  user permissions of the user writing to the disk you want to monitor.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteleivo%2Fdiskmon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteleivo%2Fdiskmon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteleivo%2Fdiskmon/lists"}