Skip to content

Commit

Permalink
Added README and Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusWichelmann committed Jun 4, 2022
1 parent 548779a commit 2ebd582
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.idea/
/config.yml
/config.yml
/notdeadyet
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.18-alpine AS base
WORKDIR /app

FROM base AS build
COPY . .
RUN go build -v -o notdeadyet

FROM base AS final
COPY --from=build /app/notdeadyet .
EXPOSE 80
CMD [ "/app/notdeadyet", "--config-file=/config/config.yml" ]
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# notdeadyet

This is a simple dead man's switch monitoring daemon written in Go. It watches, if an API endpoint is polled at a regular, configurable interval, and triggers an alarm otherwise.

For now, only **Pushover** receivers are supported, but more can be added easily.

## Usage

### Configuration file

Take a look at the following sample to write your own `config.yml`:

```yaml
listen: ':80' # Optional
apps:
- name: Test App
token: djms90x1hqflyggx # Generate a random token yourself
timeout: 1h
repeat_interval: 1h
notify:
- Super Administrator
receivers:
pushover:
- name: Super Administrator
user_key: ...
token: ...
priority: 0
```
### Run
You can then run the daemon with
```
./notdeadyet --config-file=config.yml
```

or use the provided Docker images and mount your config into `/config/config.yml`.

### Making requests

You should configure your monitored applications to make regular `GET` or `POST` requests against `http://SERVER/im-alive/TOKEN` to tell `notdeadyet` that the app is still alive.

If the monitored app stops making these requests for the duration configured in `timeout`, then the selected receivers will receive a notification. When the app starts making requests again, a notification is sent, that the app is back.

**Have fun!**
14 changes: 0 additions & 14 deletions config.sample.yml

This file was deleted.

2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func initWatchers() {
}

func handleIndex(c *gin.Context) {
c.String(http.StatusOK, "Not Dead Yet? - The dead man switch monitoring daemon.")
c.String(http.StatusOK, "Not Dead Yet? - The dead man's switch monitoring daemon.")
}

func handleLiveSign(c *gin.Context) {
Expand Down

0 comments on commit 2ebd582

Please sign in to comment.