Code Monkey home page Code Monkey logo

sysmon's Introduction


Linux activity monitor

Key FeaturesGetting Started

Key features

forthebadge made-with-python

Graphical visualization of the following data:

  • CPU utilization and per core clock speed

  • GPU utilization and clock speed (so far only Nvidia). Should work with multiple GPUs (not tested)

  • Memory and Swap utilization

  • Network utilization (Wlan and Ethernet). Wlan link bandwidth is constantly updated.

  • HDD/SSD utilization.

You can also see an overview of running processes.

Getting Started

I wanted to have a graphical visualization of the load of most physical devices. The system monitor in ubuntu does a great job, but is not displaying HDD and SDD load as well as no GPU load. This tools brings all the information together to one place, similar to task manager in windows.

1. Installation and run

Just simply

pip install sysmon

To run the program, just simply run in your cmd line

sysmon

If you want to monitor your Nvidia GPU, nvidia-smi has to be installed.

Probably you want some shortcut, you can do this with alacarte.

2. Data origin

Most data comes from the /proc directory.

In more detail:

  • CPU: /proc/cpuinfo and /proc/stat
  • Memory: /proc/meminfo
  • Disks: /proc/diskstats
  • Network: /proc/net/dev and iwconfig(Wlan)
  • GPU: nvidia-smi (if Nvidia GPU)
  • Processes: 'ps -aux'

I this choice of data source makes the program usable across multiple linux distributions. (Only tested on Ubuntu 18.04 and 20.04)

3. To do

  • Include support for Intel and AMD GPUs. I don't have any of these GPUs, so unfortunately I can't test it. Maybe I can get my hands on any of these GPUs in the future.

  • Add more information about Wlan connection. (Signal strength etc.)

  • Maybe add public and private IP address somewhere

  • Add more GPU information (Process overview)

  • Add GUI menu to modify parameters such as update interval, capture period etc.

  • Add iowait for each CPU core

  • Add more detailed Memory information (buffer and cache)

  • CPU clock: Sometimes clock for threads on same physical core differ --> I think this is in reality not possible. Maybe calculate average per physical core. Also group threads belonging to the same physical core together and "bond" visually.

  • Add dark mode

  • Make a C/C++ port (probably lower hardware requirements, even though CPU load is low.)

  • Remove Swap entry if no swap is used

  • Remove 'ps -aux' references

  • Add kill button and sort

License

Please see LICENSE file.

sysmon's People

Contributors

fayaaz avatar krateng avatar matthiasschinzel avatar normanr avatar scottwedge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sysmon's Issues

Doesnt Work under openSUSE Tumbleweed KDE

I tried the README.md Instructions to install your tool, but it didn't work.

bash: cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20201005"

Tested Python 2.7.18:

bash: python2 sysmon.py 
Traceback (most recent call last):
  File "sysmon.py", line 1, in <module>
    from PyQt5 import QtWidgets, uic
ImportError: No module named PyQt5

and Python 3.8.5:

