Skip to content
This repository has been archived by the owner on Jul 3, 2021. It is now read-only.

Commit

Permalink
Mail example. Closes #15.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorinvo committed Feb 10, 2017
1 parent ae24aa9 commit 960aea7
Showing 1 changed file with 42 additions and 17 deletions.
59 changes: 42 additions & 17 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,71 @@ But feel free to [add a new one](#development)!
Optional. Print binary version.


## Example
## Install

- With [Go](https://golang.org/):
```
go get qvl.io/promplot
```

- With [Homebrew](http://brew.sh/):
```
brew install qvl/tap/promplot
```

- Download from https://github.com/qvl/promplot/releases


## Examples

It's simple to create a shell script for multiple plots:

### Slack

```sh
common="-url $promurl -channel stats -slack $slacktoken"
common="-url $promurl -channel stats -slack $slacktoken -range 24h"

promplot $common \
-title "Free memory in MB" \
-query "node_memory_MemFree /1024 /1024" \
-range "24h"
-query "node_memory_MemFree /1024 /1024"

promplot $common \
-title "Free disk space in GB" \
-query "node_filesystem_free /1024 /1024 /1024" \
-query "node_filesystem_free /1024 /1024 /1024"
-range "24h"

promplot $common \
-title "Open file descriptors" \
-query "process_open_fds" \
-range "24h"
-query "process_open_fds"
```

And with a scheduler like [sleepto](https://qvl.io/sleepto) you can easily automate this script to run every day or once a week.


## Install
### Mailing results

- With [Go](https://golang.org/):
```
go get qvl.io/promplot
```
There is no mail transport built into promplot but you can use the Linux `mail` utility instead:

- With [Homebrew](http://brew.sh/):
```
brew install qvl/tap/promplot
```
```sh
tmp="$(mktemp -d)"
common="-url $promurl -range 24h"

- Download from https://github.com/qvl/promplot/releases
promplot $common \
-title "Free memory in MB" \
-query "node_memory_MemFree /1024 /1024" \
-file ${tmp}/memory.png

promplot $common \
-title "Open file descriptors" \
-query "process_open_fds" \
-file ${tmp}/fds.png

echo "Your daily report is here." | mail \
-s "Daily server stats" \
-a ${tmp}/memory.png \
-a ${tmp}/fds.png \
[email protected]
```


## Development
Expand Down

0 comments on commit 960aea7

Please sign in to comment.