shanecode / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

psutil will not work inside a solaris 10 zone #425

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. compile psutil on solaris 10
2. try to import it in a script running inside a solaris zone
3. profit?

What is the expected output?

it should just work :)

What do you see instead?

Traceback (most recent call last):
  File "./monTest.py", line 9, in <module>
    import psutil
  File "/ifs/prod/home/notch/graphiteClient/psutil/__init__.py", line 101, in <module>
    import psutil._pssunos as _psplatform
  File "/ifs/prod/home/notch/graphiteClient/psutil/_pssunos.py", line 27, in <module>
    BOOT_TIME = _psutil_sunos.get_process_basic_info(0)[3]
OSError: [Errno 2] No such file or directory: '/proc/0/psinfo'

What version of psutil are you using? What Python version?

psutil 1.0.1
python 2.6.4 (solaris default)

On what operating system? Is it 32bit or 64bit version?

64 bit

Please provide any additional information below.

_pssunos.py uses psutil itself to figure out the current boot time so it can 
set the BOOT_TIME global. Unfortunately it does it by trying to read /proc/0 
which is only available in the global zone.  

there's probably an ugly way to use psrinfo(1M) or another way to get the boot 
time of the server from inside a zone.

I haven't checked to see if there are any other methods that don't work inside 
the zone either, this was the first one I ran across during initialization

Original issue reported on code.google.com by manch...@gmail.com on 9 Sep 2013 at 3:19

GoogleCodeExporter commented 9 years ago
I figured out a way around this, by hacking up _pssunos.py to get the PID of 
the lowest processID either named "sched" for the global zones or "zsched" for 
the zones themselves and using that pid to determine the boot time.

I'm a novice python programmer, so this code is probably ugly and someone will 
want to rewrite it, but its working for me so it may well work for you.

Original comment by manch...@gmail.com on 10 Sep 2013 at 6:19

Attachments:

GoogleCodeExporter commented 9 years ago
Sorry, I kind of forgot about this issue.
Note to self: 
http://stackoverflow.com/questions/1661006/getting-the-uptime-of-a-sunos-unix-bo
x-in-seconds-only
I'll try to take a look at this later.

Original comment by g.rodola on 22 Nov 2013 at 9:44

GoogleCodeExporter commented 9 years ago
This is now fixed in revision dab1ed90f8d5.

Original comment by g.rodola on 25 Nov 2013 at 6:39

GoogleCodeExporter commented 9 years ago
Closing.

Original comment by g.rodola on 26 Nov 2013 at 8:52

GoogleCodeExporter commented 9 years ago

Original comment by g.rodola on 26 Nov 2013 at 8:52