[Xymon] Configuring Devmon for the first time

John P Martin jmartin23 at csc.com
Thu Jun 2 09:37:01 CEST 2011


I agree it's a bit off-topic, but just to answer the question:

The "x" prefix for testing variables (more commonly the upper case "X",
because that's the example in the man page :-) is common practice to avoid
the test getting confused by unexpected values in the variable,  In
particular, the test tends to throw the comparison out if the variable
should start with a "-".  Prefixing the variable would convert this to
"X-", which is correctly processed by the test comparison.

For example:

VAR="-value"

[ "$VAR" == "something" ] will fail, trying to process "-value" as a
qualifier.

[ "X$VAR" == "Xsomething" ] will correctly find an inequality

              Cheers,

                        John

JOHN MARTIN



                                                                                                      
  From:       Ryan Novosielski <novosirj at umdnj.edu>                                                   
                                                                                                      
  To:         xymon at xymon.com                                                                         
                                                                                                      
  Date:       31/05/2011 08:22                                                                        
                                                                                                      
  Subject:    Re: [Xymon] Configuring Devmon for the first time                                       
                                                                                                      





-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The X is a trick that deals with empty variables, and I suppose keeps
some interpreters from complaining about doing a test on a blank variable.

I've seen this done frequently enough to know that people do it, but I
agree, it looks a little odd and I'm not sure I'd write a program that
way myself. This is off topic, but I'd love to know if anyone has any
comments on that particular thing. Shortcut to avoid needing to check
for empty variables I guess?

On 05/31/2011 12:57 AM, Josh Luthman wrote:
> That probably makes more sense then to use Lynx, good idea.
>
> What's with the "x" in the variable?
>
> Would you mind telling me what values you used for date?
>
> Josh Luthman
> Office: 937-552-2340
> Direct: 937-552-2343
> 1100 Wayne St
> Suite 1337
> Troy, OH 45373
>
>
> On Tue, May 31, 2011 at 12:53 AM, David Baldwin
> <david.baldwin at ausport.gov.au <mailto:david.baldwin at ausport.gov.au>>
wrote:
>
>     On 31/05/11 11:24 AM, kconnell at ryerson.ca
>     <mailto:kconnell at ryerson.ca> wrote:
>     > I've had issues with devmon not updating the bb-display and
>     everything going purple.
>     > I've had this issue since day one (which is over two years now).
>     >
>     > I created a "devmon watchdog" script that's runs every 5 min using
>     lynx (txt base html browser) which checks if the status of devmon
>     (shows as dm test) on bb-monitor. If its purple then I kill the
>     devmon process and start it up again....band-aid solution, but it
>     does the trick.
>     >
>     > I no script expert, but can share the bash script if you want/need.
>     >
>     Here's mine (replace xymonserver with your hostname):
>
>     #!/bin/sh
>     COL=`bb xymonserver "hobbitdboard xymonserver.dm
>     <http://xymonserver.dm> fields=color"`
>     if [ "x$COL" == "xpurple"  ] ; then
>      (date "+%x %X restarting purple devmon"
>      /etc/init.d/devmon restart) | tee /var/log/devmon-restart.log | mail
>     -s "Restarting devmon" xymonadmin
>     fi


- --
- ---- _  _ _  _ ___  _  _  _
|Y#| |  | |\/| |  \ |\ |  | |Ryan Novosielski - Sr. Systems Programmer
|$&| |__| |  | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922)
\__/ Univ. of Med. and Dent.|IST/CST-Academic Svcs. - ADMC 450, Newark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3kiUMACgkQmb+gadEcsb5yCwCg2I2+K79zvEHjbvpVrPyEf3vg
XTgAoIdr0SfWmctf+B41YHb1y6XMXJz7
=o/i3
-----END PGP SIGNATURE-----
[attachment "novosirj.vcf" deleted by John P Martin/GIS/CSC]
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon






More information about the Xymon mailing list