Xymon Mailing List Archive search

Color Status GIF for host status page

4 messages in this thread

list Rob Steuer · Fri, 25 Sep 2015 17:36:58 -0400 ·
Hi, 

 
I've tried to figure this out, but I need help at this point.  What I'm
trying to figure out is how to add a colored GIF status image to a detailed
host page.

 
For example, when looking at built in pages like Memory, Disk, Etc. The
individual items show a small colored GIF image, green,yellow,red prior to
the item [green gif] Physical: 80%.

 
I've setup the UPS monitoring using devmon and the dnsreg script and while
if I click on those pages it shows a green column/bar all the way to the
left, it doesn't show a green gif dot image next to the item that is tested.
How can this be added?  I've looked at the analysis.cfg and thought I was
getting close, but I think it must be set/configured in some other way, it
is defined on the client or the Xymon server and where?  

 
Thanks for all help!
list Japheth Cleaver · Fri, 25 Sep 2015 15:22:14 -0700 ·
quoted from Rob Steuer
On 9/25/2015 2:36 PM, Rob Steuer wrote:
Hi,

I’ve tried to figure this out, but I need help at this point.  What I’m trying to figure out is how to add a colored GIF status image to a detailed host page.

For example, when looking at built in pages like Memory, Disk, Etc. The individual items show a small colored GIF image, green,yellow,red prior to the item [green gif] Physical: 80%.

I’ve setup the UPS monitoring using devmon and the dnsreg script and while if I click on those pages it shows a green column/bar all the way to the left, it doesn’t show a green gif dot image next to the item that is tested. How can this be added?  I’ve looked at the analysis.cfg and thought I was getting close, but I think it must be set/configured in some other way, it is defined on the client or the Xymon server and where?

Rob,

I can't speak to devmon *specifically* but generically speaking, the contents of the status message are controlled by the sender. The hard way to put it in would be to add the HTML IMG tag by hand, but fortunately there's an easier method :) Adding a '&red', '&yellow' or other &color to your status message on a line will cause the web interface to insert the appropriate color GIF for you automatically.

HTH,
-jc
list Rob Steuer · Fri, 25 Sep 2015 22:12:41 -0400 ·
Thanks Japheth!

 
From your hint I was able to modify my script to do what I wanted.  So let me share now, maybe this will help others.  As an example, using the dnsreg.sh script, I’ve modified 2 things:

 
1.       With the widely published dnsreg.sh script, the EXPIRESTRING was showing like this for me: 2015-09-25T14 because it used a : as a delimiter, I removed the sed command and added an additional cut command using T as a delimiter so it only grabbed the actual date part.

2.       Thanks to your hint, I added the DOTCOLOR commands in each part of the IF statement.  Also in the last line I prefix with $DOTCOLOR so now it shows the colored icon in the detailed status page.

 
EXPIRESTRING="`whois $DOMAIN | egrep -i "Expires.*:|Expiration.*:|Renewal.*:|Expires on" | head -n 1 | cut -d: -f2 | cut -dT -f1`"

 
      EXPIRES=`date --date="$EXPIRESTRING" "+%s"`

 
      if test $EXPIRES -le $ALARMTIME

      then

         COLOR=red

        DOTCOLOR='&red'

      elif test $EXPIRES -le $WARNTIME

      then

         COLOR=yellow

        DOTCOLOR='&yellow'

      else

         COLOR=green

        DOTCOLOR='&green'

      fi

 
      DOM=`echo $DOMAIN | sed -e 's/\./,/g'`

      $BB $BBDISP "status+12h $DOM.dnsreg $COLOR `date`

 
      $DOTCOLOR Domain $DOMAIN expires on: $EXPIRESTRING
quoted from Japheth Cleaver

 
From: Japheth Cleaver [mailto:user-87556346d4af@xymon.invalid] 
Sent: Friday, September 25, 2015 6:22 PM
To: user-dc5347ce617b@xymon.invalid; xymon at xymon.com
Subject: Re: [Xymon] Color Status GIF for host status page

 
On 9/25/2015 2:36 PM, Rob Steuer wrote:

Hi, 

 
I’ve tried to figure this out, but I need help at this point.  What I’m trying to figure out is how to add a colored GIF status image to a detailed host page.

 
For example, when looking at built in pages like Memory, Disk, Etc. The individual items show a small colored GIF image, green,yellow,red prior to the item [green gif] Physical: 80%.

 
I’ve setup the UPS monitoring using devmon and the dnsreg script and while if I click on those pages it shows a green column/bar all the way to the left, it doesn’t show a green gif dot image next to the item that is tested.  How can this be added?  I’ve looked at the analysis.cfg and thought I was getting close, but I think it must be set/configured in some other way, it is defined on the client or the Xymon server and where?  

 
Rob,

I can't speak to devmon *specifically* but generically speaking, the contents of the status message are controlled by the sender. The hard way to put it in would be to add the HTML IMG tag by hand, but fortunately there's an easier method :) Adding a '&red', '&yellow' or other &color to your status message on a line will cause the web interface to insert the appropriate color GIF for you automatically.

HTH,
-jc
list Jeremy Laidman · Tue, 29 Sep 2015 11:04:41 +1000 ·
On 26 September 2015 at 12:12, Rob Steuer <user-dc5347ce617b@xymon.invalid> wrote:
      $DOTCOLOR Domain $DOMAIN expires on: $EXPIRESTRING

Rob, that's great work.  A couple of suggestions.  Firstly, in some cases
you want the color to be hard up against the next word with no spaces, and
so you need to include a semicolon, like so:

&red;Bad widget smell at 4o'clock

Secondly, you could streamline your code by removing all of the DOTCOLOR=
lines and instead use this at the end:

&$COLOR Domain $DOMAIN expires on: $EXPIRESTRING

This prunes 3 lines of code, and eliminates one variable, with no loss in
readability (IMHO).