[Xymon] Strange issue when using local scripts (in linux)

David Boyer davieb at gmail.com
Tue Aug 4 02:56:17 CEST 2020


Jeremy,
       If you notice, both iterations are being run from the xymonsvr.
I've added the LANG to see if the
two report it differently.

So, by hand it looks:

[davieb at xymonsvr ~]$ ~xymon/client/local/dateinfo
dhcp-common,4.3.6,18 Jul 2020,en_US.UTF-8

Pulling the info out of xymon looks:

[davieb at xymonsvr ~]$ ~xymon/server/bin/xymon localhost "clientlog xymonsvr
section=local:dateinfo"
[local:dateinfo]
dhcp-common,4.3.6,Jul 18 17:44:26,*C*

Humm, there does appear to be a difference!  Checking the xymon user
itself, it UTF-8.
[xymon at xymonsvr ~]$ echo $LANG
en_US.UTF-8


That appears to be the issue though, I set the LANG=C and ran the script by
hand and get the same results when I pull it from xymon!
[davieb at xymonsvr ~]$ LANG=C;export LANG
[davieb at xymonsvr ~]$ ~xymon/client/local/dateinfo
dhcp-common,4.3.6,Jul 18 17:44:26,C

Looking at the xymon.sh start script, it does not appear to set it
anywhere!  Guess I'll need to run that
to ground in the morning.

Thanks for pointing me in the right direction!

Dave

On Mon, Aug 3, 2020 at 8:11 PM Jeremy Laidman <jeremy at laidman.org> wrote:

> David
>
> Update your script to, display the value of the LANG variable in addition
> to the RPM details (perhaps on a separate line), and see if the value
> differs between the script output (run from your shell) and the clientlog.
>
> I suspect LANG is set in your shell differently from how it's set in the
> xymon user's shell. RPM (or probably glibc) uses LANG to format the date
> according to the environment's locale. I'm guessing your shell has LANG set
> to something like en_US, whereas the xymon user's LANG is set to something
> like C, or is not set at all.
>
> Cheers
> Jeremy
>
> On Tue, 4 Aug 2020 at 08:32, David Boyer <davieb at gmail.com> wrote:
>
>> Hi,
>>     I've got a strange date issue.  I've written some local scripts to
>> pad information onto the combo message. Here is the background:
>>
>> 1. When you run the script by hand locally (take note of the date):
>>
>> [davieb at xymonsvr ~]$ ~xymon/client/local/dateinfo
>> dhcp-common,4.3.6,18 Jul 2020
>>
>> 2. When I pull the information from xymon server:
>>
>> [davieb at xymonsvr ~]$ ~xymon/server/bin/xymon localhost "clientlog
>> xymonsvr section=local:dateinfo"
>> [local:dateinfo]
>> dhcp-common,4.3.6,Jul 18 17:44:26
>>
>>
>> Notice how the date field gets modified?  I can't figure out why. The
>> only thing I can think of is something within the xymon code, but I don't
>> know why it would?
>>
>> Here's the simple script:
>>
>> [davieb at xymonsvr ~]$ cat ~xymon/client/local/dateinfo
>> #!/bin/sh
>>
>> OS=`uname -s`
>> RPM=dhcp-common
>>
>> if [ ${OS} = "Linux" ]; then
>>    VERSION=`rpm -q ${RPM} --qf "%{VERSION}\n"`
>>    INSTALLED=`rpm -q ${RPM} --qf "%{INSTALLTIME:date}\n"|awk {'print $2"
>> "$3" "$4'}`
>> fi
>>
>> echo "${RPM},${VERSION},${INSTALLED}"
>>
>> Does anybody have any idea what is going on?
>>
>> Thanks,
>> Dave
>> _______________________________________________
>> Xymon mailing list
>> Xymon at xymon.com
>> http://lists.xymon.com/mailman/listinfo/xymon
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20200803/46105fd3/attachment.htm>


More information about the Xymon mailing list