All Apps and Add-ons

serverinfo.py on Solaris x86 server

Communicator

Hi,

running SoS on a Solaris x86 search generates some errors in the serverinfo.py script.

**************
command="serverinfo", Error '[Errno 2] No such file or directory'. Traceback (most recent call last): File "/appl/splunk/etc/apps/sos/bin/serverinfo.py", line 90, in "total_phys_mem_gb" : meminfo(), File "/appl/splunk/etc/apps/sos/bin/serverinfo.py", line 32, in meminfo pseudohandle = subprocess.Popen(["system_profiler", "SPHardwareDataType"], shell=False, stdout=subprocess.PIPE) File "/appl/splunk/lib/python2.6/subprocess.py", line 621, in init errread, errwrite) File "/appl/splunk/lib/python2.6/subprocess.py", line 1126, in execute_child raise child_exception OSError: [Errno 2] No such file or directory
[psplka006] command="serverinfo", Error '[Errno 2] No such file or directory'. Traceback (most recent call last): File "/appl/splunk/var/run/searchpeers/pspka028-1325238061/apps/sos/bin/serverinfo.py", line 90, in "total_phys_mem_gb" : meminfo(), File "/appl/splunk/var/run/searchpeers/pspka028-1325238061/apps/sos/bin/serverinfo.py", line 32, in meminfo pseudohandle = subprocess.Popen(["system_profiler", "SPHardwareDataType"], shell=False, stdout=subprocess.PIPE) File "/appl/splunk/lib/python2.6/subprocess.py", line 621, in __init
_ errread, errwrite) File "/appl/splunk/lib/python2.6/subprocess.py", line 1126, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory
****************

Do you plan to fix this or should we do it ourselves?

cheers,
Andy

1 Solution

Splunk Employee
Splunk Employee

Thank you for reporting this error! I have opened a bug against the app (SUP-384) and added it to the known issues for the 2.0 release of the SoS app.

I have added the following code to serverinfo.py in order to report physical memory size on Solaris systems by means of prtconf:


if sys.platform.startswith("sun"):
try:
pseudohandle = subprocess.Popen(["prtconf"], shell=False, stdout=subprocess.PIPE)
stdout, stderr = pseudohandle.communicate()
TotalPhys_re = re.compile(r'^Memory size:\s+(\d+)\s+Megabytes')


for line in stdout.splitlines():
TotalPhys_match = TotalPhys_re.match(line)
if TotalPhys_match:
TotalPhys = int(round(float(TotalPhys_match.group(1))/1024))
except:
TotalPhys = "not available"

This fix would be integrated in the next release of SoS. In the meantime, you can try this modified version of serverinfo.py to replace $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py, which should resolve your issue.

  • Get a copy of the modified version of serverinfo.py. You'll have to use your splunk.com credentials to download this file.
  • Make a backup of your original serverinfo.py:
    cp $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py.old
  • Copy the modified serverinfo.py file in place:
    cp serverinfo_SUP-384.py $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py
    • Hit the SoS app home view again @ http[s]://:/app/sos/home

You should no longer see any error banners in the Home view indicating that the serverinfo command disgracefully failed.

Let me know if it works or if you have any suggestions to determine the system physical memory on a Solaris system using different code.

View solution in original post

0 Karma

Splunk Employee
Splunk Employee

Thank you for reporting this error! I have opened a bug against the app (SUP-384) and added it to the known issues for the 2.0 release of the SoS app.

I have added the following code to serverinfo.py in order to report physical memory size on Solaris systems by means of prtconf:


if sys.platform.startswith("sun"):
try:
pseudohandle = subprocess.Popen(["prtconf"], shell=False, stdout=subprocess.PIPE)
stdout, stderr = pseudohandle.communicate()
TotalPhys_re = re.compile(r'^Memory size:\s+(\d+)\s+Megabytes')


for line in stdout.splitlines():
TotalPhys_match = TotalPhys_re.match(line)
if TotalPhys_match:
TotalPhys = int(round(float(TotalPhys_match.group(1))/1024))
except:
TotalPhys = "not available"

This fix would be integrated in the next release of SoS. In the meantime, you can try this modified version of serverinfo.py to replace $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py, which should resolve your issue.

  • Get a copy of the modified version of serverinfo.py. You'll have to use your splunk.com credentials to download this file.
  • Make a backup of your original serverinfo.py:
    cp $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py.old
  • Copy the modified serverinfo.py file in place:
    cp serverinfo_SUP-384.py $SPLUNK_HOME/etc/apps/sos/bin/serverinfo.py
    • Hit the SoS app home view again @ http[s]://:/app/sos/home

You should no longer see any error banners in the Home view indicating that the serverinfo command disgracefully failed.

Let me know if it works or if you have any suggestions to determine the system physical memory on a Solaris system using different code.

View solution in original post

0 Karma

Splunk Employee
Splunk Employee

FYI this has been fixed in SoS 2.1 which is now live.

Splunk Employee
Splunk Employee

Thank you for the confirmation, I'll greenlight this fix into the SoS 2.1 code.

0 Karma

Communicator

Hi,
works just perfect. Thanks a lot,

andy