Created
April 22, 2021 15:51
-
-
Save Foolson/8247c825ea17cedf2f50f7318dae4997 to your computer and use it in GitHub Desktop.
External monitoring scripts for MRTG using bbk_cli
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if ! command -v bbk_cli >/dev/null 2>&1 | |
then | |
echo "ERROR: bbk_cli is not installed!" | |
echo "URL: https://github.com/dotse/bbk" | |
exit 1 | |
fi | |
BBK_OUTPUT=$(bbk_cli --quiet) | |
DOWNLOAD=$(cut -d" " -f2 <<< "${BBK_OUTPUT}") | |
UPLOAD=$(cut -d" " -f3 <<< "${BBK_OUTPUT}") | |
DOWNLOAD_BYTES=$(bc <<< "${DOWNLOAD}*125000") | |
UPLOAD_BYTES=$(bc <<< "${UPLOAD}*125000") | |
UPTIME_OUTPUT=$(uptime -p) | |
UPTIME="${UPTIME_OUTPUT:3}" | |
echo "${DOWNLOAD_BYTES}" | |
echo "${UPLOAD_BYTES}" | |
echo "${UPTIME}" | |
echo "${HOSTNAME}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment