Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am working on a project for which I need to create a Python class which can determine underlying OS on which it is running and performs a sequence of checks if OS is found to be Windows Server 2003/2008.

Currently my check includes following parameters:

  1. CPU Utilization Check
  2. RAM Utilization Check
  3. HD Volume space available
  4. Well configured network parameters like DNS and DHCP
  5. RDP and other critical application services running

For 1 to 3 information can be extracted from Windows Task Manager BUT the question in HOW ?

For 4, ipconfig /all output would be fine and I think I would be able to extract them either from some python modules or regex ! (Believe me I am not sure)

For 5, I think I should use powershell trimmed Get-Services output.

I look foreward to seek help on points 1 to 3

  1. How can I extract this information from windows machine ?
  2. How can I use that information for further processing in Python ?

Apart from this any type of suggestion/query/improvements/known issues are most welcome.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Give this a look for parts 1, 2 and 3: http://code.google.com/p/psutil/

As for network parameters, you might have a bit better luck with parsing the output from the following command: netsh interface ipv4 show config for interface configuration and DNS. However you can also try this: http://alastairs-place.net/projects/netifaces/ It doesn't give very friendly interface names on Windows but works. However I don't think it shows whether you're using DHCP or what you're using for DNS.

Lastly for 5 there is http://code.activestate.com/recipes/303339/ but it is unhelpfully only processes. There's a WMI Python module that can provide service information however: http://timgolden.me.uk/python/wmi/index.html

share|improve this answer
    
Thanks @Brayden ! I am working on with links suggested. –  Avi Mehenwal Feb 20 '13 at 6:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.