Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Se aplica a:SQL Server
En este artículo se describen formas de identificar extensiones incorrectas que no están instaladas correctamente, que se ejecutan correctamente o no están conectadas a Azure.
Identificación de extensiones incorrectas
Uso del panel de mantenimiento de la extensión integrada en Azure Portal
Puede usar el panel de mantenimiento de la extensión integrada en Azure Portal para mostrar el estado de todas las extensiones de Azure implementadas para SQL Server.
Sugerencia
Cree su propio panel personalizado con este archivo desde el repositorio de GitHub sql-server-samples: SQL Server habilitado para Arc Health.json.
Consulta de extensiones incorrectas mediante Azure Resource Graph
Use Azure Resource Graph para identificar el estado de la extensión de Azure para SQL Server en los servidores habilitados para Azure Arc.
Sugerencia
Si aún no está familiarizado, obtenga información sobre Azure Resource Graph:
Esta consulta devuelve instancias de SQL Server en servidores con extensiones instaladas, pero no correctas.
resources
| where type == "microsoft.hybridcompute/machines/extensions"
| where properties.type in ("WindowsAgent.SqlServer", "LinuxAgent.SqlServer")
| extend targetMachineName = tolower(tostring(split(id, '/')[8])) // Extract the machine name from the extension's id
| join kind=leftouter (
resources
| where type == "microsoft.hybridcompute/machines"
| project machineId = id, MachineName = name, subscriptionId, LowerMachineName = tolower(name), resourceGroup , MachineStatus= properties.status , MachineProvisioningStatus= properties.provisioningState, MachineErrors = properties.errorDetails //Project relevant machine health information.
) on $left.targetMachineName == $right.LowerMachineName and $left.resourceGroup == $right.resourceGroup and $left.subscriptionId == $right.subscriptionId // Join Based on MachineName in the id and the machine's name, the resource group, and the subscription. This join allows us to present the data of the machine as well as the extension in the final output.
| extend statusExpirationLengthRange = 3d // Change this value to change the acceptable range for the last time an extension should have reported its status.
| extend startDate = startofday(now() - statusExpirationLengthRange), endDate = startofday(now()) // Get the start and end position for the given range.
| extend extractedDateString = extract("timestampUTC : (\\d{4}\\W\\d{2}\\W\\d{2})", 1, tostring(properties.instanceView.status.message)) // Extracting the date string for the LastUploadTimestamp. Is empty if none is found.
| extend extractedDateStringYear = split(extractedDateString, '/')[0], extractedDateStringMonth = split(extractedDateString, '/')[1], extractedDateStringDay = split(extractedDateString, '/')[2] // Identifying each of the parts of the date that was extracted from the message.
| extend extractedDate = todatetime(strcat(extractedDateStringYear,"-",extractedDateStringMonth,"-",extractedDateStringDay,"T00:00:00Z")) // Converting to a datetime object and rewriting string into ISO format because todatetime() does not work using the previous format.
| extend isNotInDateRange = not(extractedDate >= startDate and extractedDate <= endDate) // Created bool which is true if the date we extracted from the message is not within the specified range. This bool will also be true if the date was not found in the message.
| where properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy" // Begin searching for unhealthy extensions using the following 1. Does extension report being healthy. 2. Is last upload within the given range. 3. Is the upload status in an OK state. 4. Is provisioning state not in a succeeded state.
or isNotInDateRange
or properties.instanceView.status.message !contains "uploadStatus : OK"
or properties.provisioningState != "Succeeded"
or MachineStatus != "Connected"
| extend FailureReasons = strcat( // Makes a String to list all the reason that this resource got flagged for
iif(MachineStatus != "Connected",strcat("- Machine's status is ", MachineStatus," -"),"") ,
iif(MachineErrors != "[]","- Machine reports errors -", ""),
iif(properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy","- Extension reported unhealthy -",""),
iif(isNotInDateRange,"- Last upload outside acceptable range -",""),
iif(properties.instanceView.status.message !contains "uploadStatus : OK","- Upload status is not reported OK -",""),
iif(properties.provisioningState != "Succeeded",strcat("- Extension provisiong state is ", properties.provisioningState," -"),"")
)
| extend RecommendedAction = //Attempt to Identify RootCause based on information gathered, and point customer to what they should investigate first.
iif(MachineStatus == "Disconnected", "Machine is disconnected. Please reconnect the machine.",
iif(MachineStatus == "Expired", "Machine cert is expired. Go to the machine on the Azure portal for more information on how to resolve this issue.",
iif(MachineStatus != "Connected", strcat("Machine status is ", MachineStatus,". Investigate and resolve this issue."),
iif(MachineProvisioningStatus != "Succeeded", strcat("Machine provisioning status is ", MachineProvisioningStatus, ". Investigate and resolve machine provisioning status"),
iff(MachineErrors != "[]", "Machine is reporting errors. Investigate and resolve machine errors",
iif(properties.provisioningState != "Succeeded", strcat("Extension provisioning status is ", properties.provisioningState,". Investigate and resolve extension provisioning state."),
iff(properties.instanceView.status.message !contains "SQL Server Extension Agent:" and properties.instanceView.status.message contains "SQL Server Extension Agent Deployer", "SQL Server extension employer ran. However, SQL Server extension seems to not be running. Verify that the extension is currently running.",
iff(properties.instanceView.status.message !contains "uploadStatus : OK" or isNotInDateRange or properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy", "Extension reported as unhealthy. View FailureReasons and LastExtensionStatusMessage for more information as to the cause of the failure.",
"Unable to recommend actions. Please view FailureReasons."
)
)
)
)
)
)
)
)
| project ID = id, MachineName, ResourceGroup = resourceGroup, SubscriptionID = subscriptionId, Location = location, RecommendedAction, FailureReasons, LicenseType = properties.settings.LicenseType,
LastReportedExtensionHealth = iif(properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy", "Unhealthy", "Healthy"),
LastExtensionUploadTimestamp = iif(indexof(properties.instanceView.status.message, "timestampUTC : ") > 0,
substring(properties.instanceView.status.message, indexof(properties.instanceView.status.message, "timestampUTC : ") + 15, 10),
"no timestamp"),
LastExtensionUploadStatus = iif(indexof(properties.instanceView.status.message, "uploadStatus : OK") > 0, "OK", "Unhealthy"),
ExtensionProvisioningState = properties.provisioningState,
MachineStatus, MachineErrors, MachineProvisioningStatus,MachineId = machineId,
LastExtensionStatusMessage = properties.instanceView.status.message
Para identificar posibles problemas, revise el valor en la columna RecommendedAction o la columna FailureReasons. La columna RecommendedAction proporciona los primeros pasos posibles para resolver el problema o pistas sobre lo que se debe comprobar primero. En la columna FailureReasons se enumeran los motivos por los que el recurso se consideró no saludable. Por último, compruebe LastExtensionStatusMessage para ver el último mensaje notificado por el agente.
Recomendaciones
| Acción recomendada | Detalles de la acción |
|---|---|
| El certificado de máquina ha expirado. Vaya a la máquina en Azure Portal para más información sobre cómo resolver este problema. |
La máquina habilitada para Arc debe volver a incorporarse a Arc porque el certificado usado para autenticarse en Azure expiró. El estado de la máquina Arc es Expirado en el portal de Azure. Puede desinstalar el agente y volver a incorporarlo. No es necesario eliminar los recursos de SQL Server habilitados para Arc en el portal si está volviendo a incorporar. La extensión SQL se instala automáticamente de nuevo siempre que la incorporación automática esté habilitada (valor predeterminado). |
| La máquina está desconectada. Vuelva a conectar la máquina. |
La máquina Arc está en state = Disconnected. Este estado puede deberse a varios motivos:El agente de máquina conectado a Arc se detiene, está deshabilitado o se bloquea constantemente or La conectividad se bloquea entre el agente y Azure. Compruebe el estado de los servicios o daemons de la máquina conectada a Arc para asegurarse de que están habilitados y en ejecución. Compruebe la conectividad. Solución de problemas del agente usando el registro detallado. |
| Extensión reportada como en mal estado. Vea FailureReasons y LastExtensionStatusMessage para obtener más información sobre la causa del error. Última carga fuera del intervalo aceptable (en los últimos tres días). |
Compruebe la columna LastExtensionUploadTimestamp. Si es Sin marca de tiempo, nunca notificó los datos de inventario o uso a Azure.
Solución de problemas de conectividad con el servicio de procesamiento de datos y los puntos de conexión de telemetría. Si la última carga está fuera del intervalo aceptable (en los últimos tres días) y todo lo demás parece correcto, como LastExtensionUploadStatus, ExtensionProvisioningState y MachineStatus, es posible que se detenga la extensión de Azure para el servicio o demonio de SQL Server. Descubra por qué se detiene e inícielo de nuevo. Compruebe el LastExtensionStatusMessage para obtener otras pistas sobre el problema. |
| El estado de aprovisionamiento de extensiones es Error. Investigue y resuelva el estado de provisión de extensiones. |
Error en la instalación inicial de la extensión SQL o en la actualización. Solución de problemas de la extensión de Azure para la implementación de SQL Server. Compruebe el valor de LastExtensionStatusMessage. |
| No se reporta correctamente el estado de carga | Compruebe la columna LastExtensionMessage en el tablero de mandos y examine el valor de uploadStatus y el valor de uploadMessage (si está presente, dependiendo de la versión). El valor de uploadStatus suele ser un código de error HTTP. Revise Solucionar problemas de códigos de error (vista previa) UploadMessage puede tener información más específica. Solución de problemas de conectividad con el servicio de procesamiento de datos y los puntos de conexión de telemetría. |
| El estado de aprovisionamiento de extensiones es Actualizando or El estado de aprovisionamiento de extensiones es Creando or El estado de aprovisionamiento de extensiones es Error or El estado de aprovisionamiento de extensiones es Eliminando |
Si una extensión determinada permanece en uno de estos estados durante más de 30 minutos, es probable que haya un problema con el aprovisionamiento. Desinstale la extensión y vuelva a instalarla mediante la CLI o el portal. Si el problema persiste, compruebe los registros del implementador y de la extensión. Si se produce un error en la creación de la extensión, compruebe que el agente está conectado y que los servicios del agente asociados se están ejecutando. Si la eliminación falla, intente desinstalar el agente, elimine el recurso de la máquina Arc en el portal si es necesario y luego vuelva a desplegarlo. Puede desinstalar el agente y volver a incorporarlo. |
Identificación de una extensión incorrecta (PowerShell)
Este ejemplo se ejecuta en PowerShell. El ejemplo devuelve el mismo resultado que la consulta anterior, pero a través de un script de PowerShell.
# PowerShell script to execute an Azure Resource Graph query using Azure CLI
# where the extension status is unhealthy or the extension last upload time isn't in this month or the previous month.
# Requires the Az.ResourceGraph PowerShell module
# Login to Azure if needed
#az login
# Define the Azure Resource Graph query
$query = @"
resources
| where type == "microsoft.hybridcompute/machines/extensions"
| where properties.type in ("WindowsAgent.SqlServer", "LinuxAgent.SqlServer")
| extend targetMachineName = tolower(tostring(split(id, '/')[8])) // Extract the machine name from the extension's id
| join kind=leftouter (
resources
| where type == "microsoft.hybridcompute/machines"
| project machineId = id, MachineName = name, subscriptionId, LowerMachineName = tolower(name), resourceGroup , MachineStatus= properties.status , MachineProvisioningStatus= properties.provisioningState, MachineErrors = properties.errorDetails //Project relevant machine health information.
) on $left.targetMachineName == $right.LowerMachineName and $left.resourceGroup == $right.resourceGroup and $left.subscriptionId == $right.subscriptionId // Join Based on MachineName in the id and the machine's name, the resource group, and the subscription. This join allows us to present the data of the machine as well as the extension in the final output.
| extend statusExpirationLengthRange = 3d // Change this value to change the acceptable range for the last time an extension should have reported its status.
| extend startDate = startofday(now() - statusExpirationLengthRange), endDate = startofday(now()) // Get the start and end position for the given range.
| extend extractedDateString = extract("timestampUTC : (\\d{4}\\W\\d{2}\\W\\d{2})", 1, tostring(properties.instanceView.status.message)) // Extracting the date string for the LastUploadTimestamp. Is empty if none is found.
| extend extractedDateStringYear = split(extractedDateString, '/')[0], extractedDateStringMonth = split(extractedDateString, '/')[1], extractedDateStringDay = split(extractedDateString, '/')[2] // Identifying each of the parts of the date that was extracted from the message.
| extend extractedDate = todatetime(strcat(extractedDateStringYear,"-",extractedDateStringMonth,"-",extractedDateStringDay,"T00:00:00Z")) // Converting to a datetime object and rewriting string into ISO format because todatetime() does not work using the previous format.
| extend isNotInDateRange = not(extractedDate >= startDate and extractedDate <= endDate) // Created bool which is true if the date we extracted from the message is not within the specified range. This bool will also be true if the date was not found in the message.
| where properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy" // Begin searching for unhealthy extensions using the following 1. Does extension report being healthy. 2. Is last upload within the given range. 3. Is the upload status in an OK state. 4. Is provisioning state not in a succeeded state.
or isNotInDateRange
or properties.instanceView.status.message !contains "uploadStatus : OK"
or properties.provisioningState != "Succeeded"
or MachineStatus != "Connected"
| extend FailureReasons = strcat( // Makes a String to list all the reason that this resource got flagged for
iif(MachineStatus != "Connected",strcat("- Machine's status is ", MachineStatus," -"),"") ,
iif(MachineErrors != "[]","- Machine reports errors -", ""),
iif(properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy","- Extension reported unhealthy -",""),
iif(isNotInDateRange,"- Last upload outside acceptable range -",""),
iif(properties.instanceView.status.message !contains "uploadStatus : OK","- Upload status is not reported OK -",""),
iif(properties.provisioningState != "Succeeded",strcat("- Extension provisiong state is ", properties.provisioningState," -"),"")
)
| extend RecommendedAction = //Attempt to Identify RootCause based on information gathered, and point customer to what they should investigate first.
iif(MachineStatus == "Disconnected", "Machine is disconnected. Please reconnect the machine.",
iif(MachineStatus == "Expired", "Machine cert is expired. Go to the machine on the Azure portal for more information on how to resolve this issue.",
iif(MachineStatus != "Connected", strcat("Machine status is ", MachineStatus,". Investigate and resolve this issue."),
iif(MachineProvisioningStatus != "Succeeded", strcat("Machine provisioning status is ", MachineProvisioningStatus, ". Investigate and resolve machine provisioning status"),
iff(MachineErrors != "[]", "Machine is reporting errors. Investigate and resolve machine errors",
iif(properties.provisioningState != "Succeeded", strcat("Extension provisioning status is ", properties.provisioningState,". Investigate and resolve extension provisioning state."),
iff(properties.instanceView.status.message !contains "SQL Server Extension Agent:" and properties.instanceView.status.message contains "SQL Server Extension Agent Deployer", "SQL Server extension employer ran. However, SQL Server extension seems to not be running. Verify that the extension is currently running.",
iff(properties.instanceView.status.message !contains "uploadStatus : OK" or isNotInDateRange or properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy", "Extension reported as unhealthy. View FailureReasons and LastExtensionStatusMessage for more information as to the cause of the failure.",
"Unable to recommend actions. Please view FailureReasons."
)
)
)
)
)
)
)
)
| project ID = id, MachineName, ResourceGroup = resourceGroup, SubscriptionID = subscriptionId, Location = location, RecommendedAction, FailureReasons, LicenseType = properties.settings.LicenseType,
LastReportedExtensionHealth = iif(properties.instanceView.status.message !contains "SQL Server Extension Agent: Healthy", "Unhealthy", "Healthy"),
LastExtensionUploadTimestamp = iif(indexof(properties.instanceView.status.message, "timestampUTC : ") > 0,
substring(properties.instanceView.status.message, indexof(properties.instanceView.status.message, "timestampUTC : ") + 15, 10),
"no timestamp"),
LastExtensionUploadStatus = iif(indexof(properties.instanceView.status.message, "uploadStatus : OK") > 0, "OK", "Unhealthy"),
ExtensionProvisioningState = properties.provisioningState,
MachineStatus, MachineErrors, MachineProvisioningStatus,MachineId = machineId,
LastExtensionStatusMessage = properties.instanceView.status.message
"@
# Execute the Azure Resource Graph query
$result = Search-AzGraph -Query $query
# Output the results
$result | Format-Table -Property ExtensionHealth, LastUploadTimestamp, LastUploadStatus, Message
Para identificar posibles problemas, revise el valor en la columna RecommendedAction o la columna FailureReasons. La columna RecommendedAction proporciona los primeros pasos posibles para resolver el problema o pistas sobre lo que se debe comprobar primero. En la columna FailureReasons se enumeran los motivos por los que el recurso se consideró no saludable. Por último, compruebe LastExtensionStatusMessage para ver el último mensaje notificado por el agente.
Identificación de las extensiones que necesitan actualización
Identificar extensiones sin actualizaciones de estado recientes. Esta consulta devuelve una lista de extensiones de Azure para SQL Server ordenadas por el número de días desde que se actualizaron por última vez. Un valor de "-1" indica que la extensión se bloqueó y hay una pila de llamadas en el estado de la extensión.
// Show the timestamp extracted
// If an extension has crashed (i.e. no heartbeat), fill timestamp with "1900/01/01, 00:00:00.000"
//
resources
| where type =~ 'microsoft.hybridcompute/machines/extensions'
| extend extensionStatus = parse_json(properties).instanceView.status.message
| extend timestampExtracted = extract(@"timestampUTC\s*:\s*(\d{4}/\d{2}/\d{2}, \d{2}:\d{2}:\d{2}\.\d{3})", 1, tostring(extensionStatus))
| extend timestampNullFilled = iff(isnull(timestampExtracted) or timestampExtracted == "", "1900/01/01, 00:00:00.000", timestampExtracted)
| extend timestampKustoFormattedString = strcat(replace(",", "", replace("/", "-", replace("/", "-", timestampNullFilled))), "Z")
| extend agentHeartbeatUtcTimestamp = todatetime(timestampKustoFormattedString)
| extend agentHeartbeatLagInDays = datetime_diff('day', now(), agentHeartbeatUtcTimestamp)
| project id, extensionStatus, agentHeartbeatUtcTimestamp, agentHeartbeatLagInDays
| limit 100
| order by ['agentHeartbeatLagInDays'] asc
Esta consulta devuelve un recuento de extensiones agrupadas por el número de días desde que se actualizaron por última vez. Un valor de "-1" indica que la extensión se bloqueó y hay una pila de llamadas en el estado de la extensión.
// Aggregate by timestamp
//
// -1: Crashed extension with no heartbeat, we got a stacktrace instead
// 0: Healthy
// >1: Stale/Offline
//
resources
| where type =~ 'microsoft.hybridcompute/machines/extensions'
| extend extensionStatus = parse_json(properties).instanceView.status.message
| extend timestampExtracted = extract(@"timestampUTC\s*:\s*(\d{4}/\d{2}/\d{2}, \d{2}:\d{2}:\d{2}\.\d{3})", 1, tostring(extensionStatus))
| extend timestampNullFilled = iff(isnull(timestampExtracted) or timestampExtracted == "", "1900/01/01, 00:00:00.000", timestampExtracted)
| extend timestampKustoFormattedString = strcat(replace(",", "", replace("/", "-", replace("/", "-", timestampNullFilled))), "Z")
| extend agentHeartbeatUtcTimestamp = todatetime(timestampKustoFormattedString)
| extend agentHeartbeatLagInDays = iff(agentHeartbeatUtcTimestamp == todatetime("1900/01/01, 00:00:00.000Z"), -1, datetime_diff('day', now(), agentHeartbeatUtcTimestamp))
| summarize numExtensions = count() by agentHeartbeatLagInDays
| order by numExtensions desc
Actualización de la extensión
Para determinar la versión actual de la extensión, revise las notas de lanzamiento.
Para comprobar la versión de la extensión, use el siguiente comando de PowerShell:
azcmagent version
Para simplificar las actualizaciones de extensiones, asegúrese de habilitar las actualizaciones automáticas. También puede actualizar manualmente la extensión mediante Azure Portal, PowerShell y la CLI de Azure.
Para actualizar la extensión en Azure Portal, siga estos pasos:
En Azure Portal, vaya a Máquinas: Azure Arc.
Seleccione el nombre de la máquina donde está instalado SQL Server para abrir el panel Información general del servidor.
En Configuración, seleccione Extensiones.
Active la casilla de la
WindowsAgent.SqlServerextensión y, a continuación, seleccione Actualizar en el menú de navegación.
Seleccione Sí en el cuadro de diálogo de confirmación de actualización de la extensión para completar la mejora.
Para más información sobre cómo actualizar la extensión de Azure para SQL Server, consulte Actualización de la extensión.