[Xymon] Issue with Regex and NORRDDISKS Setting

J.C. Cleaver cleaver at terabithia.org
Wed Mar 2 22:32:05 CET 2016


The 'env' would be unnecessary, however I just realized that you're
running on EL7. systemd strikes again, unfortunately...

The shell wrapper shim is the easiest solution

Create a chmod 755 file /tmp/blah:
====
#!/bin/sh

NORRDDISKS='^(/dev|/tmp|/var)$'
export NORRDDISKS

exec $*
====

Then edit your xymond_rrd CMD line from something like:
   CMD xymond_channel --channel=data xymond_rrd --rrddir=$XYMONVAR/rrd
to
   CMD xymond_channel --channel=data /tmp/blah xymond_rrd
--rrddir=$XYMONVAR/rrd

(same for 'status').

That *should* set it properly. You can remove it from the normal
xymonserver.cfg file if you like.

This is definitely a complete hack, but I'm not sure what the best
long-term fix is, like I said.


HTH,

-jc


On Wed, March 2, 2016 1:01 pm, Matt Vander Werf wrote:
> Hi J.C.,
>
> Adding the '\Z' instead of '$' doesn't seem to work either.
>
> [root@<host> ~]# xymoncmd env | grep NORRD
> NORRDDISKS=^/dev|^/var|^/tmpZ
>
>
> How would I do that shell wrapper launched from tasks.cfg?
>
> I tried to stick it in /etc/sysconfig/xymonlaunch and it came back with an
> error message "Ignoring invalid environment assignment 'env FOO=$':
> /etc/sysconfig/xymonlaunch" and "xymoncmd[15102]: 2016-03-02
> 15:55:16.622168 xgetenv: Cannot find value for variable FOO".
>
> Just putting in FOO='$' without the 'env' didn't work either.
>
>
> Thanks for your help!!
>
> --
> Matt Vander Werf
>
> On Wed, Mar 2, 2016 at 3:06 PM, J.C. Cleaver <cleaver at terabithia.org>
> wrote:
>
>>
>> Hmm. Taking a look at the code, there's not really a provision for
>> escaping in this manner. And unfortunately, this is parsed in various
>> places throughout xymonlaunch (and passed onto the shell).
>>
>> The only workaround that seems to work properly is substitution prior to
>> xymoncmd's reading:
>>
>> in xymonserver.cfg:
>> NORRDDISKS='^(/dev|/tmp|/var)$FOO'
>>
>> then run:
>> env FOO='$' xymoncmd env | grep NORRD
>>
>>
>> You could either place FOO='$' in a shell wrapper launched from
>> tasks.cfg,
>> or stick it way up in /etc/sysconfig/xymonlaunch (if you're using the
>> RPM).
>>
>> I'm tempted to try a patch allowing '$$' to mean an unprocessed '$', but
>> that might interfere with people who want a shell PID for some reason.
>> Alternatively, adding '\' escaping globally in environment files might
>> cause other sorts of problems for folks.
>>
>>
>> Alternatively-alternatively, NORRDDISKS='^(/dev|/tmp|/var)\Z' might work
>> for you, since this *is* just straight PCRE...
>>
>>
>> -jc
>>
>>
>> On Wed, March 2, 2016 11:23 am, Matt Vander Werf wrote:
>> > Hi J.C.,
>> >
>> > It doesn't seem to be working with or without the escape backslash. It
>> > doesn't show up in the env output either way.
>> >
>> > root@<host> ~]# grep NORRDDISK /etc/xymon/xymonserver.cfg
>> > NORRDDISKS="^/dev|^/var|^/tmp$"
>> > [root@<host> ~]# xymoncmd env | grep NORRD
>> > 2016-03-02 14:18:47.151545 xgetenv: Cannot find value for variable
>> > NORRDDISKS=^/dev|^/var|^/tmp
>> >
>> > [root@<host> ~]# grep NORRDDISK /etc/xymon/xymonserver.cfg
>> > NORRDDISKS="^/dev|^/var|^/tmp\$"
>> > [root@<host> ~]# xymoncmd env | grep NORRD
>> > 2016-03-02 14:17:47.233910 xgetenv: Cannot find value for variable
>> > NORRDDISKS=^/dev|^/var|^/tmp
>> >
>> >
>> > When I do it with them grouped together, it gives me the same result:
>> >
>> > [root@<host> ~]# grep NORRDDISK /etc/xymon/xymonserver.cfg
>> > NORRDDISKS="^(/dev|/var|/tmp)$"
>> > [root@<host> ~]# xymoncmd env | grep NORRD
>> > 2016-03-02 14:20:35.984507 xgetenv: Cannot find value for variable
>> > NORRDDISKS=^(/dev|/var|/tmp)
>> >
>> > Any ideas?
>> >
>> > Thanks!!
>> >
>> > --
>> > Matt Vander Werf
>> >
>> > On Wed, Mar 2, 2016 at 11:50 AM, J.C. Cleaver <cleaver at terabithia.org>
>> > wrote:
>> >
>> >>
>> >>
>> >> On Wed, March 2, 2016 8:31 am, Matt Vander Werf wrote:
>> >> > Hello,
>> >> >
>> >> > Looking at past list e-mails, it is my understanding that the
>> >> NORRDDISKS
>> >> > setting in xymonserver.cfg allows for PCRE regular expressions. Is
>> >> this
>> >> > correct? Or does it only allow certain PCRE regular expressions,
>> but
>> >> not
>> >> > everything?
>> >> >
>> >> > I ask because I'm experiencing an issue with my NORRDDISKS setting.
>> >> >
>> >> > I'd like to ignore disks for graphing that have mount points
>> "/tmp",
>> >> but
>> >> > not ignore disks with mount points that have "tmp" in them, like
>> >> > "/tmpscratch".
>> >> >
>> >> > I noticed that for other disk mount point names that if you just
>> use
>> >> > "^/<name>" with no modifiers, then it only ignores disk mount
>> points
>> >> with
>> >> > only exactly "^/<name>" and not "^/<name><additional text>" or
>> >> > "^/<name>/<more name>" (at least from what I can tell).
>> >> >
>> >> > For example when using:
>> >> >
>> >> > NORRDDISKS="^/dev|^/tmp|^/var"
>> >> >
>> >> > It ignores disks with mount points "/dev" and "/var", but also
>> "/tmp"
>> >> AND
>> >> > "/tmpscratch". But it doesn't look like it ignores "/var/tmp" (at
>> >> least
>> >> as
>> >> > far as I can tell).
>> >> >
>> >> > I tried using "^/tmp$" and that didn't work either (still ignored
>> both
>> >> > names).
>> >> >
>> >> >
>> >> > Any idea what's going on here? Or how this can be done correctly?
>> Is
>> >> the
>> >> > "$" metacharacter not allowed in this setting?
>> >> >
>> >> >
>> >> > If it's needed, I'm running the latest 4.3.26-1 Terabithia RPM on
>> RHEL
>> >> 7.
>> >> >
>> >> > Thanks for any help!!
>> >> >
>> >> > --
>> >> > Matt Vander Werf
>> >>
>> >>
>> >> Try checking the output of 'xymoncmd env | grep NORRD' ? If the '$'
>> is
>> >> not
>> >> coming through, it might be getting read in as an attempt at a shell
>> >> variable.
>> >>
>> >> If so, can you try escaping it as \$ instead?
>> >>
>> >> Alternatively: '^(/dev|/tmp|/var)$'
>> >>
>> >>
>> >> HTH,
>> >> -jc
>> >>
>> >>
>> >
>>
>>
>>
>





More information about the Xymon mailing list