Created
May 12, 2024 12:24
-
-
Save dermodmaster/114c0fdff451cf50d795d3b8c32d51cf to your computer and use it in GitHub Desktop.
Add coral pci dual tpu temperature metrics to netdata
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
# Put me at /usr/libexec/netdata/charts.d/apex.chart.sh | |
# shellcheck shell=bash | |
# no need for shebang - this file is a plugin | |
# Initialization function | |
# Used to check if the required commands are available | |
apex_check() { | |
require_cmd cat || return 1 | |
return 0 | |
} | |
# Create the charts | |
apex_create() { | |
cat <<EOF | |
CHART apex.temp '' "Apex Temperature" "Celsius" "apex" "apex.temp" line $((apex_update_every)) $((apex_update_every / 2)) | |
DIMENSION apex_0 'apex_0' absolute 1 1000 | |
DIMENSION apex_1 'apex_1' absolute 1 1000 | |
EOF | |
return 0 | |
} | |
# Data collection function | |
apex_update() { | |
local microseconds="$1" | |
local apex_0=$(cat /sys/class/apex/apex_0/temp) | |
local apex_1=$(cat /sys/class/apex/apex_1/temp) | |
cat <<EOF | |
BEGIN apex.temp $microseconds | |
SET apex_0 = $apex_0 | |
SET apex_1 = $apex_1 | |
END | |
EOF | |
return 0 | |
} | |
# The frequency to collect data | |
apex_update_every=5 | |
# The order of execution | |
apex_check | |
apex_create | |
apex_update "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment