|
Categories
|
|
|
|
Kris Springer's Tech Blog - Xymon Client for MacOS
Xymon Client for MacOS |
8-1-24 Kris Springer |
There has never really been a Xymon Client for MacOS. There is a way to install the linux client via Macports, but the code is 10 years old and it doesn't report correct results because MacOS has changed so significantly since that original code was made, so it's useless. So I took it upon myself to build one. I started with the Windows Powershell client as a baseline template and went about creating a Powershell script to use as a MacOS Xymon Client. After many renditions, nearly giving up, and collaboration with ChatGPT and the Xymon Mailing List, I've at long last got a script that can be used in the real-world as a Xymon MacOS Client.
It should be noted that it's communication with the Xymon Server is 1-way, meaning that the 2-way 'client-local.cfg' communication built into Linux and Windows clients is non-existent in my MacOS client at this time. Perhaps I can add it in the future if there's a good reason to put myself through the firestorm of headache that it would inevitably take to accomplish that. For now I don't care about that functionality.
I may also package it up into a DMG download for easy clickable installation in the future. We'll see if I have a need for that or not.
IMPORTANT PRE-REQ'S:
- I'm assuming you already have a functioning Xymon Server that can collect data, and you understand how to administrate it.
- You have Admin access on the Mac. You'll need this to install Homebrew, Powershell, and create the daemon that runs the script every 5 minutes.
- Here's the raw xymonclient-mac.ps1 script if you want to look at it.
ON MAC CLIENT MACHINE:
- Open a terminal
- Install Homebrew by running these 3 commands.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> /Users/sysadmin/.zprofile
eval "$(/usr/local/bin/brew shellenv)"
- Install Powershell
brew install --cask powershell
- Create new xymon folder in /usr/local/
sudo mkdir -p /usr/local/xymon
cd /usr/local/xymon
- Download the ps1 script
sudo curl -o /usr/local/xymon/xymonclient-mac.ps1 'https://krisspringer.com/posts/img/xymonclient-mac.ps1'
- Edit the script to define your Xymon Server's URL or IP
sudo nano /usr/local/xymon/xymonclient-mac.ps1
- Make the xymonclient-mac.ps1 file executable
sudo chmod +x /usr/local/xymon/xymonclient-mac.ps1
- Run it manually to make sure your Xymon Server is receiving data from this new host
sudo pwsh /usr/local/xymon/xymonclient-mac.ps1
- Fix the permissions so we can automate it.
sudo chown root:wheel /usr/local/xymon/xymonclient-mac.ps1
sudo chmod 755 /usr/local/xymon/xymonclient-mac.ps1
- Create the LaunchDaemon to automate it to run every 5 minutes and to auto-start at bootup.
You can use your own domain name in the plist filename and plist config if you want to.
sudo nano /Library/LaunchDaemons/com.ionetworkadmin.xymonclient.plist
Put this in the plist file.
Label
com.ionetworkadmin.xymonclient
ProgramArguments
/usr/local/bin/pwsh
/usr/local/xymon/xymonclient-mac.ps1
StartInterval
300
RunAtLoad
StandardOutPath
/var/log/xymonclient.out
StandardErrorPath
/var/log/xymonclient.err
UserName
root
- Start it.
sudo launchctl load /Library/LaunchDaemons/com.ionetworkadmin.xymonclient.plist
ON XYMON SERVER:
- Check the Ghost Clients list to see your new host.
- Add the new host to your Xymon hosts.cfg file.
|
|
|
|
|