mirror of
https://github.com/natelandau/ansible-homelab-config.git
synced 2025-11-17 17:33:41 -05:00
Telegraf configuration changes
- Added shellscript for custom metrics - external IP & Temp - Bumped Telegraf version #
This commit is contained in:
20
templates/scripts/telegraf_custom_metrics.sh.j2
Executable file
20
templates/scripts/telegraf_custom_metrics.sh.j2
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
EXTERNAL_IP="$(curl -s http://icanhazip.com)"
|
||||
|
||||
# OS specific support
|
||||
if _uname=$(command -v uname); then
|
||||
case $("${_uname}" | tr '[:upper:]' '[:lower:]') in
|
||||
linux*)
|
||||
TEMP="$(cat /sys/class/thermal/thermal_zone0/temp)"
|
||||
;;
|
||||
darwin*)
|
||||
if [ -e "/usr/local/bin/osx-cpu-temp" ]; then
|
||||
TEMP="$(/usr/local/bin/osx-cpu-temp | cut -c -4 | sed -E 's/\.//g')00"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Print output
|
||||
printf "exec ip_external=%s,cpu_temp=%s" "\"${EXTERNAL_IP}\"" "${TEMP}"
|
||||
Reference in New Issue
Block a user