OpenTelemetry Collector Agent作为Windows服务部署失败的问题咨询及验证
OpenTelemetry Collector Agent作为Windows服务部署失败的问题咨询及验证
大家好,我最近在尝试把OpenTelemetry Collector Agent部署成Windows服务,遇到了启动失败的问题,想跟大家请教正确的部署方向,同时也分享下我后来解决问题的过程。
我下载了对应版本的Windows安装包(Otel Collector Agent版本:0.94.0,运行环境:Windows服务器),一开始执行了以下命令来创建并启动服务:
sc.exe create otelcol displayname= otelcol start= delayed-auto binPath= "C:\Users\admin\otelcol-contrib_0.94.0_windows_386\otelcol-contrib.exe --config C:\Users\admin\Core-Otel.yaml" sc.exe start otelcol
结果服务无法正常启动,在事件查看器里看到的错误信息为:
The otelcol service terminated with the following error: An exception occurred in the service when handling the control request.
之后我调整了命令里的路径引号处理方式,给需要转义的路径加上了正确的转义引号,更新后的命令如下:
sc.exe create otelcol displayname= otelcol start= delayed-auto binPath= \""C:\Users\admin\otelcol-contrib_0.94.0_windows_386\otelcol-contrib.exe\" --config \"C:\Users\admin\Core-Otel.yaml\"" sc.exe description "Otelcol" sc.exe start otelcol
现在服务已经可以正常启动并运行了。
备注:内容来源于stack exchange,提问作者saravana




