No description
Find a file
TechnoFox a793440b66 added pid_kill proc
added the pid_kill proc to the psutil.nim file, also exporting the platform so user can access all the function without needing to do "psutil/platform_linux" or "psutil/platform_windows"
2022-03-18 14:11:09 +01:00
.github Create FUNDING.yml 2019-05-26 02:25:05 -03:00
doc Create DiskPartition.md 2022-03-15 14:45:52 +01:00
scripts update gitignore for exes on windows 2019-10-06 17:03:23 -04:00
src added pid_kill proc 2022-03-18 14:11:09 +01:00
tests fixed typo 2021-02-05 17:48:56 +00:00
.gitignore update gitignore files 2016-11-22 08:01:16 -05:00
LICENSE 0.20.0 2019-06-06 15:41:16 -03:00
psutil.nimble Update psutil.nimble 2020-08-20 20:51:34 +00:00
README.md 0.20.0 2019-06-06 15:41:16 -03:00

Psutil-Nim

Port of Python psutil to Nim.

Pull requests with bug fixes and support for other platforms are welcome!

Table of Contents

Background

I love Python and psutil but bundling a Python app is a pain. Having a psutil library in Nim seemed like the logical next step.

Install

  • nimble install psutil

This package currently only works on Linux. This package has some Deprecation warnings but works Ok as of Nim 0.20. Pull requests welcome.

Usage

Just some basic usage below until I get the example apps working and can mirror what's in psutil's documentation. Take a look at the scripts folder for some basic examples as well.

import psutil

echo net_if_addrs()
echo boot_time()
echo users()

Troubleshooting

If you are running on CentOS or RedHat you may or may not find errors with the Network related functions, complaining about missing Linux C Headers sockios.h to Compile, this is not a Bug on the code but that Distro not having development libraries or having too old versions of it.

You can try installing the package kernel-headers for CentOS/RedHat, to see if that fixes the problem about missing libraries.

If you know how to fix that Distro-specific detail feel free to send pull requests.

The failing functions are:

net_io_counters()
per_nic_net_io_counters()
net_if_stats()
net_connections()

You can workaround by using Distros module:

when not detectOs(CentOS):
  # Do something here with the Network functions.
  echo net_io_counters()
  echo per_nic_net_io_counters()
  echo net_if_stats()
  echo net_connections()

Contribute

PRs accepted! Adding a single function to any platform is a huge help and can usually be done with less than an hour of work.

License

  • MIT