I am trying to run an external python script "PyClient.py" on Splunk, and it requires the external gRPC module. I installed the gRPC module locally following the quickstart python guide from http://www.grpc.io/docs/quickstart/python.html . The logs generated in the splunkd file are as follows:
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.
Does anyone have any suggestions on how to clear this error? Or how to install the external gRPC module on Splunk?
Thanks in advance.
I already found the solution. I had to write a wrapper script for my python script which which unset or delete (del) "LD_LIBRARY_PATH" and "PYTHONPATH". For Linux based systems, I also had to unset or delete (del) the "PATH" environment variable. After following the above steps, Splunk used my local version of Python and the installed modules as well. And it worked. Hope this helps anyone who is trying to use external modules in Splunk but cannot seem to figure out why it does not work. :)