#!/bin/bash freeText=$(free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }') diskText=$(df -h | awk '$NF=="/"{printf "Disk Usage: %d/%dGB (%s)\n", $3,$2,$5}') cpuText=$(top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}') resultText=$(echo 'ServerName ('${HOSTNAME}')' ${cpuText} ${freeText} ${diskText}) #echo $resultText #ServerName (precise64) CPU Load: 0.00 Memory Usage: 315/363MB (86.78%) Disk Usage: 1/78GB (3%) curl 'https://hooks.slack.com/services/...blah...blah..webhook.url' \ -X POST -H 'Content-type: application/json' \ --data @<(cat <<EOF { "text": "$resultText" } EOF )