Skip to main content

Network and Disk I/O Stats Monitor

Project description

iometrics

Python

Network and Disk I/O Stats Monitor.

Usage

Monitor and log Network and Disks statistics in MegaBytes per second.

Pytorch-lightning integration

from pytorch_lightning import Trainer
from iometrics.pytorch_lightning.callbacks import NetworkAndDiskStatsMonitor

net_disk_stats = NetworkAndDiskStatsMonitor()

trainer = Trainer(callbacks=[net_disk_stats])

Metrics generated:

  • network/recv_MB_per_sec – Received MegaBytes per second (MB/s) on all relevant network interfaces as a SUM.
  • network/sent_MB_per_sec – Sent MegaBytes per second (MB/s) on all relevant network interfaces as a SUM.
  • disk/util% – Disk utilization percentage as the average of all disk devices.
  • disk/read_MB_per_sec – Disks read MB/s as the sum of all disk devices.
  • disk/writ_MB_per_sec – Disks written MB/s as the sum of all disk devices.
  • disk/io_read_count_per_sec – Disks read I/O operations per second as the sum of all disk devices.
  • disk/io_writ_count_per_sec – Disks written I/O operations per second as the sum of all disk devices.

Pure-Python implementation (zero dependencies)

Quick check

python -c 'from iometrics.example import usage; usage()'

Example output

|        Network (MBytes/s)       | Disk Util |            Disk MBytes          |           Disk I/O          |
|     Received    |     Sent      |     %     |    MB/s Read    |  MB/s Written |     I/O Read    | I/O Write |
|   val  |   avg  |  val  |  avg  | val | avg |  val   |  avg   |  val  |  avg  |   val  |   avg  | val | avg |
| ------:| ------:| -----:| -----:| ---:| ---:| ------:| ------:| -----:| -----:| ------:| ------:| ---:| ---:|
|    4.6 |    3.5 |   0.1 |   0.1 |  49 |   2 |   52.8 |    1.1 |   0.0 |   0.9 |    211 |      4 |   5 |  18 |
|    4.1 |    3.5 |   0.1 |   0.1 |  61 |   3 |   60.4 |    2.4 |  40.3 |   1.7 |    255 |     10 | 149 |  21 |

Full code

import time
from iometrics import NetworkMetrics, DiskMetrics
from iometrics.example import DUAL_METRICS_HEADER
net  = NetworkMetrics()
disk = DiskMetrics()
for i in range(100):
    time.sleep(1)
    net.update_stats()
    disk.update_stats()
    if i % 15 == 0:
        print(DUAL_METRICS_HEADER)
    row = (
        f"| {net.mb_recv_ps.val:6.1f} | {net.mb_recv_ps.avg:6.1f} "
        f"| {net.mb_sent_ps.val:5.1f} | {net.mb_sent_ps.avg:5.1f} "
        f"| {int(disk.io_util.val):3d} | {int(disk.io_util.avg):3d} "
        f"| {disk.mb_read.val:6.1f} | {disk.mb_read.avg:6.1f} "
        f"| {disk.mb_writ.val:5.1f} | {disk.mb_writ.avg:5.1f} "
        f"| {int(disk.io_read.val):4d} | {int(disk.io_read.avg):4d} "
        f"| {int(disk.io_writ.val):3d} | {int(disk.io_writ.avg):3d} "
        f"|"
    )
    print(row)

Contributing

See CONTRIBUTING.md

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

iometrics-0.0.3.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

iometrics-0.0.3-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file iometrics-0.0.3.tar.gz.

File metadata

  • Download URL: iometrics-0.0.3.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.11 Linux/5.11.0-25-generic

File hashes

Hashes for iometrics-0.0.3.tar.gz
Algorithm Hash digest
SHA256 c5b26a0219bf7bba34b191e0f619ab24b1610e07242ba91e0bd92d4413ea9087
MD5 11f65c9099dfe745b0b9c06360848811
BLAKE2b-256 10e1484960742ac10b8e24ab32b1111827f3a0870df9a70be10c30465354b18a

See more details on using hashes here.

File details

Details for the file iometrics-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: iometrics-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.11 Linux/5.11.0-25-generic

File hashes

Hashes for iometrics-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5054e2c69074c37a7ec590f6c6a3b0f1dbb87bfa094e616864a6c4d5ccbadf23
MD5 c090e8ca56cea9a63fdce3ace873c340
BLAKE2b-256 a17b63ca2989ff3b94ad19fa1307ccae6f54dc0d03bc39fed6f87ec48f4c5cdf

See more details on using hashes here.

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