bash: python3 sysmon.py 
/bin/sh: iwconfig: command not found
Traceback (most recent call last):
  File "sysmon.py", line 593, in <module>
    main()
  File "sysmon.py", line 587, in main
    main = MainWindow()
  File "sysmon.py", line 101, in __init__
    self.s = sysinfo()
  File "/home/$USER/GitExtern/sysmon/src/gather_data.py", line 59, in __init__
    self.get_max_connection_speed()
  File "/home/$USER/GitExtern/sysmon/src/gather_data.py", line 263, in get_max_connection_speed
    self.max_connection_speed.append(processes[-1].split()[1]
IndexError: list index out of range

PIP Output:

bash: pip install pyqtgraph pyqt5
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pyqtgraph in /usr/local/lib/python3.8/site-packages (0.11.0)
Requirement already satisfied: pyqt5 in /usr/local/lib64/python3.8/site-packages (5.15.1)
Requirement already satisfied: numpy>=1.8.0 in /usr/local/lib64/python3.8/site-packages (from pyqtgraph) (1.19.2)
Requirement already satisfied: PyQt5-sip<13,>=12.8 in /usr/local/lib64/python3.8/site-packages (from pyqt5) (12.8.1)

Network usage breakdown

Looks like a great start!

My two cents:
Something that is currently missing from all GUI system monitors in Linux (but exists at a limited level in Win10) - a real, working and useful network usage breakdown:

  1. Per process (matching the current process list)
  2. Per process group (e.g., container)
  3. Per connection target (e.g., "facebook.com")

Also, a display of all registered sockets/handles (lsof style) in their current state, broken down to process or target, would be very useful.

Dark Mode

Don't want to overload you with issues, this is of course not a priority - but sysmon kinda sticks out as super-bright among all my other dark windows :D A dark grey / blackish background with white text and yellow / beige graphs or something similar would be much appreciated.

Thank you!

Exception in function `get_max_connection_speed`

Hi!

I tried to run sysmon, but it does not open because of an IndexError: list index out of range exception.

The traceback is:

Traceback (most recent call last):
  File "sysmon.py", line 595, in <module>
    main()
  File "sysmon.py", line 589, in main
    main = MainWindow()
  File "sysmon.py", line 102, in __init__
    self.s = sysinfo()
  File "/home/angie/Software/sourcecode/sysmon/src/gather_data.py", line 59, in __init__
    self.get_max_connection_speed()
  File "/home/angie/Software/sourcecode/sysmon/src/gather_data.py", line 271, in get_max_connection_speed
    self.max_connection_speed.append(processes[-1].split()[1]
IndexError: list index out of range

Other details:

  • OS: Pop!_OS 20.04 LTS
  • Python 3.8.2
  • Command used: python3 sysmon.py

Also, i did install the dependencies as stated on the Readme.md and nvidia-smi is installed on the system.

If you need more info, just ask.

Bye c:

iwconfig: command not found

Hi @MatthiasSchinzel ,

I am having this error on opensuse tumblweed kde5 plasma v5.19.5

python3 sysmon.py 
/bin/sh: iwconfig: command not found
Traceback (most recent call last):
  File "sysmon.py", line 593, in <module>
    main()
  File "sysmon.py", line 587, in main
    main = MainWindow()
  File "sysmon.py", line 101, in __init__
    self.s = sysinfo()
  File "/home/hamad/Downloads/sysmon/src/gather_data.py", line 59, in __init__
    self.get_max_connection_speed()
  File "/home/hamad/Downloads/sysmon/src/gather_data.py", line 263, in get_max_connection_speed
    self.max_connection_speed.append(processes[-1].split()[1]
IndexError: list index out of range

On my system I am able to run sudo iwconfig only as root

I have an error..

$ pip install sysmon

$ sysmon

Traceback (most recent call last):
File "/home/username/.local/bin/sysmon", line 8, in
sys.exit(main())
File "/home/username/.local/lib/python3.10/site-packages/sysmon/sysmon.py", line 607, in main
main = MainWindow()
File "/home/username/.local/lib/python3.10/site-packages/sysmon/sysmon.py", line 119, in init
header.setResizeMode(QtGui.QHeaderView.ResizeToContents)
AttributeError: 'QHeaderView' object has no attribute 'setResizeMode'. Did you mean: 'ResizeMode'?

i try uninstall it and use "pip3 install sysmon", but i have this error again.

IndexError: index 4 is out of bounds for axis 0 with size 4

$ python3 sysmon.py 
Traceback (most recent call last):
  File "sysmon.py", line 613, in <module>
    main()
  File "sysmon.py", line 607, in main
    main = MainWindow()
  File "sysmon.py", line 111, in __init__
    self.plot_cpuinfo()
  File "sysmon.py", line 250, in plot_cpuinfo
    self.cpuinfo[-1, :] = self.s.refresh_stat() * 100
  File "/home/normanr/src/sysmon/src/gather_data.py", line 363, in refresh_stat
    self.get_cpu_clock_speed()
  File "/home/normanr/src/sysmon/src/gather_data.py", line 221, in get_cpu_clock_speed
    self.cpu_clock[id] = int(process)
IndexError: index 4 is out of bounds for axis 0 with size 4

For reasons I don't 100% understand: hyper-threading gets disabled when I suspect my laptop (at least I think that's the cause). Here's is the relevant content from /proc:

$ grep cpu /proc/stat
cpu  34033640 1471565 10952807 109402392 849655 0 2428715 0 0 0
cpu0 8490780 365253 2703973 54197827 470961 0 884506 0 0 0
cpu1 8481464 364768 2779510 15137870 125679 0 672644 0 0 0
cpu2 8494726 367270 2686477 15116227 125507 0 530925 0 0 0
cpu3 8536774 371814 2769030 15122729 126505 0 340520 0 0 0
$ grep ^ /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:654043
/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq:753403
/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq:792496
/sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq:785235
/sys/devices/system/cpu/cpu4/cpufreq/scaling_cur_freq:2100262
/sys/devices/system/cpu/cpu5/cpufreq/scaling_cur_freq:2100005
/sys/devices/system/cpu/cpu6/cpufreq/scaling_cur_freq:2100014
/sys/devices/system/cpu/cpu7/cpufreq/scaling_cur_freq:2100004
$ grep ^ /sys/devices/system/cpu/cpu*/cpufreq/affected_cpus 
/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus:0
/sys/devices/system/cpu/cpu1/cpufreq/affected_cpus:1
/sys/devices/system/cpu/cpu2/cpufreq/affected_cpus:2
/sys/devices/system/cpu/cpu3/cpufreq/affected_cpus:3
/sys/devices/system/cpu/cpu4/cpufreq/affected_cpus:
/sys/devices/system/cpu/cpu5/cpufreq/affected_cpus:
/sys/devices/system/cpu/cpu6/cpufreq/affected_cpus:
/sys/devices/system/cpu/cpu7/cpufreq/affected_cpus:

QHeaderView object has no attribute setResizeMode. Did you mean: ResizeMode?

Hello, I'm using Linux Mint 21 Cinnamon which is based on ubuntu 22.04 but when I try to run sysmon, installed with pip install sysmon, the following error occurs:

username@laptop:~$ sysmon
Traceback (most recent call last):
  File "/home/username/.local/bin/sysmon", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/lib/python3.10/site-packages/sysmon/sysmon.py", line 607, in main
    main = MainWindow()
  File "/home/username/.local/lib/python3.10/site-packages/sysmon/sysmon.py", line 119, in __init__
    header.setResizeMode(QtGui.QHeaderView.ResizeToContents)
AttributeError: 'QHeaderView' object has no attribute 'setResizeMode'. Did you mean: 'ResizeMode'?

How can I help you debug this issue? Many thanks in advance,

username@laptop:~$ pip show sysmon
Name: sysmon
Version: 1.0.1
Summary: System Monitor for Linux
Home-page: https://github.com/MatthiasSchinzel/sysmon
Author: Matthias Schinzel
Author-email: [email protected]
License: UNKNOWN
Location: /home/username/.local/lib/python3.10/site-packages
Requires: numpy, pyqt5, pyqtgraph
Required-by: 

Error starting sysmon on Linux Mint 20.1-xfce

I have installed sysmon via pip3 (I do not have a pip command on my system) and when I run sysmon I get this error:

Traceback (most recent call last):
File "/home/neigaard/.local/bin/sysmon", line 5, in
from sysmon.sysmon import main
File "/home/neigaard/.local/lib/python3.8/site-packages/sysmon/sysmon.py", line 2, in
import pyqtgraph as pg
File "/home/neigaard/.local/lib/python3.8/site-packages/pyqtgraph/init.py", line 13, in
from .Qt import QtGui, mkQApp
File "/home/neigaard/.local/lib/python3.8/site-packages/pyqtgraph/Qt.py", line 137, in
from PyQt5 import QtGui, QtCore, QtWidgets, sip, uic
ImportError: cannot import name 'sip' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/init.py)

If I run "pip3 install numpy pyqtgraph pyqt5" I get this:

Requirement already satisfied: numpy in ./.local/lib/python3.8/site-packages (1.20.2)
Requirement already satisfied: pyqtgraph in ./.local/lib/python3.8/site-packages (0.12.1)
Requirement already satisfied: pyqt5 in /usr/lib/python3/dist-packages (5.14.1)

If I run "pip3 show sysmon" I get this:

Name: sysmon
Version: 1.0.1
Summary: System Monitor for Linux
Home-page: https://github.com/MatthiasSchinzel/sysmon
Author: Matthias Schinzel
Author-email: [email protected]
License: UNKNOWN
Location: /home/neigaard/.local/lib/python3.8/site-packages
Requires: numpy, pyqtgraph, pyqt5
Required-by:

Any ideas?

Thank you
Søren

Add option to hide a network adapter or disks

Hi!

I wanted to ask if you could add an option to hide a network adapter or a disks in the "Network/Disks" tab.

I'm asking this because I have 3 network adapters and 3 disks in my machine, and displaying a graph for each one takes a lot of space, to the point that it is unusable.

Screenshot (note that the window is maximized):

Screenshot from 2020-10-08 19-28-04

I suggest adding a checkbox next to each device name, this could toggle the graph's visibility.

Thanks! And very cool app!

Incorrect display of wlan speeds over 1000 mbit

First of, great tool!

Onto the issue:
When the wifi speed is under 1 gbit/s it shows correctly as (let's say) 864.6 Mbit/s
When the wifi speed is over 1 gbit/s either the decimal point is misplaced, or the unit doesn't get updated from Mbit to Gbit: 1.0887 Mbit/s
wifi_slow
wifi_fast

Also, but I'm unsure if that's correct or not, the speed value displayed is only the "tx" value. The "rx" is ignored.
for example from the 864.6 Mbit speed screenshot, iw wlan0 link:
rx bitrate: 1253.9 MBit/s 160MHz HE-MCS 6 HE-NSS 2 HE-GI 0 HE-DCM 0
tx bitrate: 864.8 MBit/s 160MHz HE-MCS 8 HE-NSS 1 HE-GI 0 HE-DCM 0

GPU index error

I see this error:

$ python3 -V
Python 3.6.9

$ uname -a
Linux xxx 5.0.0-1043-oem-osp1 #48-Ubuntu SMP Thu Mar 12 09:53:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

$ python3 sysmon.py
Traceback (most recent call last):
  File "sysmon.py", line 593, in <module>
    main()
  File "sysmon.py", line 587, in main
    main = MainWindow()
  File "sysmon.py", line 216, in __init__
    self.update_gpuinfo()
  File "sysmon.py", line 525, in update_gpuinfo
    num = data[gpu_ind][4]
IndexError: list index out of range

Let me know if you need additional information.

Doesn't work on Ubuntu 20.04.1

Seems like some kind of problem with the GPU portion? I have Ubuntu 20.04.1 with NVIDIA 450.66, Python 3.8.2.

~/Downloads/sysmon/src$ python3 sysmon.py 

Traceback (most recent call last):
  File "sysmon.py", line 595, in <module>
    main()
  File "sysmon.py", line 589, in main
    main = MainWindow()
  File "sysmon.py", line 217, in __init__
    self.update_gpuinfo()
  File "sysmon.py", line 526, in update_gpuinfo
    num = data[gpu_ind][4]
IndexError: list index out of range

GPU hardware is GTX 780.

Here's a screenshot of nvidia-smi output if that helps:

~/Downloads/sysmon/src$ nvidia-smi
Thu Oct  8 20:29:02 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.66       Driver Version: 450.66       CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 780     Off  | 00000000:01:00.0 N/A |                  N/A |
| 17%   37C    P8    N/A /  N/A |    795MiB /  3018MiB |     N/A      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Bug report

When using two networks one of which is disabled in the settings. This error pops up:

cat: /sys/class/net/enp1s0f0u2/speed: Invalid argument
Traceback (most recent call last):
  File "/usr/bin/sysmon", line 33, in <module>
    sys.exit(load_entry_point('sysmon==1.0.0', 'console_scripts', 'sysmon')())
  File "/usr/lib/python3.8/site-packages/sysmon/sysmon.py", line 604, in main
    main = MainWindow()
  File "/usr/lib/python3.8/site-packages/sysmon/sysmon.py", line 102, in __init__
    self.s = sysinfo()
  File "/usr/lib/python3.8/site-packages/sysmon/gather_data.py", line 59, in __init__
    self.get_max_connection_speed()
  File "/usr/lib/python3.8/site-packages/sysmon/gather_data.py", line 267, in get_max_connection_speed
    self.max_connection_speed.append(processes[-1])
IndexError: list index out of range

`

update readme.md

pip command is not working in ubuntu if someone is using python 3 for that readme.md should be updated for Python 3 (pip3)

Unclear licensing terms

Perhaps it's still preliminary, but as things stand now it would be impossible to package and distribute this application.

cpufreq depends on scheduler

Hi

Not sure how you want to handle it but scaling_cur_freq is not guaranteed to exist. When it doesn't the console scrolls with errors

cat: /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq: No such file or directory
cat: /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq: No such file or directory
cat: /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq: No such file or directory

Using acpi_idle for example:

/sys/devices/system/cpu/cpuidle/current_driver:acpi_idle
/sys/devices/system/cpu/cpuidle/current_governor_ro:menu

s'pose as a fallback you could parse cpuinfo, kinda messy either way.

Division by zero error with no swap

Since I have enough ram to not use swap, I currently don't have any swap, which leads to the following error message:
Icon theme "gnome" not found. Traceback (most recent call last): File "sysmon.py", line 589, in <module> main() File "sysmon.py", line 583, in main main = MainWindow() File "sysmon.py", line 109, in __init__ self.plot_meminfo() File "sysmon.py", line 313, in plot_meminfo (swaptotal - swapfree) ZeroDivisionError: division by zero

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.