Skip to content

Instantly share code, notes, and snippets.

@catchdave
Last active September 28, 2024 23:47
Show Gist options
  • Save catchdave/44c45e31951fcc9ee4fb8768f4d95f21 to your computer and use it in GitHub Desktop.
Save catchdave/44c45e31951fcc9ee4fb8768f4d95f21 to your computer and use it in GitHub Desktop.
Install check_mk agent on OSX
# Clone Repo
git clone https://github.com/ThomasKaiser/Check_MK.git
cd Check_MK
# Remove less common plugins
rm -f agents/plugins/monitor-jss-and-macos-updates agents/plugins/city-temperatures agents/plugins/monitor-kerio agents/plugins/smart*
# Install dependencies
brew install smartmontools osx-cpu-temp
# Modify the plist file (remove cwd)
sed -i '' '/<key>WorkingDirectory/{N;d;}' LaunchDaemon/de.mathias-kettner.check_mk.plist
# Create directories needed and copy files to required location
mkdir /usr/local/lib/check_mk_agent
mkdir /usr/local/lib/check_mk_agent/local
cp agents/check_mk_agent.macosx /usr/local/lib/check_mk_agent/
cp -r agents/plugins/ /usr/local/lib/check_mk_agent/
sudo cp LaunchDaemon/de.mathias-kettner.check_mk.plist /Library/LaunchDaemons/
ln -s /usr/local/lib/check_mk_agent/check_mk_agent.macosx /usr/local/bin/check_mk_agent
mkdir /etc/check_mk
sudo touch /var/run/de.arts-others.softwareupdatecheck
sudo touch /var/log/check_mk.err
# Permissions
chmod +x /usr/local/lib/check_mk_agent/check_mk_agent.macosx
sudo chmod o+rw /var/run/de.arts-others.softwareupdatecheck
sudo chmod 666 /var/log/check_mk.err
sudo chown -R root:admin /usr/local/lib/check_mk_agent
sudo chmod 644 /Library/LaunchDaemons/de.mathias-kettner.check_mk.plist
# Install LaunchDaemon
sudo launchctl load -w /Library/LaunchDaemons/de.mathias-kettner.check_mk.plist
# Once lnx_if fix is merged into the agent, the below is required (see: https://github.com/ThomasKaiser/Check_MK/pull/2)
brew install iproute2mac
@catchdave
Copy link
Author

I couldn't find instructions anywhere for how to install CMK agent onto a OSX machine. Above is what finally got things to work for me

@sergiodadi
Copy link

Hi, thank you very much for this script. It helped me a lot !

Serge

@taka7fd3s
Copy link

Thank you for your efforts.
I could setup macOS agent for checkmk and it looks to be running fine.

Mac mini 2018
macOS Ventura Version 13.1

PS. It faild at 'mkdir /etc/check_mk'.
I created it manually after the script had ran.

Regards,
Taka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment