You are not logged in.

#1 2012-11-21 21:04:40

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Dynamic custom panel indicators

I use four genmon applets and two systemd services to power two 'indicators' on my panel: YeL0S.png (Each genmon applet powers one row)

The top one (top two rows) indicates which of my headless machines are up based on ability to ping them at static DHCP addresses.  The bottom one (bottom two rows) displays some information about two other (ie. not on the same network as the hosts in the first indicator) NICs.  The systemd service for this one is a bash script which

1) Queries the addresses of net1 and net2 (each of which are always 192.168.[1-10].110)
2) Checks connectivity
3) Tries to ping 192.168.X.1 where X is based on the address of the NIC
4) Writes the info gathered above to two text files (one for each row).  For example, the two (bottom) rows in the image above are based on:

$ cat /dev/shm/.genmon/2a
<img>/usr/local/share/images/5dot/10000.png</img>
<tool>net1 - 1.110
net2 - 7.110</tool>
$ cat /dev/shm/.genmon/2b
<img>/usr/local/share/images/5dot/0x000.png</img>
<tool>net1 - 1.110
net2 - 7.110</tool>

The bulk of the script is contained in a 'while true' loop so that it runs indefinitely.  The genmon applets simply cat the appropriate file.  At one time I had genmon actually running the scripts (minus the while loop), but I switched to the 'daemon' method for some reason which I can't recall.

The first row of 'lights' represents 192.168.1.X through 192.168.5.X, the second row represents 192.168.6.X through 192.168.10.X.  If no address is configured for an interface, the interface is skipped.  If an address is configured but there is no connectivity, the appropriate light is red.  If there's connectivity but no ping to 192.168.X.1, the light is blue.  If the ping succeeds, the light is green.

The main problem with this approach is that the images have to be manually generated in advance.  To account for up to two of the ten 'lights' active in each of three colors, I had to create 106 images.  And that's with two instances of genmon, each displaying one row; I'd need alot more if I combined all posibilities for both rows into single images to be displayed by one genmon instance.  And as a consequence it's not very extensible.  For one NIC I needed 16 images.  For two NICS, 106.  For three ... ?

The other problem is that the updates to the files and the genmon run intervals are not syncronized.  Granted, this would be solved by having genmon run the script rather than cat a file.  Since I can't remember why I eschewed that method maybe I should give it another try.

I have other genmon-powered indicators which cat files output by short-lived rather than persistent scripts as well.  In all cases they share the same shortcomings.

Anyhoo, what I'd like to know is if anyone has any suggestions or examples of other methods of accomplishing something similar, or any advice/criticism regarding my method.  Thanks.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB