尝试在 Splunk 上安装 gRPC python 模块
Trying to install gRPC python module on Splunk
我正尝试在 Splunk 上 运行 外部 python 脚本 "PyClient.py",它需要外部 gRPC 模块。我按照 http://www.grpc.io/docs/quickstart/python.html 的快速入门 python 指南在本地安装了 gRPC 模块。 splunkd文件中产生的日志如下:
06-16-2017 18:20:49.728 +0530 WARN IntrospectionGenerator:resource_usage - RU - Failure executing PDH query, skipping getting iostats data this collection cycle. Status code is -2147481643
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" Traceback (most recent call last):
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py", line 2, in <module>
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" import grpc
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\grpc\__init__.py", line 37, in <module>
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" from grpc._cython import cygrpc as _cygrpc
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" Traceback (most recent call last):
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py", line 2, in <module>
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" import grpc
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\grpc\__init__.py", line 37, in <module>
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" from grpc._cython import cygrpc as _cygrpc
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
有人对如何清除此错误有任何建议吗?或者如何在Splunk上安装外部gRPC模块?
提前致谢。
这看起来像是 32/64 位 Windows 不兼容。
安装 gRPC 时,请确保您明确使用 Python 到 pip install grpcio
的 Splunk 分布。
C:\Program Files\Splunk\<Python2.7 binary> -m pip install --upgrade pip
C:\Program Files\Splunk\<Python2.7 binary> -m pip install grpcio
我已经找到了解决方案。我必须为我的 python 脚本编写一个包装脚本,该脚本取消设置或删除 (del) "LD_LIBRARY_PATH" 和 "PYTHONPATH"。对于基于 Linux 的系统,我还必须取消设置或删除 (del) "PATH" 环境变量。
按照上述步骤后,Splunk 使用了我本地版本的 Python 和安装的模块。它奏效了。希望这可以帮助任何试图在 Splunk 中使用外部模块但似乎无法弄清楚为什么它不起作用的人。 :)
我正尝试在 Splunk 上 运行 外部 python 脚本 "PyClient.py",它需要外部 gRPC 模块。我按照 http://www.grpc.io/docs/quickstart/python.html 的快速入门 python 指南在本地安装了 gRPC 模块。 splunkd文件中产生的日志如下:
06-16-2017 18:20:49.728 +0530 WARN IntrospectionGenerator:resource_usage - RU - Failure executing PDH query, skipping getting iostats data this collection cycle. Status code is -2147481643
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" Traceback (most recent call last):
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py", line 2, in <module>
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" import grpc
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\grpc\__init__.py", line 37, in <module>
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" from grpc._cython import cygrpc as _cygrpc
06-16-2017 18:20:56.501 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" Traceback (most recent call last):
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py", line 2, in <module>
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" import grpc
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" File "C:\Program Files\Splunk\etc\apps\Test\bin\grpc\__init__.py", line 37, in <module>
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" from grpc._cython import cygrpc as _cygrpc
06-16-2017 18:21:06.502 +0530 ERROR ExecProcessor - message from "python "C:\Program Files\Splunk\etc\apps\Test\bin\pyClient.py"" ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
有人对如何清除此错误有任何建议吗?或者如何在Splunk上安装外部gRPC模块?
提前致谢。
这看起来像是 32/64 位 Windows 不兼容。
安装 gRPC 时,请确保您明确使用 Python 到 pip install grpcio
的 Splunk 分布。
C:\Program Files\Splunk\<Python2.7 binary> -m pip install --upgrade pip
C:\Program Files\Splunk\<Python2.7 binary> -m pip install grpcio
我已经找到了解决方案。我必须为我的 python 脚本编写一个包装脚本,该脚本取消设置或删除 (del) "LD_LIBRARY_PATH" 和 "PYTHONPATH"。对于基于 Linux 的系统,我还必须取消设置或删除 (del) "PATH" 环境变量。 按照上述步骤后,Splunk 使用了我本地版本的 Python 和安装的模块。它奏效了。希望这可以帮助任何试图在 Splunk 中使用外部模块但似乎无法弄清楚为什么它不起作用的人。 :)