本文介紹如何查看雲助手狀態,以及雲助手狀態異常時如何處理。
查看雲助手狀態
控制台
-
訪問ECS控制台-雲助手。
在頁面左側頂部,選擇目標資源所在的資源群組和地區。
-
在ECS執行個體頁簽下,查看雲助手狀態。
-
正常:雲助手運行良好,可以正常使用。
在ECS 雲助手頁面的執行個體列表中,查看雲助手狀態列,確認目標執行個體的狀態顯示為正常。
-
未安裝:執行個體上沒有安裝雲助手Agent,您可以參考以下方式安裝雲助手Agent。
-
單擊一鍵安裝自動化安裝雲助手Agent。
一鍵安裝雲助手Agent時,需要重啟執行個體才會生效。
-
手動安裝雲助手Agent,具體操作,請參見安裝雲助手Agent。
在 ECS 雲助手控制台的執行個體列表中,若目標執行個體的雲助手狀態列顯示為未安裝,可單擊對應的一鍵安裝按鈕完成安裝。
-
-
異常:出現異常的原因較多,需要根據具體原因來分析。更多資訊,請參見雲助手異常狀態處理。
在 ECS 雲助手 控制台的 ECS執行個體 頁簽中,執行個體列表的 雲助手狀態 列會展示各執行個體的雲助手運行狀態,狀態為異常時以黃色表徵圖標識。
-
API
調用DescribeCloudAssistantStatus,返回參數中"CloudAssistantStatus": "true"代表雲助手狀態正常,如果狀態異常,請參見雲助手異常狀態處理。
雲助手異常狀態處理
Linux執行個體
-
遠端連線Linux執行個體。
具體操作,請參見使用Workbench登入Linux執行個體。
-
執行如下命令,查看雲助手安裝目錄是否存在。
-
CoreOS作業系統
cd /opt/local/share/ ls -
其他動作系統(Alibaba Cloud Linux、Ubuntu、Debian、RedHat、SUSE Linux Enterprise Server和OpenSUSE等)
cd /usr/local/share/ ls -
如果
aliyun-assist檔案夾存在,請繼續執行步驟3。 -
如果
aliyun-assist檔案夾不存在,說明雲助手被卸載,需要重新安裝雲助手Agent。
-
-
查看雲助手服務狀態。
先確定ECS執行個體的初始化系統,不同核心版本的Linux系統,查看雲助手服務狀態命令不同。
ls -l /sbin/init-
如果輸出指向
systemd例如/lib/systemd/systemd,說明系統使用systemd。 -
如果輸出指向
upstart例如/sbin/upstart,說明系統使用Upstart。 -
如果輸出指向
init例如/sbin/init,說明系統使用sysvinit。
systemd
執行如下命令,查看雲助手狀態。
systemctl status aliyun.service-
當雲助手狀態為
inactive (dead),說明雲助手服務已停止,需要執行systemctl start aliyun.service啟動雲助手服務。如果啟動時報錯或無法啟動,請卸載雲助手後重新安裝。具體操作,請參見停止和卸載雲助手Agent和安裝雲助手Agent。
[ @iZuf68j5ei93s share]# systemctl status aliyun.service ● aliyun.service - Aliyun Assist Loaded: loaded (/etc/systemd/system/aliyun.service; enabled; vendor preset: enabled) Active: inactive (dead) since Mon 2023-09-11 17:18:33 CST; 47s ago Process: 1951 ExecStart=/usr/local/share/aliyun-assist/2.2.3.515/aliyun-service (code=exited, status=0/SUCCESS) Main PID: 1951 (code=exited, status=0/SUCCESS) Tasks: 2 (limit: 22694) Memory: 1.3G CGroup: /system.slice/aliyun.service ├─5608 gpg-agent --homedir /var/cache/dnf/remi-modular-6408ecca79e22107/pubring --use-standard-socket --daemon └─5648 gpg-agent --homedir /var/cache/dnf/remi-safe-ff04689114f71b24/pubring --use-standard-socket --daemon -
當雲助手狀態為
active (running),說明雲助手服務正常運行中,請繼續執行步驟4。[root@iZuf68j5ei93s8 ~ share]# systemctl status aliyun.service ● aliyun.service - Aliyun Assist Loaded: loaded (/etc/systemd/system/aliyun.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2023-09-11 17:25:07 CST; 2s ago Main PID: 72998 (aliyun-service) Tasks: 10 (limit: 22694) Memory: 1.3G CGroup: /system.slice/aliyun.service ├─ 5608 gpg-agent --homedir /var/cache/dnf/remi-modular-6408ecca79e22107/pubring --use-standard-socket --daemon ├─ 5648 gpg-agent --homedir /var/cache/dnf/remi-safe-ff04689114f71b24/pubring --use-standard-socket --daemon └─72998 /usr/local/share/aliyun-assist/2.2.3.515/aliyun-service
Upstart
執行如下命令,查看雲助手狀態。
/sbin/initctl status aliyun-service-
當雲助手狀態為
stop/waiting,說明雲助手服務已停止,需要執行/sbin/initctl start aliyun-service啟動雲助手服務。如果啟動時報錯或無法啟動,請卸載雲助手後重新安裝。具體操作,請參見停止和卸載雲助手Agent和安裝雲助手Agent。
/sbin/initctl status aliyun-service aliyun-service stop/waiting -
當雲助手狀態為
start/running,說明雲助手服務正常運行中,請繼續執行步驟4。/sbin/initctl status aliyun-service aliyun-service start/running, process 1129
sysvinit
執行如下命令,查看雲助手狀態。
/etc/init.d/aliyun-service status-
當雲助手狀態為
Stopped,說明雲助手服務已停止,需要執行/etc/init.d/aliyun-service start啟動雲助手服務。如果啟動時報錯或無法啟動,請卸載雲助手後重新安裝。具體操作,請參見停止和卸載雲助手Agent和安裝雲助手Agent。
[root@i7bp1hfzscxxx ~]# /etc/init.d/aliyun-service status Stopped -
當雲助手狀態為
Running,說明雲助手服務正常運行中,請繼續執行步驟4。[root@i7bplhtzscxxxxxx ~]# /etc/init.d/aliyun-service status Running
-
-
在控制台查看雲助手Agent狀態。
-
如果雲助手Agent狀態為正常,說明異常已解決。
-
如果雲助手Agent狀態依舊異常,需要查看雲助手日誌來具體分析。
-
CoreOS作業系統:
cd /opt/local/share/aliyun-assist/<version>/log tail -100f aliyun_assist_main.log -
其他動作系統(Alibaba Cloud Linux、Ubuntu、Debian、RedHat、SUSE Linux Enterprise Server和OpenSUSE等):
cd /usr/local/share/aliyun-assist/<version>/log tail -100f aliyun_assist_main.log
-
-
Windows執行個體
-
遠端連線Windows執行個體。
具體操作,請參見使用Workbench登入Windows執行個體。
-
查看雲助手安裝目錄
C:\ProgramData\aliyun\assist是否存在。-
如果assist檔案夾存在,請繼續執行步驟3。
-
如果assist檔案夾不存在,說明雲助手被卸載,需要重新安裝雲助手,具體操作,請參見安裝雲助手Agent。
-
-
查看雲助手服務狀態。
-
單擊開始菜單,選擇。
-
選擇。
-
找到Aliyun Assist Service,查看Aliyun Assist Service狀態。
-
若狀態列為正常運行,表示Aliyun Assist Service狀態正常。
-
若狀態列無顯示,表示Aliyun Assist Service已停止,請單擊啟動,啟動Aliyun Assist Service。
如果啟動時報錯或無法啟動,請卸載雲助手後重新安裝。具體操作,請參見停止和卸載雲助手Agent和安裝雲助手Agent。
-
-
-
在控制台查看雲助手Agent狀態。
-
如果雲助手Agent狀態為正常,說明異常已解決。
-
如果雲助手Agent狀態還是異常,需要查看雲助手日誌來具體分析。
雲助手預設日誌路徑:
C:\ProgramData\aliyun\assist\<version>\log,<version>為雲助手Agent的具體版本號碼。該目錄下重點關注
aliyun_assist_main.log及其日期輪轉備份檔案(如aliyun_assist_main.log.20230912),通過查看這些記錄檔定位雲助手 Agent 異常原因。
-
常見問題
為什麼雲助手日誌中出現context deadline exceeded (Client.Timeout exceeded while awaiting headers)錯誤資訊?
time="2023-05-23T00:01:17+08:00" level=info msg=GET_HOST_ERROR
time="2023-05-23T00:04:17+08:00" level=info msg="http://100.100.100.200/latest/meta-data/region-id cn-shanghai <nil>"
time="2023-05-23T00:04:22+08:00" level=info msg="https://cn-shanghai.axt.aliyun.com/luban/api/connection_detect Get \"https://cn-shanghai.axt.aliyun.com/luban/api/connection_detect\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:22+08:00" level=info msg="Poll region id for instance in classic network"
time="2023-05-23T00:04:27+08:00" level=info msg="https://cn-hangzhou.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-hangzhou.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:32+08:00" level=info msg="https://cn-qingdao.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-qingdao.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:37+08:00" level=info msg="https://cn-beijing.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-beijing.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:42+08:00" level=info msg="https://cn-zhangjiakou.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-zhangjiakou.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded
(Client.Timeout exceeded while awaiting headers)"
time="2023-05-23T00:04:47+08:00" level=info msg="https://cn-huhehaote.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-huhehaote.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:52+08:00" level=info msg="https://cn-shanghai.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-shanghai.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:04:57+08:00" level=info msg="https://cn-shenzhen.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-shenzhen.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:05:02+08:00" level=info msg="https://cn-hongkong.axt.aliyun.com/luban/api/classic/region-id Get \"https://cn-hongkong.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:05:07+08:00" level=info msg="https://eu-west-1.axt.aliyun.com/luban/api/classic/region-id Get \"https://eu-west-1.axt.aliyun.com/luban/api/classic/region-id\": context deadline exceeded (Client.Timeout
exceeded while awaiting headers)"
time="2023-05-23T00:05:07+08:00" level=info msg=GET_HOST_ERROR
出現該錯誤一般是ECS執行個體與雲助手伺服器間的網路連通異常,您可以運行以下命令,查看網路連通性。
請將<region-id>替換為地區的ID。更多資訊,請參見地區和可用性區域。
ping <region-id>.axt.aliyun.com
curl https://<region-id>.axt.aliyun.com/luban/api/instance/instance-id
正常情況下網域名稱能夠正常解析並且連通,且介面能夠返回正常的instance_id。
若不能解析或者不能正常返回執行個體ID,則說明執行個體網路存在問題,需要進行排查。具體操作,請參見配置雲助手Agent網路許可權。
[ xxx@iZuf62n-xxx : ~]# ping -c 5 cn-shanghai.axt.aliyun.com
PING cn-shanghai.axt.aliyun.com (100.100.xxx) 56(84) bytes of data.
64 bytes from 100.100.36.108 (100.100.xxx): icmp_seq=1 ttl=102 time=1.32 ms
64 bytes from 100.100.36.108 (100.100.xxx): icmp_seq=2 ttl=102 time=1.30 ms
64 bytes from 100.100.36.108 (100.100.xxx): icmp_seq=3 ttl=102 time=1.32 ms
64 bytes from 100.100.36.108 (100.100.xxx): icmp_seq=4 ttl=102 time=1.30 ms
64 bytes from 100.100.36.108 (100.100.xxx): icmp_seq=5 ttl=102 time=1.30 ms
--- cn-shanghai.axt.aliyun.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
rtt min/avg/max/mdev = 1.295/1.305/1.318/0.010 ms
[ @iZuf62njf1dkb ~]# curl https://cn-shanghai.axt.aliyun.com/luban/api/instance/instance-id
i-uf62njf1dkbc2c xxx root@iZuf62njf1dkb xxx ~]#
為什麼受管理的執行個體註冊成功但顯示狀態異常?
若託管的執行個體顯示註冊成功,但云助手控制台顯示雲助手狀態異常,可以查看雲助手日誌是否出現invalid timestamp錯誤。
雲助手預設日誌路徑如下,<version>為雲助手Agent的具體版本號碼。
-
Linux執行個體
-
CoreOS作業系統:/opt/local/share/aliyun-assist/<version>/log
-
其他動作系統(Alibaba Cloud Linux、Ubuntu、Debian、RedHat、SUSE Linux Enterprise Server和OpenSUSE等):/usr/local/share/aliyun-assist/<version>/log
-
-
Windows執行個體:C:\ProgramData\aliyun\assist\<version>\log
雲助手日誌中出現 invalid timestamp 錯誤的樣本如下。其中 code:400、errCode:BAD_REQUEST、errMsg:invalid timestamp 為嚴重錯誤資訊。
M/s1Kpi+KHyHOSytaIf6q7qPc8cGRXbaKR4ZtzJMOKTRoW1V1Y2t6cMaW7v9pZY9phJKeqQo4TMtAZasr/68EqS3xfaYmBRpvlnqvR6b3CR0336R1OQ==
time="2023-09-04T16:54:37+08:00" level=info msg="https://cn-shanghai.axt.aliyuncs.com/luban/api/metrics {\"code\":400,\"errCode\":\"_BAD_REQUEST_\",\"errMsg\":\"invalid timestamp:
1693817677756,\"instanceId\":\"mi-sh03vea8ivh50qo\",\"requestId\":\"efb3ccca-7834-43e2-b0ce-1f5aacb37aad\"
{\"eventId\":\"agent.startup\",\"category\":\"STARTUP\",\"subCategory\":\"\",\"eventLevel\":\"INFO\",\"eventTime\":\"1693817677755\",\"common\":\"\",\"arch\":\"amd64\",\"instanceId\":\"\",\"unknown\",\"osVersion\"
\"Linux_#1 SMP Tue Mar 31 23:36:51 UTC 2020_x86_64\",\"virtualType\":\"unknown\",\"distribution\":\"\",\"centos
7.8.2003\",\"kernelVersion\":\"3.10.0-1127.el7.x86_64\",\"keywords\":\"\",\"osName\":\"Linux_#1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64\",\"type\":\"\"not cold start\"}
time="2023-09-04T16:54:37+08:00" level=info msg="https://cn-shanghai.axt.aliyuncs.com/luban/api/l/task?reason=startup&cold=false¤tTime=1693817677756&offset=28800&timeZone=Asia%2FShanghai
{\"code\":400,\"errCode\":\"_BAD_REQUEST_\",\"errMsg\":\"invalid timestamp: 1693817677756\",\"instanceId\":\"mi-sh03vea8ivh50qo\",\"requestId\":\"bcbb8f3e-781a-43f1-afa8-e2Seef3cf116\"} <nil>"
time="2023-09-04T16:54:37+08:00" level=info msg="mi-sh03vea8ivh50qo1d678715bd3442d9bf66b7b5712a5 251693817677961439582&d-a299-486c-94d7-ba71f537f248
LEv1C0x/ZhbRS57+A7/60/SOJe51CxxXKKq4f97phnz1o FBwCKREpDDBbEhZth1CzOQqXqauSt1xmAQW=="
gxSud7 9MnI1TUJav3jyMdmK+s2BGZGHzZstWSinn7cjaTj fA+dgkhNAqvOMoq63Z6BWR4N0rZt1oLCrrFIG4JAIFLAyfmOmrkygk5/abOezyk4DH/1V7vN2wQ
7FYEi7VVY45BzrKEvGtIzNefc0dltkNKSP0MHRsWMR6xibFWDe/u/0z3KJ9oQYZ JaTn6g5uzlnIZ91Lx09ssJz/JU6cOnd8fOrXCaBPFpg20SmcUBZu1HQ==
time="2023-09-04T16:54:38+08:00" level=info msg="https://cn-shanghai.axt.aliyuncs.com/luban/api/metrics {\"code\":400,\"errCode\":\"_BAD_REQUEST_\",\"errMsg\":\"invalid timestamp:
1693817677961\",\"instanceId\":\"mi-sh03vea8ivh50qo\",\"requestId\":\"4395828d-a299-486c-94d7-ba71f537f248\"
{\"eventId\":\"agent.kdump\",\"category\":\"KDUMP\",\"eventLevel\":\"INFO\",\"eventTime\":\"1693817677961\",\"common\":\"\",\"arch\":\"amd64\",\"unknown\",\"osVersion\":\"Lin
ux_#1 SMP Tue Mar 31 23:36:51 UTC 2020_x86_64\",\"virtualType\":\"unknown\",\"distribution\":\"centos
7.8.2003\",\"kernelVersion\":\"3.10.0-1127.el7.x86_64\",\"keywords\":\"\",\"status\":\"\"ON\"\"} <nil>"
time="2023-09-04T16:54:54+08:00" level=info msg="Stopping ......"
出現該錯誤是由於受管理的執行個體上的時間戳記和實際時間有誤差導致,可以嘗試校準ECS執行個體時間解決。更多資訊,請參見手動同步時間。
相關文檔
您可以通過ListPluginStatus來查詢執行個體中雲助手外掛程式的狀態。同時,您也可以在介面的返回資訊中,查看雲助手第一次上報外掛程式狀態的時間(FirstHeartbeatTime參數)和雲助手最近一次上報外掛程式狀態的時間(LastHeartbeatTime參數)。