fadeouter/sysinfo

First

Hippyjake opened this issue ยท 25 comments

screenshot from 2017-04-29 08-38-06

Having an issue with the script. The last update to Argos broke something. Issue 19 is the first mention of it. Its your script so, first issue on your repo!!

thanks, will figure it out!

@Hippyjake unfortunately I can't reproduce this issue on Ubuntu GNOME 17.04, but tried to add | tr -d '[]|'
idk did I fixed the problem (
could you report please, did problem fixed now?

@fadeouter btw your script is by far the most advanced script specifically 4 argos, I modified it a bit 2 suit my dark theme and tweaked some stuff around back and forth, but the thing is dope. If you wan't my tweaks of his extensions @Hippyjake I can share them if @fadeouter is fine with that.

Jomik commented

I guess we can ask @fadeouter to add a license to his repo. So that you can actually do that @WhiteheadV ๐Ÿ˜„
@fadeouter What happens if you change ORS=\\\\n to ORS=\\n ?

@WhiteheadV i'm fine, you can paste code here or at pastebin etc. Also, I will add a licence info right now.

@jomic

with ORS="\\\\n"
20.5 gnome-shell\n0 systemd\n0 kthreadd\n

with ORS="\\n"


3    ibus-daemon
3    Xorg
3    gnome-shell

P.S. ORS="\\n" tells Argos to show every new line of output as a single menu item.

https://unix.stackexchange.com/questions/158584/change-tops-sorting-back-to-cpu , okay, b4 his affirmation, the problem is probably top not sorting processes by cpu usage, so check out that url 4 that. And make sure you're catching the right perimeters.

Jomik commented

To sort by CPU, without forest view, you just pass -o "%CPU" as a flag.

@jomic thanks! Added this to the script. Would be glad if anyone tell how it works now.

Jomik commented

Tested it here

screenshot from 2017-04-30 14-09-23

@fadeouter cool, I manually configured my top 2 display the most cpu intensive processes first, and gotta go, so tomorrow I guess..

Probably I'm figured out. Tried to reproduce in Arch in termbox.io and found different output of a top.
I used grep -v "top \ | Tasks \ | Cpu \ | KiB" | head -n 5 | tail -n 3 to exctract first 3 lines with processes, but it's just bad code (shame on me!). Now I changed this to head -n 10 | tail -n 3
Hope this will work.
Could anyone try and check?
Also, modified to show all filesystem mounts started with /dev/sd*

Jomik commented

@fadeouter I still don't get the names on the top 3 processes. Also, showing all /dev/sd* shows the boot partition too, I'm not particularly interested in that.
screenshot from 2017-04-30 14-34-21

@Jomik hey, could you check now, please? Looks like i'm solved this issues.
P.S. No. The position of CPU output in Arch is on 7 column, while in Ubuntu it's 9.

Arch:

 PID USER      PR  NI    VIRT    RES %CPU %MEM     TIME+ S COMMAND
    1 root      20   0    4.3m   0.1m  0.0  0.0   0:00.00 S init
    6 root      20   0   14.4m   1.4m  0.0  0.6   0:00.02 S  `- abduco
    7 root      20   0   20.0m   3.4m  0.0  1.4   0:00.05 S      `- bash
   88 root      20   0   40.6m   3.1m  0.0  1.3   0:00.00 R          `- top

Ubuntu:

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
18267 c         20   0    9628   3824   3260 R  17,6  0,2   0:00.03 top
14209 c         20   0 1013248 255660  33940 R  11,8 12,8  91:02.83 gnome-shell
14367 c         20   0 1053244  37400  12204 S   5,9  1,9  19:46.65 rhythmbox

I will find how to determine the number of column where CPU output. I'll do it later.

Currently you and any Arch user can manually change

top=$(top -o "%CPU" -bn 1 | tr -d '`[]|-' | head -n 10 | tail -n 3 |  awk '{ printf("%-4s %-s\n", $9 / 2, $NF); }' | awk 1 ORS="\\\n") 

to

top=$(top -o "%CPU" -bn 1 | tr -d '`[]|-' | head -n 10 | tail -n 3 |  awk '{ printf("%-4s %-s\n", $7 / 2, $NF); }' | awk 1 ORS="\\\n") 

PPS. And while I found how to determine the number of "CPU" column, but currently don't know how to implement this in current code

top -bn1 | head -n 7 | tail -n 1 | tr " " "\n" | grep -ve "^$" | awk '/CPU/{print NR}'

Jomik commented

@fadeouter this works for me. Changing
https://github.com/fadeouter/sysinfo/blob/master/sysinfo.1s.sh#L22
to

top=$(top -o "%CPU" -bn 1 | tr -d '`[]|-' | head -n 10 | tail -n 3 |  awk '{ printf("%-4s %-s\n", $7 / 2, $NF); }' | awk 1 ORS="\\\n")

Do note, that your master currently has $12 instead of $NF. I don't really know what this is/means, I'm not an awk user ๐Ÿ˜„

@Jomik thanks for your note, $NF means last column. While Arch has only 11 columns in the top output and Ubuntu has 12, this helps to show exactly what needed.

I'm running Arch, not sure it makes a difference. Its still not working with the latest version.
I changed the line for arch per the readme, still no dice.

@Hippyjake ok, it's sad. Could you enter top -o "%CPU" -bn 1 | head -n 10 in your terminal and post here the output?

I get

 ~ ๎‚ฐ top -o "%CPU" -bn 1 | head -n 10
top - 14:35:58 up 3 days,  5:06,  1 user,  load average: 0.16, 0.25, 0.30
Tasks: 279 total,   1 running, 278 sleeping,   0 stopped,   0 zombie
%Cpu0  :   8.7/2.7    11[||||||                                               ]
%Cpu1  :   9.1/2.5    12[||||||                                               ]
%Cpu2  :   8.3/2.6    11[|||||                                                ]
%Cpu3  :   8.8/2.4    11[||||||                                               ]
GiB Mem : 89.2/7.713    [                                                     ]
GiB Swap:  2.9/7.715    [                                                     ]

  PID USER      PR  NI    VIRT    RES  %CPU %MEM     TIME+ S COMMAND


For a custom fix you need to replace top=$(top -o "%CPU" -bn 1 | tr -d '`[]|-' | head -n 10 | tail -n 3 | awk '{ printf("%-4s %-s\n", $7 / 2, $NF); }' | awk 1 ORS="\\\n") with top=$(top -o "%CPU" -bn 1 | tr -d '`[]|-' | head -n 13 | tail -n 3 | awk '{ printf("%-4s %-s\n", $7 / 2, $NF); }' | awk 1 ORS="\\\n") (actually: head -n 10 to head -n 13).

Does it work after this change?

@Hippyjake cool, bro! I'll fix this permanently as soon as figure out how to do this)

Could use a check for Distro. If lsb_release -ds = Ubuntu Kinda thing

lsb_release -drs will give release name as well.

Also using arch and gnome dark theme, https://pastebin.com/wPrkhQa3 changed it up a bit.

Also this wont need a new issue, but add "argos" "gnome" as tags to the repo. Your repo should show up in this awesome script!

https://gist.github.com/Jomik/f90a38877363b7d3d4f15df9ea4380d5

@Hippyjake thanks, i did it.
Also, problem isn't solved until I'll add solution to a script.

Also, I am updated script just now, increased density of CPU chart (20 points instead of 10) and added disk capacity bars.