Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:12:12+00:00 2026-06-15T12:12:12+00:00

I am trying to collect system stats using python. Mostly looking for a libery

  • 0

I am trying to collect system stats using python. Mostly looking for a libery or github project that does this already. I am looking to be able to collect/log the following things.

  • CPU Usage and or Load average
  • Disk Free space
  • Disk IO thoughput
  • Ram usage (Free, Active, Cached)
  • Network IO
  • Bandwidth Usaged
  • Uptime
  • Anything else useful in server monitoring.

Edit:
I am mostly looking for support in Linux systems I will move on to windows systems later.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:12:13+00:00Added an answer on June 15, 2026 at 12:12 pm

    Try using the psutil module here, take a look at the example shown. However, for DISK IO you might have to use the wmi and the pywin32 modules.

    For example, for DISK QUEUE LENGTH with windows use this:

    from win32pdh import *
    import time
    
    while True:
        path = MakeCounterPath((None,"PhysicalDisk","_Total",None,0,"Avg. Disk Queue Length"),0)
        query_handle = OpenQuery()
        counter_handle = AddCounter(query_handle, path)
        query_handle = OpenQuery()
        counter_handle = AddCounter(query_handle, path)
        CollectQueryData(query_handle)
        time.sleep(2)
        CollectQueryData(query_handle)
        (counter_type, value) = GetFormattedCounterValue(counter_handle, PDH_FMT_DOUBLE)
        print value
        CloseQuery(query_handle)
    

    It uses the counters of the perfmon app on windows. For linux, there are multiple tools for DISK IO.

    For linux DISK IO check out iotop here

    Also, example of Linux diskstats use this, it periodically parses /proc/diskstats

    def diskstats_parse(dev=None):
        file_path = '/proc/diskstats'
        result = {}
    
        # ref: http://lxr.osuosl.org/source/Documentation/iostats.txt
        columns_disk = ['m', 'mm', 'dev', 'reads', 'rd_mrg', 'rd_sectors',
                        'ms_reading', 'writes', 'wr_mrg', 'wr_sectors',
                        'ms_writing', 'cur_ios', 'ms_doing_io', 'ms_weighted']
    
        columns_partition = ['m', 'mm', 'dev', 'reads', 'rd_sectors', 'writes', 'wr_sectors']
    
        lines = open(file_path, 'r').readlines()
        for line in lines:
            if line == '': continue
            split = line.split()
            if len(split) == len(columns_disk):
                columns = columns_disk
            elif len(split) == len(columns_partition):
                columns = columns_partition
            else:
                # No match
                continue
    
            data = dict(zip(columns_disk, split))
            if dev != None and dev != data['dev']:
                continue
            for key in data:
                if key != 'dev':
                    data[key] = int(data[key])
            result[data['dev']] = data
    
        return result
    

    I hope this helps. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are trying to collect data on each person that used a certain coupon
I'm trying to find and collect all the elements that meet these requirements: var
I'm trying to compile a Python program using PyInstaller. When I try to use
I am trying to compile a project using boost and rtmidi. However I keep
I know this indicates a linker problem, mostly unresolved symbols. I know that to
I am trying to compile a linear system solver using PARDISO . The test
I am trying to use reflection to collect a property from a class that
I am trying to suspend my system using a c++ program using SetSuspendState method
I am trying to build a search system and retrieving matching records. in this
I am trying to collect some data from multiple subsets of a data set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.