[Xymon] Need client for Mac hosts

Ralph M ralphmitchell at gmail.com
Sat Dec 23 23:21:30 CET 2023


My remote client thing is similar to yours, Jeremy, except it's essentially
stripped right down to target four specific servers.

There's the actual client script, installed on each remote server.  There's
a script on a local server that SSH's to each remote server to execute that
script.  There's a cron entry to fire it up.  The cron entry could be a
task, but it's running on a xymon client and I wanted to keep this stuff in
its own little bucket.  The xymonclient script takes care of the [clock]
section using the date command, no need for any compiled binary on the
remote machine.

On the remote machines, create somewhere to park the script.  I
used /opt/xymon/bin.  Copy the xymonclient.sh script in there.  Modify
according to the OS type.  I'm on Linux, MAC/Darwin may be different.

On your local machine, drop the remote_xymon.sh script somewhere accessible
and modify to fit your environment.  Mine hits four remote servers.  It
SSHs to each remote to execute the client script.  Output from the client
streams back through the SSH connection and is piped into the Xymon binary
on the local machine, to deliver to the Xymon server.  The client header
identifies where the report came from, so no worries there.

Also on your local machine, add a cron job (or Xymon task) similar to this
to fire the remote_xymon.sh script every five minutes:

     */5 * * * * /home/lnxadm/bin/remote_xymon.sh >
/home/lnxadm/log/remote_xymon.out 2>&1

The lnxdm user has SSH keys to go everywhere it needs to go.

I hacked up the xymonclient.sh script to include the Linux client bits and
what little was required from the xymonclient.cfg file.  It was intended
solely for four remote servers so it didn't need to be general enough to
work everywhere.  Didn't need to be pretty either..... :)

There's no binary required on the remote, just standard command line
programs.  Look for the [...] labels and try out each command to make sure
your Mac/Darwin performs properly.

Ralph Mitchell


On Fri, Dec 22, 2023 at 10:20 PM Jeremy Laidman <jeremy at laidman.org> wrote:

