Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rwxd/notify-me

Small command line tool to notify myself through various services.
https://github.com/rwxd/notify-me

golang ntfy uptime-kuma

Last synced: about 2 months ago
JSON representation

Small command line tool to notify myself through various services.

Awesome Lists containing this project

README

        

# notify me

Small command line tool to notify myself through various services.

## Installation

Go to [Releases](https://github.com/rwxd/notify-me/releases) and download the latest release.

### From source

```bash
go install github.com/rwxd/notify-me@latest
```

### Ansible

A [Ansible Role](https://github.com/rwxd/ansible-role-notify_me) is available.

## Usage

### Uptime Kuma

```bash
# send up notification
notify-me uptime-kuma -i uptime.com -t "" --up -m ""

# send down notification
notify-me uptime-kuma -i uptime.com -t "" --down -m ""

# send ping value
notify-me uptime-kuma -i uptime.com -t "" --down -m "" --ping "23"
```

#### Wrap a command

Runs a command and sends the up notification if the command exits with 0, otherwise sends a down notification.

```bash
# wrap ping command
notify-me uptime-kuma wrap -i uptime.com -t "" -- ping -c 1 google.com

# send with a custom message before the command output
notify-me uptime-kuma wrap -i uptime.com -t "" -m "" -- ping -c 1 google.com

# only send down notification
notify-me uptime-kuma wrap -i uptime.com -t "" --fail -- ping -c 1 google.com

# only send success notification
notify-me uptime-kuma wrap -i uptime.com -t "" --success -- ping -c 1 google.com

# send down notification when ping succeeds
notify-me uptime-kuma wrap -i uptime.com -t "" --reverse -- ping -c 1 google.com

# send custom message
notify-me uptime-kuma wrap -i uptime.com -t "" -m "" -- ping -c 1 google.com
```

### ntfy

```bash
# send notification
notify-me ntfy -t "" -m ""

# send notification to self hosted instance with username and password
notify-me ntfy -i "" -u "" -p "" -t "" -m ""

# send notification with token for authentication
notify-me ntfy -i "" --token "" -t "" -m ""

# add title
notify-me ntfy -t "" -m "" -T "title"

# set priority to high
notify-me ntfy -t "" -m "" -p "high"

# add tags
notify-me ntfy -t "" -m "" --tags "tag1,tag2"

# add url to open when clicking on notification
notify-me ntfy -t "" -m "" --url "https://example.com"

# more options
notify-me ntfy --help
```

#### Wrap a command

Runs a command and sends a notification with the output.

Supports all the options from the ntfy command.

```bash
# wrap ping command
notify-me ntfy wrap -t "" -- ping -c 1 google.com

# send with a custom message before the command output
notify-me ntfy wrap -t "" -m "" -- ping -c 1 google.com

# send notification to self hosted instance with username and password
notify-me ntfy wrap -i "" -u "" -p "" -t "" -- ping -c 1 google.com

# only send notification when command fails
notify-me ntfy wrap -t "" --fail -- ping -c 1 google.com

# only send notification when command succeeds
notify-me ntfy wrap -t "" --success -- ping -c 1 google.com

# more options
notify-me ntfy wrap --help
```

## Example integrations

### CronJob

```bash
# run a podman container on cron and report to uptime-kuma if it fails
0 1 * * * podman notify-me uptime-kuma wrap -i "uptime.kuma.com" -t "abc" -m "" --only-message -- podman run --rm -ti docker.io/busybox sh -c "echo 'hello'"
```