Yasp-Scripted (Systemmonitor) v1.0.8a

Plasma 4 Extensions

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

24
Score 82.1%
Description:

Yes, Yet another systemmonitor plasmoid.
But still different from the others.
The only useful plasmoid systemmonitor i have found was Yasp. The problem with it was that it was not configurable enough.
So I came up with the idea, that everyone has its own imaginations of what belongs into a systemmonitor and what not. The birth of Yasp-scripted.
The name is similar to Yasp, because I use some modified code from that project.
The biggest advantage is that you can add things to the monitor or remove some, by just changing the script file and reparse it again...) No recompilation or something like that needed...
The scriptfile which comes with this applet is a scriptfile which fits exactly my system. You probably need to change it to fit your system (e.g. if you do not have a wireless lan card, you need to remove the wlan stuff from the script file).

You can send me your script, such that I can upload a whole bunch of scripts, the user could choose of later (maybe with a screenshot to see directly what the script does)

The scripts can be found in the directory yasp_scripts.
The 1st screenshot is systemmonitor_by_mtr.script, the 2nd screenshot is systemmonitor_by_patkoscsaba.script
and the 3rd screenshot is the script collection by duncan
(thx for the scripts).

If you want to align things, you should either use a monospace font, or use a t in the value.

If you are familiar with svg you maybe will create your own svg's for the bar-meter. Send them please to me to have a wider range of look and feel for the system monitor ;)
Last changelog:

9 years ago

1.0.8a - wrong folder prefix ;)

1.0.8 - bug fixed when reparsing (the kde-plasma-handle was deleted, but we should not delete it)

1.0.7 - bug fixed if engine-sensors contains a colon
- Added script by joseph (thx for the script)
- New script by aldo (thx for the script)

1.0.6 - stack keyword added to plotter (thx Chris99 for the patch)
- Script by mtr added (thx for the script)

1.0.5 - fix crash on reparsing in kde-4.5.2 (with 4.5.2 reparsing works again, but 4.5.1 and 4.5.0 have a bug)

1.0.4
- Label preferredSize setting correctly + sizePolicy changed

1.0.3
- meter sizePolicy changed (works now better in KDE-4.5)
- bugfix for KDE-4.5 such that it does not crash on removal

1.0.2
- workaround for problems with KDE-4.5 and meters (min_height parameter added)
- added script by aldo to the package (italian labels)
(- known issue: yasp-scripted crashes on reparsing in kde-4.5. This will be fixed in a later release)

1.0.1 - bug fixed if yasp is closed while parsing the script

1.0: - Reparsing should be more stable

C

finkandreas

9 years ago

Ok guys I just tried KDE-4.5 in my virtual machine and it seems like kde screwed something. At least I cannot find what I'm doing wrong.
Anyway there is a temporary fix with an additional parameter for meter. You can set min_height to ensure that the meter will have this as minimal height. So a line like:
meter min_height="30" use="CpuLoad" min="0" max="100" value="$1"
maybe solves your problem.

Can anyone confirm that this helps?

Report

scratchman

9 years ago

Hi,
yes, your workaround helps, thx & greetings

Report

scratchman

9 years ago

Hi,
yes, your workaround helps, thx & greetings

Report

ondrokm

10 years ago

Hi, I like this plasmoid very much so I did several modifications to display some other data.
I have a simple command to retrieve a value from Internet - usually one-digit number. It works fine in terminal, but when I try to display it in the plasmoid, I get this:

tput: No value for $TERM and no -T specified
0

("0" is the number I want to display; other number gives the same error)

I've found it has something to do with ssh connection ... I just want to display the number retrieved by a command than "out of plasmoid" work fine ... Why this error appears? How can I get rid of it?

Report

ondrokm

10 years ago

Hi, I like this plasmoid very much so I did several modifications to display some other data.
I have a simple command to retrieve a value from Internet - usually one-digit number. It works fine in terminal, but when I try to display it in the plasmoid, I get this:

tput: No value for $TERM and no -T specified
0

("0" is the number I want to display; other number gives the same error)

I've found it has something to do with ssh connection ... I just want to display the number retrieved by a command than "out of plasmoid" work fine ... Why this error appears? How can I get rid of it?

