Maria
Maria

Reputation: 117

How to get several information about server

I write an app/copy/clone of this app which gets information about my server to display in my app. I have no idea how to get some of the info for eg. with python

  1. name of connection

  2. time and date when the server was connected/started

    I used here module datetime

     now = datetime.datetime.now()
     strftime("%Y-%m-%d %H:%M:%S")
    

    But I think it's not that information when the server was connected or started

  3. kernel time

  4. user time

  5. address workstation/address TE

  6. Is address NAT just an IP address? If yes I got it with module socket, it can be get with command ipconfig in cmd.exe

Upvotes: 0

Views: 69

Answers (1)

Daniel Ocando
Daniel Ocando

Reputation: 3784

You can take a look at the psutil module and use cpu_times() function to get the kernel and user time and all the network related functions in order to get the network related data that you need to monitor.

Additionally you can take a look at the subprocess module in order to run the OS specific commands you would usually issue in order to get the metrics you require from the server (e.g. running ipconfig as you suggest although using socket will also be a good idea as explained on this other post).

Upvotes: 1

Related Questions