You are not logged in.

#1 2009-07-17 00:17:53

whoops
Member
Registered: 2009-03-19
Posts: 891

[solved] "what's my linux doing?" conky-bar + script?

Hi!

I'm searching for and/or am trying to figure out a conky config + script that lets me "sort of see what my pc is doing atm", just a little peek, something that "helps guess" and "blends in". Couldn't find anything that lets me see some random details like that, so I did this for now:

stuff.bash:

#!/bin/bash
touch stuff.1 stuff.2
ps -A -o "cmd" > stuff.x
#pstree -U > stuff.x
if [ "$(diff -q stuff.x stuff.1)"  = "" ]; then
cat stuff.diff
else
mv -b stuff.1 stuff.2
mv -b stuff.x stuff.1
diff --suppress-common-lines -d stuff.1 stuff.2 | grep \< | tr '\n' ' ' | sed "s/^[0-9a-f ]*//" > stuff.diff
cat stuff.diff
fi

which I'm using in that conky bar:

own_window yes
own_window_type dock
own_window_title conky
own_window_colour 555577
background yes

double_buffer true

use_xft yes

xftfont DejaVu Sans Mono:style=Bold:size=12

alignment top_middle
border_width 0
gap_x 0
gap_y 0
minimum_size 1950 20
maximum_width 1950 20
use_spacer left


color0 aa8888
color1 white
color2 grey

draw_borders no
draw_outline no
draw_shades no

short_units yes
top_name_width 8
pad_percents 2

cpu_avg_samples 12
net_avg_samples 12
update_interval 1

TEXT
${color0}${font impact}CPU:${font} ${color1}${cpu cpu1}% / ${cpu cpu2}% \
${color2}(${TOP name 1} | ${TOP name 2} | ${TOP name 3}) \
${color0}${font impact}MEM:${font} ${color1}${memperc}% \
${color2}(${TOP_mem name 1} | ${TOP_mem name 2} | ${TOP_mem name 3}) \
${color0}${font impact}DO:${font} ${color1}${downspeed wlan0} ${color0}${font impact}UP:${font} ${color1}${upspeed wlan0} \
${color0}${font impact}LAST: ${color2}${font} ${scroll 92 3 ${exec "~/stuff.bash"}}\
${alignr}\
${color1}${time %A, %Y-%m-%d - %H:%M:%S Uhr}\

So... that gives me a sort of nice conky bar with some random "what's being done" - now p.e. It tells me that yaourt is calling wget and pacman... and cmake has been started... and for some reason firefox is calling itsself... and some strange python script in /tmp/... with my home directory written behind it as parameters... mmmh... well.... maybe I should check on that later, so back to the topic - what I'm sort of missing is more or less...:

(edit: [solved] / -I would rather have done something like this with lsof, but I didn't manage to get rid of some of the constantly changing columns of lsof output - those lead to way too many reoccurring info's and doesn't give me the feeling of "a little peek behind the curtains" like it's supposed to be )
- There must be an overall better ways to do something like that, right? Any ideas for a smart little script that gets a few lines of "chaotic random backgrund info" with a good: "ooooh, I seeee"-ratio and not too much spam?
(edit: [solved] - "network stuff"! I can't see enough network stuff!!! So if anyone knows an easy (easy as in "call-it-once-per-5-seconds-with-concy"-easy) to show what processes are meddling around on the network most atm, that would be great... maybe I'll try netstat again for just that... )
- Also the whole rest of that config & script are far from perfect...


So: Any hints & stuff? Thanks!

Last edited by whoops (2009-07-19 11:12:24)

Offline

#2 2009-07-17 00:25:52

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [solved] "what's my linux doing?" conky-bar + script?

I use pstree -U | grep -F -v $'some\ncommon\nstuff'

The new processes diff is interesting.

Offline

#3 2009-07-17 01:22:31

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: [solved] "what's my linux doing?" conky-bar + script?

Hmh, Although I think it's cleaner & more accurate that seems to give me a lot "worse" result than the "ps -A" one.  I guess that's because with ps -A -o "cmd" I get the parameters / paths...

Maybe I'm doing it wrong...:

#!/bin/bash
touch compare.1 compare.2
## old one
# ps -A -o "cmd" > compare.x
pstree -U > compare.x
if [ "$(diff -q compare.x compare.1)"  = "" ]; then
cat compare.diff
else
mv -b compare.1 compare.2
mv -b compare.x compare.1
diff --suppress-common-lines -d compare.1 compare.2 | grep \< | tr '\n' '   ' | sed "s/[├┬│└─ ]\| * / /g" > compare.diff
cat compare.diff
fi

... but essentially that's just giving me the same I got before just without paths & the parameters the processes have been called with.

Offline

#4 2009-07-17 09:33:36

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [solved] "what's my linux doing?" conky-bar + script?

No, I mean just pstree.

But you could use diff to color some parts of the tree that have just appeared. It would have to be with a word-based diff though.

Offline

#5 2009-07-17 09:58:06

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: [solved] "what's my linux doing?" conky-bar + script?

I think I got it. The dash is the one is pstree -U, I think it prepends every process.

dwdiff -1 -d '─' old.diff new.diff | sed 's/{+/${color red}/g;s/+}/${color}/g'

dwdiff is in community.

Offline

#6 2009-07-17 13:34:17

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: [solved] "what's my linux doing?" conky-bar + script?

Ooooh, that explains it.

Thanks, but I'm looking for (see example) a single line or something for a conky bar and something a lot less "systematic"... hard to explain... something to "see stuff fly by"... the "strange small line where I can recognize stuff from time to time"... like at the moment it's telling me "kjournal2d  < n/usr/libhistory < bla bla bla < www.archlinux.org < ninotify < npipe < npipe < /bin/bash ./stuff.bash < /dev/input event....." and its going on an on and on which does not make thaaat much sense for but I like seeing it...


That's my "best one" so far:

stuff.bash:

#!/bin/bash
touch stuff.1 stuff.2
ps -A -o "cmd" > stuff.x
lsof -F cn | grep -v -E "p[0-9][0-9]|proc|stuff|lsof|grep|conky| sed " | sed "s/^.//g" >> stuff.x
diff -BEbw --suppress-common-lines stuff.x stuff.1 | grep \< | tr '\n' ' ' | sed "s/^[0-9a-f ]*\|IPv4//g" | sed "s/  */ /g" > stuff.diffx
if [ "$(diff stuff.diffx stuff.diff | grep \<)"  = "" ]; then
cat stuff.diff
else
mv -b stuff.1 stuff.2
mv -b stuff.x stuff.1
mv -b stuff.diffx stuff.diff
cat stuff.diff
fi

... just I think it might suck a little too much CPU... and I didn't manage to filter out all the stuff this script generates itself without loosing too many unrelated info... and some stuff that keeps showing up every few seconds. Somehow I'd like it mostly to show "stuff that doesn't happen all the time".

Last edited by whoops (2009-07-19 11:09:23)

Offline

Board footer

Powered by FluxBB