Add option for choosing which stat to graph
This commit is contained in:
parent
23fa4d2dc7
commit
dad1f95881
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
API_URL="https://status.netsyms.net/api/push/"
|
API_URL="https://status.netsyms.net/api/push/"
|
||||||
PUSH_KEY="" # The random code in the URL generated by Uptime Kuma
|
PUSH_KEY="" # The random code in the URL generated by Uptime Kuma
|
||||||
|
GRAPH="CPU" # Which stat is graphed in Uptime Kuma. Can set to "RAM" for memory usage or to "" to disable.
|
||||||
ENABLE_ZFS_MONITOR=1 # Set to 0 if you aren't using ZFS
|
ENABLE_ZFS_MONITOR=1 # Set to 0 if you aren't using ZFS
|
||||||
DISK_FULL_ALERT_PERCENT_THRESHOLD=85 # Alerts if any filesystem is fuller than this
|
DISK_FULL_ALERT_PERCENT_THRESHOLD=85 # Alerts if any filesystem is fuller than this
|
||||||
CPU_USAGE_PERCENT_THRESHOLD=60 # Alerts if CPU usage averages greater than this across 5 minutes
|
CPU_USAGE_PERCENT_THRESHOLD=60 # Alerts if CPU usage averages greater than this across 5 minutes
|
||||||
@ -54,9 +55,9 @@ echo "$CPU_STATUS"
|
|||||||
# Memory usage percentage
|
# Memory usage percentage
|
||||||
echo -n "Checking memory usage: "
|
echo -n "Checking memory usage: "
|
||||||
MEM_STATUS="OK"
|
MEM_STATUS="OK"
|
||||||
MEM_PCT=$(free -m | awk 'NR==2{ print $3*100/$2 }')
|
MEM_PERCENT=$(free -m | awk 'NR==2{ print $3*100/$2 }')
|
||||||
if [[ $MEM_PCT > $MEM_USAGE_PERCENT_THRESHOLD ]]; then
|
if [[ $MEM_PERCENT > $MEM_USAGE_PERCENT_THRESHOLD ]]; then
|
||||||
MEM_STATUS="$MEM_PCT% > $MEM_USAGE_PERCENT_THRESHOLD%"
|
MEM_STATUS="$MEM_PERCENT% > $MEM_USAGE_PERCENT_THRESHOLD%"
|
||||||
fi
|
fi
|
||||||
echo "$MEM_STATUS"
|
echo "$MEM_STATUS"
|
||||||
|
|
||||||
@ -85,11 +86,17 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo -n "Sending status: "
|
echo -n "Sending status: "
|
||||||
|
PING_VALUE=""
|
||||||
|
if [[ $GRAPH == "CPU" ]]; then
|
||||||
|
PING_VALUE="$CPU_PERCENT"
|
||||||
|
elif [[ $GRAPH == "RAM" ]]; then
|
||||||
|
PING_VALUE="$MEM_PERCENT"
|
||||||
|
fi
|
||||||
if [[ $IS_OK == "1" ]]; then
|
if [[ $IS_OK == "1" ]]; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
curl -s -o /dev/null -G "$API_URL$PUSH_KEY?status=up&msg=OK&ping=$CPU_PERCENT"
|
curl -s -o /dev/null -G "$API_URL$PUSH_KEY?status=up&msg=OK&ping=$PING_VALUE"
|
||||||
else
|
else
|
||||||
ERROR_STRING=$(IFS=";"; echo "${ERROR_MESSAGES[*]}")
|
ERROR_STRING=$(IFS=";"; echo "${ERROR_MESSAGES[*]}")
|
||||||
echo $ERROR_STRING
|
echo $ERROR_STRING
|
||||||
curl -s -o /dev/null -G --data-urlencode "status=down" --data-urlencode "msg=$ERROR_STRING" "$API_URL$PUSH_KEY"
|
curl -s -o /dev/null -G --data-urlencode "status=down" --data-urlencode "ping=$PING_VALUE" --data-urlencode "msg=$ERROR_STRING" "$API_URL$PUSH_KEY"
|
||||||
fi
|
fi
|
Loading…
x
Reference in New Issue
Block a user