> Ah, I forgot to mention: as a bonus, the thin-client script/approach is
> trivial to use over ssh, which satisfies a number of security concerns with
> Xymon traffic, namely encryption and authentication, in addition to
> questions about perceived "unsupported binaries that can't/wont be
> patched". It's likely to be my deployment method in future, until a future
> release of Xymon natively achieves these goals.
>
> J
>
> On Sat, 23 Dec 2023 at 14:02, Jeremy Laidman <jeremy at laidman.org> wrote:
>
>> The only binary that the Xymon client actually requires for all data
>> collecting features is the logfetch program. This is only used for three
>> things: 3) to get the log messages since the last time it was run (and keep
>> track of its position in the log files) for MSGS entries in analysis.cfg,
>> 2) to get file and dir information for "FILE" and "DIR" entries in
>> analysis.cfg, and 1) to get the timestamp for the [clock] section of the
>> client data message. If you don't need any of these features, then you can
>> simply copy the xymonclient.sh and xymonclient-darwin.sh scripts into place
>> and run the former, which executes the latter. Almost.
>>
>> What else would be missing is the xymon binary, which is used by
>> xymonclient.sh to send the client data message it has constructed, to the
>> Xymon server. You have a few options here. You could copy "xymon" onto your
>> Mac, and setup the environment appropriately, and it would probably work
>> just fine. Or instead use one of the
>> <https://xymon.sourceforge.io/xymon/help/xymon-tips.html#noinstall>bash,
>> perl or telnet scripts that emulate the Xymon client binary.
>>
>> The xymond-rclient.sh script mentioned by others would probably do what
>> you want also. It essentially copies the client .sh files through an SSH
>> connection, every time it runs. To be honest, I don't think this is the
>> best option - the rclient script is really only a last resort for
>> unsupported platforms that run UNIXy operating systems, as it's a massive
>> and not well-structured script that probably has bugs galore, probably uses
>> far more resources than it deserves, and also seems to uncover
>> idiosyncrasies in some versions of UNIX that trip it up. Feel free to give
>> it a go, and if it works, let the author (yours truly) know so Darwin/MacOS
>> can be added to the "works on" list.
>>
>> There is an alternative to rclient that might work for you. Let me know
>> if you're interested. It's a lot leaner and simpler (the comments, error
>> handling and argument parsing are probably more lines than the core code
>> that does the work). I call it a "thin client" because that it's a Xymon
>> client with the absolute bare minimum. It was specifically written so that
>> no foreign (to the OS) binaries are required, and it provides most of the
>> client features using only shell scripts and built-in OS binaries.
>>
>> This "thin client" script essentially runs the xymonclient-<OS>.sh
>> script, captures the output, appends a [clock] section, prepends the Xymon
>> message header for a client message, and that's it. How you get the output
>> to the Xymon server is then up to you. You could send the output to a file,
>> and collect it periodically using rsync/scp/NFS. If you want your clock
>> timestamp to be useful, you probably want to run it in real time, so from
>> your Xymon server you can do "ssh <host> /usr/local/bin/xymon-thin-client |
>> xymon 127.1 @" - probably run from a tasks.cfg entry. In your case, you
>> just need the thin client script and the xymonclient-darwin.sh script on
>> your Mac, plus an ssh key in ~xymon/.ssh/authorized_keys, then with a
>> suitable task on your Xymon server you're done.
>>
>> Just to re-state the caveat: because logfetch is not used, what's missing
>> is log message collection and file/dir data required for MSGS, FILE and DIR
>> checks in analysis.cfg.
>>
>> Cheers
>> Jeremy
>>
>>
>> On Fri, 22 Dec 2023 at 18:38, Brian Scott <bscott at bunyatech.com.au>
>> wrote:
>>
>>> Hi Kris,
>>>
>>> There's more to it than that. You need something to run it regularly and
>>> you need some way of getting the output back to your server.
>>>
>>> The stock standard way is like any other unix/linux system. You have a
>>> program called xymonlaunch running full time on the system. At regular (5
>>> minute) intervals and under control of clientlaunch.cfg, it loads up the
>>> environment from the config file (xymonclient.cfg) and kicks in the
>>> xymonclient.sh script into action. This script does various pieces of
>>> housekeeping and runs the architecture dependant script (in your case
>>> xymonclient-darwin.sh). It then runs the binary file xymon to send the
>>> results back to your server.
>>>
>>> As Ralph has pointed out, you can avoid running xymonlaunch and schedule
>>> the process using cron or whatever apple uses for running jobs these days.
>>> These is no systemd or init.d processing on a Mac. It's much uglier 😛.
>>>
>>> The other approach is to use the rclient script.
>>>
>>> Assuming you have ssh access to the Mac, you set up a certificate based
>>> ssh login on the Mac. On your server you then schedule regular running of
>>> the rclient script. This works through each required system and runs the
>>> script as a sequence of commands over ssh, capturing the output and handing
>>> it back to the main xymon processes. The advantage of this is that your
>>> don't need any binaries on the target system, just an ssh login. Setting up
>>> rclient and ssh keys could be a little daunting if you're not familiar with
>>> that sort of thing.
>>>
>>> If you have a Mac laptop with Apple's developer tools installed, you
>>> could build your own binaries. Download the whole xymon source archive,
>>> unpack it and run 'configure --client'. Follow the prompts to install the
>>> result in an out of the way place (I use /usr/local/xymon). When built,
>>> copy that whole directory over to your target machine. Apple have recently
>>> changed processors from intel to arm so you need to make sure you are
>>> building compatible binaries. This approach is going to be much safer than
>>> trusting some random person on the internet to give you pre-compiled
>>> binaries to run.
>>>
>>> Alternatively, installing via homebrew would be relatively painless and
>>> a little more trustworthy. It's actually quite simple and well designed.
>>>
>>> Hope some of this helps,
>>>
>>> Brian
>>> On 22/12/2023 1:57 pm, IO Support wrote:
>>>
>>> So I copied xymonclient-darwin.sh onto a Mac laptop I have and just ran
>>> it from a terminal to see if it would do anything.  It did display a lot of
>>> great info in the terminal, but there's nothing in the script that dumps
>>> the output to a tmp file or points to a Server address.  So I pulled a few
>>> more files from the Sourceforge /client/ folder in the hopes that the
>>> script would look for the xymonclient.cfg and send some data to the
>>> server.  Running the xymonclient.sh script tries to do somethings, but it's
>>> looking for things in paths that don't exist since I'm not actually
>>> installing anything, I'm just manually running a script.  I'm obviously
>>> missing some vital piece of this puzzle.  Does anyone have some simple
>>> instructions or point me at whatever it is I'm missing here?  I find it
>>> hard to believe there isn't someone out there that's got this figured out
>>> already.
>>>
>>> Thank You,
>>> Kris Springer
>>>
>>>
>>> On 12/20/23 12:47 AM, Ralph M wrote:
>>>
>>> As far as autostart goes, I have a bunch of clients running from cron.
>>> Forget runclient.sh, just start the main xymonclient.sh every five
>>> minutes.  That is, you don't need to fight with systemd or init.d to get
>>> the client to report.
>>>
>>> Ralph Mitchell
>>>
>>>
>>> On Wed, Dec 20, 2023 at 1:27 AM Brian Scott <bscott at bunyatech.com.au>
>>> wrote:
>>>
>>>> A few years ago I built a client for a Macos server. The target server
>>>> is quite a few versions of macos old so probably not what you are looking
>>>> for. I just built it on my Mac laptop then bundled it all up in a tar file
>>>> and copied it over and did some installation. My current laptop is an M2 so
>>>> I doubt I could do it again right now.
>>>>
>>>> As I recall the xymonclient-darwin script was mostly fine. There was a
>>>> little entertainment with the way Apple manages it's disks these days. I've
>>>> attached what looks like the changes I made as a diff.
>>>>
>>>> I'm not at $work at the moment so I can't check exactly what else I
>>>> did. I must have done something to get it to auto start at boot. Probably
>>>> didn't keep any notes either. I'll try to have a look next time I'm there.
>>>>
>>>> Also quite possible that rclient will work well. There's some fixes
>>>> that I had to do recently to account for some dropped commands from rclient
>>>> when talking to FreeBSD systems so that may also be relevant.
>>>>
>>>> Cheers,
>>>>
>>>> Brian
>>>>
>>>>
>>>> On 19/12/2023 3:58 pm, Ralph M wrote:
>>>>
>>>> I would guess the script in the repository is the latest version.  I'm
>>>> not a Mac user, so take that as an opinion, not a fact.  As part of the
>>>> main distribution, any changes would have been rolled into that file.
>>>>
>>>> Ralph Mitchell
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Dec 18, 2023 at 11:04 PM IO Support <support at ionetworkadmin.com>
>>>> wrote:
>>>>
>>>>> Where would I obtain a semi-current xymonclient-darwin.sh script?  I
>>>>> will try to use the one I found in the latest branch on Sourceforge that JC
>>>>> has been working on, but it was last edited in 2015.
>>>>> https://sourceforge.net/p/xymon/code/HEAD/tree/branches/4.x-master/client/xymonclient-darwin.sh
>>>>>
>>>>> Does anyone have anything a little more current that they use?
>>>>>
>>>>> Thank You,
>>>>> Kris Springer
>>>>>
>>>>>
>>>>>
>>>>> On 12/14/23 12:21 PM, Ralph M wrote:
>>>>>
>>>>> Would this do it for you??
>>>>>
>>>>>      http://tools.rebel-it.com.au/xymon-rclient/
>>>>>
>>>>> Nothing to install on the remote host, other than SSH keys.  It fires
>>>>> the appropriate xymonclient-[OS].sh script down the SSH connection and
>>>>> collects the results.  I don't know anything about Macs, but the
>>>>> xymonclient-darwin.sh script is for MacOS X so that might be a good
>>>>> starting point.
>>>>>
>>>>> Ralph Mitchell
>>>>>
>>>>>
>>>>>
>>>>> On Thu, Dec 14, 2023 at 2:38 AM I/O Network Administration <
>>>>> support at ionetworkadmin.com> wrote:
>>>>>
>>>>>> Anyone have a modern xymon-client script or app that will run on Mac?
>>>>>> I'm aware of the macport method, but that's a large footprint and heavy
>>>>>> handed solution to the simple need of collecting performance data and
>>>>>> uploading it to the Server.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thank You,
>>>>>> Kris Springer​
>>>>>> I/O Network Administration
>>>>>> https://www.ionetworkadmin.com
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Xymon mailing list
>>>>>> Xymon at xymon.com
>>>>>> http://lists.xymon.com/mailman/listinfo/xymon
>>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> Xymon mailing listXymon at xymon.comhttp://lists.xymon.com/mailman/listinfo/xymon
>>>>
>>>> _______________________________________________
>>>> Xymon mailing list
>>>> Xymon at xymon.com
>>>> http://lists.xymon.com/mailman/listinfo/xymon
>>>>
>>>
>>> _______________________________________________
>>> Xymon mailing listXymon at xymon.comhttp://lists.xymon.com/mailman/listinfo/xymon
>>>
>>>
>>> _______________________________________________
>>> Xymon mailing list
>>> Xymon at xymon.com
>>> http://lists.xymon.com/mailman/listinfo/xymon
>>>
>> _______________________________________________
> 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/20231223/d7419247/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xymonclient.sh
Type: application/x-shellscript
Size: 3521 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20231223/d7419247/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: remote_xymon.sh
Type: application/x-shellscript
Size: 540 bytes
Desc: not available
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20231223/d7419247/attachment-0001.bin>


More information about the Xymon mailing list