Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psutil will not work inside a solaris 10 zone #425

Closed
giampaolo opened this issue May 23, 2014 · 5 comments
Closed

psutil will not work inside a solaris 10 zone #425

giampaolo opened this issue May 23, 2014 · 5 comments

Comments

@giampaolo
Copy link
Owner

From manch...@gmail.com on September 09, 2013 05:19:44

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: http://code.google.com/p/psutil/issues/detail?id=425

@giampaolo
Copy link
Owner Author

From manch...@gmail.com on September 10, 2013 11:19:40

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.

Attachment: psutil-solaris-zones.diff

@giampaolo
Copy link
Owner Author

From g.rodola on November 22, 2013 13:44:08

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

Labels: -Priority-Medium Priority-High OpSys-Solaris

@giampaolo
Copy link
Owner Author

From g.rodola on November 25, 2013 10:39:13

This is now fixed in revision dab1ed90f8d5 .

Status: FixedInHG
Labels: Milestone-1.2.1

@giampaolo
Copy link
Owner Author

From g.rodola on November 26, 2013 00:52:33

Closing.

@giampaolo
Copy link
Owner Author

From g.rodola on November 26, 2013 00:52:51

Status: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant