Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Created January 6, 2024 04:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhowbhz/8287559f1dcb30b746fd18d95869e598 to your computer and use it in GitHub Desktop.
Save jhowbhz/8287559f1dcb30b746fd18d95869e598 to your computer and use it in GitHub Desktop.
Monitoring script for apibrasil
#! /bin/bash
MEMORY=$(free -m | awk 'NR==2{printf "%6.2f%%", $3*100/$2 }')
DISK=$(df -h | awk '$NF=="/"{printf "%6s", $5}')
CPU=$(top -bn1 | grep load | awk '{printf "%6.2f%%", $(NF-2)}')
MESSAGE="*Servidor*\n-----\n*Servidor:* APIS\n*Memória*: $MEMORY\n*Disco*:$DISK\n*CPU:*$CPU"
curl --location 'https://gateway.apibrasil.io/api/v2/whatsapp/sendText' \
--header 'Content-Type: application/json' \
--header 'DeviceToken: YOUR_DEVICE_TOKEN' \
--header 'Authorization: Bearer YOUR_AUTH_TOKEN' \
--data '{
"number": "YOUR_PHONE_NUMBER",
"text": "'"$MESSAGE"'",
"time_typing": 1
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment