Skip to main content

Python API for the Linux /proc virtual filesystem

Project description

Easy to use

>>> from procfs import Proc
>>> proc = Proc()

>>> proc.loadavg
{'average': {1: 0.0, 5: 0.0, 15: 0.0},
 'entities': {'current': 1, 'total': 117},
  'last_pid': 3068}

>>> proc.net.dev.eth1.receive.bytes
117997558

>>> proc.meminfo.MemFree
57044

>>> proc.net.snmp.Udp
{'InDatagrams': 3394, 'OutDatagrams': 3399, 'RcvbufErrors': 0,
 'InErrors': 0, 'SndbufErrors': 0, 'NoPorts': 4}

Process information

>>> proc.self
<Process 3068: python>

>>> proc.self.parent
<Process 17423: bash>

>>> proc.self.uptime
datetime.timedelta(0, 346, 380262)

>>> proc.processes
<Processes: [<Process 1: init>, <Process 2: kthreadd>, <Process 3: migration/0>, <Process 4: ksoftirqd/0>, <Process 5: watchdog/0>, <Process 6: migration/1>, <Process 7: ksoftirqd/1>, <Process 8: watchdog/1>, <Process 9: events/0>, <Process 10: events/1>, ...]>
>>> len(proc.processes)
110

>>> proc.processes.cmdline('(vim|ssh)')
<Processes: [<Process 2956: vim>, <Process 3044: vim>, <Process 3136: vim>, <Process 10422: sshd>, <Process 10440: sshd>, <Process 10504: sshd>]>

>>> proc.processes.uid(1000)
<Processes: [<Process 1120: bash>, <Process 2593: bash>, <Process 2956: vim>, <Process 3044: vim>, <Process 3093: python>, <Process 10504: sshd>, <Process 10505: bash>, <Process 10875: screen>, <Process 10876: screen>, <Process 12908: bash>, ...]>

>>> proc.processes.user('pmuller').cmdline('python')[0]
<Process 3093: python>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

procfs-0.2.0.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file procfs-0.2.0.tar.gz.

File metadata

  • Download URL: procfs-0.2.0.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for procfs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a791ce20a7cb5cb1d8397599e65fc5594c9f29bf80922a5c917db92583410356
MD5 fa232161815f3c5c3eaf60f73788f62a
BLAKE2b-256 1a9c935fe8bccf718e8809055d151fc0cb9eb8ad56e178077e6562e18daf52b3

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page