Report

C

finkandreas

10 years ago

What happens if you write a bashscript with exactly the command you need, and invoke the bash script as the yasp command?

Another chance is to add to your bash script something like:

#!/bin/bash
export TERM=xterm
HERE_COMES_YOUR_COMMAND


Maybe this will help

Report

ondrokm

10 years ago

Works! Thank you very much!

Report

jwm

10 years ago

Hey there,

Thanks for writing this applet -- it's very useful!

There is one thing I was wondering about: a typical yasp theme is not really suitable for display in a panel. So would it be a good idea to use a PopupApplet instance? This way, the plasmoid would be displayed with an icon in the panel that pops up the widget when clicked.

I suppose there is also a use case for in-line display of small yasp widgets directly in the panel, but I would think the majority of users would prefer the popup behaviour.

Report

DuncanKDE

10 years ago

Note that the whole set of yasp-scripts I submitted are designed to run in a panel configuration, as they are doing in the third screenshot. That's using most of a horizontal full-width max-height (1/3 screen) panel across the top of my top monitor (of two, stacked), 1920x1200 monitor so 1920x400 panel, set to always-on-top, so I have system performance always visible. (BTW, I've modified the layout a bit since the screenshot, narrowing the views a bit and eliminating the diskstats one, in ordered to fit a syslog tail of 20-some lines, cut to 108 char width.)

But of course while that panel's only a sixth of the screen-space (a third of one monitor, of two) on my main machine, it's more panel than some netbooks have screenspace! So obviously, that's not going to work for everyone.

The solution I came up with on my netbook was to configure the dashboard as a separate activity (option available from kde 4.4, I believe), and put all my yasp-scripts and other general system status plasmoids (including the system-tray and the sys-log-tailer yasp-script I mentioned above) on the dashboard activity. That allows me a full-screen system-monitor "popup", by simply triggering the dashboard.

But popup implementation would be nice...

Of course, it can be done now, sort-of. In addition to the dashboard solution, there's another, if you want to take the time to configure it.

What you'd do is use the plasmoidviewer applet (ships as part of plasma-workspace, on gentoo anyway), to run your yasp-scripted plasmoid in a window instead of as part of the desktop activity, panel, or whatever.

You'd then setup a popup launcher for it as you would for a normal application. If the command line is complex, simply create a bash scriptlet that launches plasmoidviewer with the appropriate command line, thus giving you a simple one-word command-line bash script to invoke.

Then, for hotkey or gesture triggering, create an "input action" (in kcontrol/personalsettings/systemsettings) with the appropriate hotkey or gesture triggers. OR...

For icon-click triggering, use kmenuedit to create a menu entry, complete with desired icon, then (with widgets unlocked) drag it from the menu to your preferred containment (panel, folderview, activity, launcher) to create an icon launcher.

If desired, you could then use existing kwin "special window settings" functionality, to configure where the window pops up, make it borderless (you'd then use the keyboard close-window shortcut to close it), set the correct size, always-on-top, whatever.

So the functionality is already there in kde and yasp-scripted itself. It's just that as with yasp-scripted in general, it's a flexibility-first, configure-it-for-your-own-needs, thing, not something that ships pre-configured out-of-the-box for every anticipated usage, but at the same time limiting the flexibility for other-than-anticipated usage. True, people who don't want to bother with learning how to configure it on their own will have problems with this, but then again, yasp-scripted was never targeted at the "run-it-as-it-comes" crowd in the first place. There's other, more appropriate plasmoids (and I might add, more appropriate desktop environments), for the "I don't want to configure it, I just want it to work" non-power-user.

Report

jwm

10 years ago

Thanks for the detailed reply :-).

The problem with using plasmoidviewer is that the window is not shown with transparency, so it will look like a bit of a hack.

The problem with using the dashboard activity is that i use separate activities for each workspace (so I can have different wallpapers), which means that you also get separate dashboards for each workspace -- and keeping them all looking the same then becomes a bit of a pain.

Anyway -- I had a quick look at the source. Hacking this should not be too difficult. Pretty much all that is required is the implementation of the graphicsWidget() handle. May get around to it in a few weeks.

Report

C

finkandreas

10 years ago

