mv TMP_FILE to borg_exporter.prom and only pars data that got fully written
Build and Push Docker Container / build-and-push (push) Successful in 1m8s
Build and Push Docker Container / build-and-push (push) Successful in 1m8s
This commit is contained in:
@@ -191,8 +191,8 @@ function findRepositorysAndGetData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendDataToGatewayOrNodeExplorer() {
|
function sendDataToGatewayOrNodeExplorer() {
|
||||||
if ! grep -q '^borg_' "$TMP_FILE"; then
|
if ! grep -qE '^borg_[a-zA-Z_]+\{[^}]+\} [0-9]' "$TMP_FILE"; then
|
||||||
echo "No borg metric data collected; keeping previous metrics output untouched."
|
echo "No valid borg metric data collected; keeping previous metrics output untouched."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ function sendDataToGatewayOrNodeExplorer() {
|
|||||||
else
|
else
|
||||||
#send data via node_exporter
|
#send data via node_exporter
|
||||||
if [ -d "${NODE_EXPORTER_DIR}" ]; then
|
if [ -d "${NODE_EXPORTER_DIR}" ]; then
|
||||||
cp "$TMP_FILE" "${NODE_EXPORTER_DIR}/borg_exporter.prom"
|
mv "$TMP_FILE" "${NODE_EXPORTER_DIR}/borg_exporter.prom"
|
||||||
else
|
else
|
||||||
echo "Please configure either PUSHGATEWAY_URL or NODE_EXPORTER_DIR in /etc/borg_exporter.rc"
|
echo "Please configure either PUSHGATEWAY_URL or NODE_EXPORTER_DIR in /etc/borg_exporter.rc"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user