2023-10-31 13:13:37 +00:00
|
|
|
# Sysstat_Webhook
|
|
|
|
|
2023-10-31 13:15:50 +00:00
|
|
|
currently, WIP. But yeah, Discord sucks! They don't rendering SVG.
|
2023-11-02 07:30:17 +00:00
|
|
|
# Required Package
|
2023-10-31 13:13:37 +00:00
|
|
|
```
|
|
|
|
sudo apt install -y librsvg2-bin
|
2023-10-31 13:15:50 +00:00
|
|
|
```
|
2023-11-02 07:30:17 +00:00
|
|
|
|
|
|
|
# Arguments
|
2023-10-31 13:15:50 +00:00
|
|
|
```
|
|
|
|
w) webhook_url=${OPTARG};; # Discord Webhook URL
|
|
|
|
c) CPU="True";; # CPU
|
|
|
|
r) RAM="True";; # RAM
|
|
|
|
d) DISK_IO="True";; # DISK I/O
|
|
|
|
n) NETWORK="True";; # Network
|
2023-11-02 07:30:17 +00:00
|
|
|
t) MESSAGE_TEXT=${OPTARG};; # Add some text to your webhook message!
|
2023-10-31 13:15:50 +00:00
|
|
|
f) datafile=${OPTARG};; # where your data belongs!
|
2023-11-02 07:30:17 +00:00
|
|
|
o) SYSSTAT_OPTIONS=${OPTARG};; # Sysstat options
|
2023-10-31 13:15:50 +00:00
|
|
|
```
|
|
|
|
|
2023-11-02 07:30:17 +00:00
|
|
|
# Basic running
|
|
|
|
```
|
|
|
|
curl -sL https://github.com/minoplhy/scriptbox/raw/main/sysstat_webhook/stat_discord.sh | bash -s -- -w <WEBHOOK_URL> ARGUMENTS GOES HERE!
|
2023-10-31 13:15:50 +00:00
|
|
|
```
|
2023-11-02 07:30:17 +00:00
|
|
|
|
|
|
|
# Sample usage
|
|
|
|
|
|
|
|
This will get stats from previous day , and the webhook message will be yesterday date.
|
|
|
|
|
|
|
|
something like this :
|
|
|
|
|
|
|
|
![Yesterday date](assets/screenshot.png)
|
2023-11-02 07:35:12 +00:00
|
|
|
* Still, the output image is somehow buggy, this is probably due to conversion from svg to png.
|
|
|
|
```shell
|
2023-11-02 07:30:17 +00:00
|
|
|
text=$(date -d '-1 day' '+%Y-%m-%d')
|
|
|
|
d1=$(date -d '-1 day' '+%d')
|
|
|
|
file=/var/log/sysstat/sa$d1
|
|
|
|
|
|
|
|
curl -sL https://github.com/minoplhy/scriptbox/raw/main/sysstat_webhook/stat_discord.sh | bash -s -- -w <WEBHOOK_URL> -c -f "$file" -t "$text
|
2023-10-31 13:13:37 +00:00
|
|
|
```
|