Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
urza authored Jun 25, 2024
1 parent 210f7dc commit 9172591
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
# SpaceCheckSimple
Very simple way how to get email alert when one of your linux servers/VMs/VPS is running out of space.

![space_checker_diagram](https://github.com/urza/SpaceChecker/assets/189804/9358d584-32a8-48b3-bc86-345f768aa950)

## 1. Install HTTP API in docker. This will receive information from your servers. And if some server has less then 10% free space it will send you email.

```
docker pull ghcr.io/urza/spacechecker:main && docker run -d -p 7373:8080 --restart=always --name SpaceCheckAPI -e EmailFrom='FROM@EMAIL' -e EmailTo='TO@EMAIL' -e SmtpUserName='SMTP_LOGIN' -e SmtpPwd='SMTP_PASSWORD' -e SmtpServer='SMTP_SERVER' ghcr.io/urza/spacechecker:main
```

Replace your SMTP info that the API will use to send emails.

Check it is running http://localhost:7373 - you should see a message with list of two valid endpoints: `/last` and `/testmail`

Then grab the URL where this is accesible and reachable from your servers. You may want to put this behind [reverse proxy](https://nginxproxymanager.com/ "reverse proxy").


## 2. Install the curl script that will periodically post information about disk usage from your servers to the api. It will send it's hostname and % usage of the filesystem mounted on "/"

curl -sSL "https://raw.githubusercontent.com/urza/SpaceChecker/main/space_checker_install.sh" && sh space_checker_install.sh "http(s)://API_ADDRESS"

Replace `http(s)://API_ADDRESS` with your API's real address.

If you want the server send info about other filesystem than just "/", modify the [space_checker.sh](https://github.com/urza/SpaceChecker/blob/main/space_checker.sh) script on that server after it is installed.

After a while you can check the `API/last` that it has some data. How often servers post data to api depends on the [cron job](https://github.com/urza/SpaceChecker/blob/main/space_checker_install.sh#L20).
You may test sending emails by `API/testmail`.

0 comments on commit 9172591

Please sign in to comment.