you could start a fork because that would make the merging easier...
http://bitbucket.org/jocker16/yasp-scripted

Report

C

finkandreas

10 years ago

Sounds like a nice idea, but unfortunately I neither have much time nor I have an installed KDE for testing it ;)

Maybe I'll implement it in approx half a year when I have finished my studies but before that I cannot promise you anything...

Report

ondrokm

10 years ago

Hi,
I have problem with displaying wlan ESSID when I'm not connected to any network. Instead of "nothing" or empty field it shows long string like

\x05\xEF\xF7\XA1:\x ..... (more than 50 characters)

Because of it, the widget resize itself and it's not possible to make it smaller.
If I try "$ /sbin/iwconfig 2>/dev/null ", it shows that string instead in the ESSID place.

How can I fix this? Is there a possibility to use conditions in the script?

Report

DuncanKDE

10 years ago

yasp-scripted doesn't provide conditions AFAIK, but it doesn't need to, as bash does.

bash actually has the generally rich conditional branching choices available in many programming languages, including if/then/else/elif/fi (fi is the reverse of if, closing the conditional), case/esac, with shell style wildcards, while/until loops, etc. Take a look at a bash tutorial (or the bash manpage or info pages) and/or issue the command "help <builtin>" (where <builtin is the if/case/while/until or other bash builtin of interest) at the command line, for a briefer description. It's also possible to use the test builtin (commonly seen as a [ -x "$var" ] or [[ -x $var ]] style test) and simple exit code results, along with boolean logic operators like &&, ||, and !.

Scripts with conditionals are, however, generally complex enough that they don't fit well directly within a yasp-scripted sensor command itself, so the usual solution in that case would be a separately created bash script, with the yasp-scripted script simply invoking it as its command.

There is in fact one invoked bash script of "intermediate" complexity, shipped in my scripts pack as yasps.diskstats, with examples of functions, if/then/else branching (even nested), [] and &&/|| logic, etc (I don't see any case or while/until logic, tho). You can see how a yasp-script invokes it in the disks script.

Or, you can take a much simpler path and simply truncate the output to the maximum desired length, so it doesn't unreasonably widen the plasmoid. An easy way to do that is to simply pipe the existing output to the cut command, telling it at what character you want to truncate. Unfortunately, all the shipped script usage examples seem to use cut's -d delimiter and -f fieldnumber options, instead of the -c character-range option, but it takes a simple list or range, so:

<existing command> | cut -c -20

... gives you the first 20 characters, and...

<existing command> | cut -c 2-10

... would skip the first character and give you the next 9.

You can even do this:

<existing command> | cut -c 3-5,10,23-

... to get chars 3-5, 10, and 23 to the end of the line (altho if the line's of unknown length, that obviously wouldn't limit the output length, just shorten it a bit).

Simple, eh? =:^)

FWIW, the cut manpage has the details. As demonstrated by all the shipped examples, often, using the delimiter and field number options works better than using the character option. Head and tail are similarly useful "small and simple" commands, which together with sed, grep, pipes/redirection, and conditionals, help give Unix shell scripting the power it's rightly famous for.

FWIW, you could probably optimize things a bit from that cut, by tweaking the grep or sed appropriately, cutting the cut out of the pipeline while still getting the same effect, but as should be obvious by now, that gets pretty complex, with a simple pipe to cut being much easier to figure out if you're not extremely well versed in regex syntax as well as grep/sed options and commands themselves. That's where even the experts started! =:^)

Report

ondrokm

10 years ago

Thanks very much. I'd prefer empty field but this also works :-)

Report

ondrokm

10 years ago

Hi,
I have problem with displaying wlan ESSID when I'm not connected to any network. Instead of "nothing" or empty field it shows long string like

\x05\xEF\xF7\XA1:\x ..... (more than 50 characters)

Because of it, the widget resize itself and it's not possible to make it smaller.
If I try "$ /sbin/iwconfig 2>/dev/null ", it shows that string instead in the ESSID place.

How can I fix this? Is there a possibility to use conditions in the script?

Report

DuncanKDE

10 years ago

Several comments have mentioned hard drive temps, but the two at least appear to be at the max-reply-depth for kde-look, so it doesn't have a reply button for them. So I'm starting a new thread.

