Overclock.net banner

sense.py, a system monitor for your linux desktop

419 views 8 replies 4 participants last post by  CoolAs 
#1 ·
I have been working on a small project with the intention to provide a terminal-based system monitoring program. It was created in order to force myself to write more Python code, try to do code a different kind of program, and learn more in the process. I initially started its development due to how much I like HWinfo. I felt like it was a beautiful piece of software: no superfluous info, just lots of data to better understand your system needs.

Well, here it is. For now it's got enough data for monitoring nvidia+intel systems, which is what I have available. I would love to support AMD GPUs and CPUs but unfortunately I gave my previous AMD-based system as a present.

Please have a look at it and let me know what you think: what you find useful and what could be improved.

My next plans for it will be a little bit of work on the "database" of the program since it's starting to get ugly as I add more features. Then will follow logging support like HWInfo (CSV would do the job), and perhaps power usage, which is easy to add but is pretty unreliable.

Cheers!
smile.gif
 
See less See more
1
#2 ·
Looks cool. I'm sure your plate is full with planned upgrades, but it would be cool if you made it portable to Windows as well. This isn't a criticism since obviously you intend this to be for Unix systems, but at a glance I see a lot of Unix related hard-coded things that could be fairly easily modularized if you want to make it able to work with each OS.

Hell, I've been looking for a side project for a while and NAT traversal always gets in the way of my serverless P2P ideas, so maybe something offline like this would be interesting.
 
#3 ·
Hi Alcal! Thanks a lot for your feedback! It's hardcoded for Linux support because I rarely run Windows and I don't know the APIs used in Windows. I really have no idea how I could make the program run on it, it's just been more than 15 years i don't run windows as my main OS anymore. There's OpenHardwareMonitor which does way more things than my program, is made for Windows and is open source software as well. I don't intend to make a GUI for this app in the near future since I usually run this program over SSH, so it would feel out of place on windows.

If you think this would be a good side project, I invite you to add feature requests, bug reports or submit patches.
 
#4 ·
@CoolAs
That's a great idea!

I want to run it (Ubuntu server 16.04, Python version 2.7.12), but I got some errors. The first one was related to encoding and I know as much as to add

Code:

Code:
# -*- coding: utf-8 -*-
in the beginning of the file.

However, now I get another error on Line 97 from sense.py (shown as line 98 because of the added encoding):
Code:

Code:
File "./sense.py", line 98
    data_store["min"] = min(*measurements, data_store["min"])
SyntaxError: only named arguments may follow *expression

Sorry, I am not familiar with Python.
redface.gif
 
#5 ·
Thank you for wanting to giving it a try.

Forgot to mention it relies on Python 3, and the requirements listed on requierements.txt. I personally run it on Python 3.6 which is the very latest Python release.

EDIT: Python 3 programs are usually incompatible with Python 2 programs. I could probably try to get it to run on Python 2 though, although it makes more sense to me to only support Python3.
 
#6 ·
@CoolAs
Ahhh, this figures it then.
Perhaps post an exclusive note about it, because when hunting for the dependencies, PySensors showed me this:
Quote:
Requirements:
  • Python ≥2.6 and < 3
  • libsensors.so from lm-sensors version 3.x (API 4)
I will update Python and give it another try!
Edit: I have python3 and python (2.7) available.
How did you install PySensors for Python 3?

Edit2: Nevermind, got it. Apparently, there are at least three different PySensors packages and I picked one of the two wrong ones.
rolleyes.gif


Thanks to this site, I was able to find the correct repository.

Edit3: Nope. Sensors still not working.
Code:

Code:
File "sense.py", line 14, in <module>
    import sensors
ImportError: No module named 'sensors'

Edit: I installed several needed dependencies, covered your requirements, but now get the following:
Code:

Code:
fragamemnon@gigatron:~/sense$ python3 sense.py
Traceback (most recent call last):
  File "sense.py", line 290, in <module>
    main()
  File "sense.py", line 257, in main
    sensors.init()
TypeError: Required argument 'filename' (pos 1) not found
 
#7 ·
That's an issue of the sensors module. I didn't know there were so many, maybe I was lucky finding the one that works on the first try
biggrin.gif
. I installed the sensors module this way.

Code:

Code:
pip install hg+https://bitbucket.org/gleb_zhulik/py3sensors
I recommend installing this to a virtualenv.

Thanks a lot for being so willing to try it.
 
#8 ·
Looks cool! Haven't run it yet but batch mode is a feature I really like seeing in monitoring utils, makes it easier to slice n dice snippets of output and pipe them into a toolbar or widget
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top