When I ran the python script the above error throwing as shown in the screen shot. Installed python3 on the environment. Could some help me with the same.
Hi team,
Finally cracked it.
Step -1
Might have to add environment variables for Splunk and check whether are you able to run Splunk command globally.
Step -2
Import the proper module related to the script.
Example:-
The below screen shot indicates the error.
to resolve the above issue below module need to import
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
Post importing the module the issue resolved
Thanks & Regards,
Reddi.
Hi richgalloway,
I ran it but no positive sign. I am unable to understand where am I missing
Hi @Reddi694325 ,
you are running the command in /opt/splunk/bin .But the script was exist in /opt/splunk/etc/apps/cybearreasonforsplunk/bin directory.
Run the command in /opt/splunk/etc/apps/cybearreasonforsplunk/bin/splunk cmd python cybereason.py
And see whether its works or not.
Hi Vardhan,
In the previous case I ran in both the places like from Splunk_Home/bin and from App/Bin. For better understanding I ran the command as you suggested and the screenshot is pasted here. Kindly check and help me with the same.
Thanks In Advance.
Thanks & Regards,
Reddy.
Hi team,
Finally cracked it.
Step -1
Might have to add environment variables for Splunk and check whether are you able to run Splunk command globally.
Step -2
Import the proper module related to the script.
Example:-
The below screen shot indicates the error.
to resolve the above issue below module need to import
from splunk.appserver.mrsparkle.lib.util import make_splunkhome_path
Post importing the module the issue resolved
Thanks & Regards,
Reddi.
Hi,
The issue got resolved by adding Splunk home path in environment variables. But another problem started as shown below.
[root@Searchhead2 bin]# vi cybereason.py
[root@Searchhead2 bin]# splunk cmd python cybereason.py
Traceback (most recent call last):
File "cybereason.py", line 25, in <module>
_SPLUNK_HOME = make_splunkhome_path([""])
NameError: name 'make_splunkhome_path' is not defined
[root@Searchhead2 bin]#
Could some one let me know what is the error related to.
I understood like we need to define make_splunk_home_path. But don't know where to define.
Kindly help me with the same.
Thanks & Regards,
Reddi
There's no need to install Python 3 because it comes with Splunk Enterprise. Be sure to run the scripts that come with apps in the Splunk environment.
splunk cmd python cybereason.py