One single purpose and thus reasonably simple app that can report and monitor hard disk drive temps is the unsurprisingly named "hddtemp". It works for SATA, PATA, and SCSI drives. In simplest form, you can run it as follows, tho you probably have to run it as root (thus using sudo or the like) if it's not installed setUID on your system.

hddtemp <device>

Here's the the command and output for my four drives, as run (from my admin account, configured for unrestricted and passwordless sudo access) here:

sudo hddtemp /dev/sd[abcd]
/dev/sda: ST3300831AS: 47°C
/dev/sdb: ST3300831AS: 48°C
/dev/sdc: ST3300831AS: 47°C
/dev/sdd: ST3300831AS: 46°C

So assuming that sort of output and that appropriate sudo privs are configured for the user running yasp-scripted, a the command to get the temp for /dev/sda, as used in a yasp-script sensor command, might look like this:

sudo hddtemp /dev/sda | sed -n 's/.* \([0-9]\+\)°C/\1/p'

Report

Contrast

10 years ago

I've been trying to set this up for weeks with no success. Would someone be so kind as to post a script for this? To clarify, I'm trying to get the percentage of RAM currently in use, not counting buffers/cache. Ten thousand internets for whoever can oblige. :)

Report

DuncanKDE

10 years ago

Quote:percentage of RAM currently in use, not counting buffers/cache.

Should be easy enough (famous last words!). You're wanting app RAM (not counting buffs/cache) divided by physical RAM (not counting swap), right?

Getting the two values is reasonably easy. Here's the sensors I use, as should be in the files I contributed to the tarball, minus the KB > MB conversion. (Note that each sensor is one line, regardless of what the wrapping as displayed here is, and that I'm retyping them "raw and untested", so there might be a typo in the form of a missing quote or some such. Testing and typo correction's your job. =:^)

# mem.phys in bytes

sensor name="mem.phys.kb" type="program" cmd="sed -ne 's/MemTotal: *\([0-9]*\).*/\1/p' /proc/meminfo"

# mem.appl in bytes

sensor name="mem.appl.kb" type="engine" cmd="systemmonitor:mem/physical/application:value"

# What's left is a math sensor to combine them with the appropriate division

sensor name="mem.appl.pt" type="math" use="mem.appl.kb" use="mem.phys.kb" math="double $1 100 * $2 /"

Of course, you could do the math at the end of the second sensor and not include a math sensor at all, if desired, and that's probably how I'd actually deploy it if I wasn't using the mem.appl raw KB number, but I left it as three separate sensors here, for clarity.

The other alternative, which I chose to use in my memory display as is now shipped in the tarball as an example, would be to convert both mem.phy and mem.appl (as well as buffer, cache, and total used) to MB, (divide the raw numbers by 1024), and display them both as-is, and plotted, with the physical RAM number hard-coded as the plotter max. This effectively gives me percentage as plotted, since the plotter domain is 100% of the physical memory, but megabyte values as displayed. Given that multiple values can be plotted at once, I can plot used/appl/cach/buff all on the same plotter against physical RAM as 100%, giving me several times the information of a single plot, while using no additional display space. =:^) The only additional display space used would be if all values were to be displayed as text as well, which I do, but which you could omit if you're short on space.

Report

Contrast

10 years ago

Thanks for the quick reply. That's really close to what I'm trying to get, but what do I need to put in the value line so it just shows the first two digits without the decimal point and the following two digits? Here's what I have now:
value use="mem.appl.pt" font="Eurostile Extended, 48" format="$1%" alignment="Center" interval="1000"
And that's showing, for example, "50.05%", when I'd like for it to just show "50%". Again, thanks for your help. :)

Report

DuncanKDE

10 years ago

In that case, just change the "double" on that math sensor to "int". Should do the trick. It won't be quite as accurate, the reason I used double in the first place, but it sounds like a bit of rounding error isn't something that concerns you, and putting the multiplication first helps too.

Report

Contrast

10 years ago

Awesome, that got it. Many thanks for your help on this - I was struggling with the math sensor forever. Here's the final result: http://kde-look.org/content/show.php?content=124682

Report

vi3dr0

10 years ago

