fix: disk_usage_check.sh handles inode '-' (vfat/efi), checkdefaults sets target_id
- disk_usage_check.sh: sed 's/-/0/' for filesystems without inodes - checkdefaults.Ensure: includes target_id in check_defs INSERT so signals get proper target slug instead of null
This commit is contained in:
@@ -14,7 +14,7 @@ for m in $MOUNTS; do
|
|||||||
PCT=$(echo "$LINE" | awk '{print $3}')
|
PCT=$(echo "$LINE" | awk '{print $3}')
|
||||||
|
|
||||||
INODE_LINE=$(df -i "$m" 2>/dev/null | awk 'NR==2 {print $5}' | tr -d '%' || echo "0")
|
INODE_LINE=$(df -i "$m" 2>/dev/null | awk 'NR==2 {print $5}' | tr -d '%' || echo "0")
|
||||||
INODE_PCT="${INODE_LINE:-0}"
|
INODE_PCT=$(echo "${INODE_LINE:-0}" | sed 's/-/0/')
|
||||||
|
|
||||||
KEY=$(echo "$m" | sed 's|/|_|g' | sed 's|^_||')
|
KEY=$(echo "$m" | sed 's|/|_|g' | sed 's|^_||')
|
||||||
[ -z "$KEY" ] && KEY="root"
|
[ -z "$KEY" ] && KEY="root"
|
||||||
|
|||||||
@@ -196,9 +196,9 @@ func Ensure(ctx context.Context, tx pgx.Tx, entityID uuid.UUID, slug, entityType
|
|||||||
configJSON, _ := json.Marshal(configMap)
|
configJSON, _ := json.Marshal(configMap)
|
||||||
|
|
||||||
_, _ = tx.Exec(ctx,
|
_, _ = tx.Exec(ctx,
|
||||||
`INSERT INTO check_defs (entity_id, kind, config, interval_s, timeout_s, enabled)
|
`INSERT INTO check_defs (entity_id, target_id, kind, config, interval_s, timeout_s, enabled)
|
||||||
VALUES ($1, $2, $3, $4, 30, true)
|
VALUES ($1, $2, $3, $4, $5, 30, true)
|
||||||
ON CONFLICT (entity_id) DO NOTHING`,
|
ON CONFLICT (entity_id) DO NOTHING`,
|
||||||
checkID, def.Kind, configJSON, DefaultInterval(def.Kind))
|
checkID, entityID, def.Kind, configJSON, DefaultInterval(def.Kind))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user