I'd like to have multiple icons and text values in one line, like:

<icon> : $1 <icon2> : $2 <icon3> : $3 ...

so it could give nice conky-like experience docked in panel. Is it possible?

Report

C

finkandreas

10 years ago

Sorry that's not possible. You can only have a line of icons with no text or a line of one icon on the left side and then some text....

And at the moment I do not have that much time, for implementing this.

Report

ransom

10 years ago

Thanks for Yasp-Scripted. Finally I got what I missed all the time: A simple line in the panel displaying temps, fans and disk space. Great!

Report

9 years ago

1.0.8a - wrong folder prefix ;)

1.0.8 - bug fixed when reparsing (the kde-plasma-handle was deleted, but we should not delete it)

1.0.7 - bug fixed if engine-sensors contains a colon
- Added script by joseph (thx for the script)
- New script by aldo (thx for the script)

1.0.6 - stack keyword added to plotter (thx Chris99 for the patch)
- Script by mtr added (thx for the script)

1.0.5 - fix crash on reparsing in kde-4.5.2 (with 4.5.2 reparsing works again, but 4.5.1 and 4.5.0 have a bug)

1.0.4
- Label preferredSize setting correctly + sizePolicy changed

1.0.3
- meter sizePolicy changed (works now better in KDE-4.5)
- bugfix for KDE-4.5 such that it does not crash on removal

1.0.2
- workaround for problems with KDE-4.5 and meters (min_height parameter added)
- added script by aldo to the package (italian labels)
(- known issue: yasp-scripted crashes on reparsing in kde-4.5. This will be fixed in a later release)

1.0.1 - bug fixed if yasp is closed while parsing the script

1.0: - Reparsing should be more stable

12345678910
123
product-maker domryba Apr 16 2015 9 excellent
product-maker LeifErikson May 29 2013 9 excellent
product-maker XenoPL Nov 01 2012 9 excellent
product-maker Sweyn78 Aug 27 2012 9 excellent
product-maker matafleur Mar 05 2012 9 excellent
product-maker gerstavros Jan 15 2012 9 excellent
product-maker Heart Nov 14 2011 9 excellent
product-maker momonster Jul 02 2011 9 excellent
product-maker superpepo Jun 18 2011 9 excellent
product-maker yield65 May 29 2011 9 excellent
product-maker marcotangaro Mar 24 2011 9 excellent
product-maker theZest Feb 28 2011 9 excellent
product-maker bugmenot1234 Feb 27 2011 9 excellent
product-maker rangerGR Feb 25 2011 9 excellent
product-maker schleby Feb 14 2011 9 excellent
product-maker phiga2 Feb 11 2011 3 bad
product-maker srog Feb 01 2011 9 excellent
product-maker opera1818 Dec 17 2010 9 excellent
product-maker cialdo99 Nov 18 2010 9 excellent
product-maker deabru Nov 07 2010 9 excellent
product-maker schnelle Nov 05 2010 9 excellent
product-maker Vzlom Oct 27 2010 9 excellent
product-maker vatsok Oct 21 2010 9 excellent
product-maker SeaJey Oct 07 2010 9 excellent
product-maker Base: 4 x 5.0 Ratings
domryba
Apr 16 2015
xrooters
Jul 13 2013
LeifErikson
May 29 2013
XenoPL
Nov 01 2012
despot77
May 28 2012
Fred6681
Jul 02 2011
yield65
May 29 2011
marcotangaro
Mar 24 2011
extra
Nov 09 2010
Contrast
Aug 21 2010
poelzi
Feb 25 2010
hellblade
Feb 16 2010
Franksuse64
Feb 02 2010
DaiVied
Dec 19 2009
nicollivier
Dec 02 2009
Droopy159
Nov 18 2009
SeaJey
Nov 03 2009
Sibob
Nov 03 2009
DuncanKDE
Oct 22 2009
kanutron
Sep 18 2009
t3ddy
Sep 04 2009
Montblanc
Aug 28 2009
NForce
Aug 10 2009
Havoc65
Jul 31 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
1.0.8a
updated Feb 25 2011
added Jul 31 2009
downloads 24h
0
mediaviews 24h 0
pageviews 24h 3