Add osx agent, OSX-compatible mk-job#145
Conversation
75d0ad6 to
9ed3f1b
Compare
| # is a sub directory per user that ran a job. That directory must be | ||
| # owned by the user so that a symlink or hardlink attack for reading | ||
| # arbitrary files can be avoided. | ||
| JOB_DIR="$MK_VARDIR/job" |
There was a problem hiding this comment.
This is new code added by me: Add OSX version of mk-job
| print $1,$7,$5,$6,"0","0","0","0","0",$10,$8,$9,"0","0",$11,"0","0"; }' | ||
| # FIXME: send netstat -inb plain, write proper check plugins for | ||
| # clean parsing of the output | ||
| # Mac version of lnx_if. Needs `iproute2mac` to have been installed. |
There was a problem hiding this comment.
This is new code: replace netctr with osx version of lnx_if
|
Hello catchdave, thank you for this pull request. We will have a closer look at your patch and discuss internally on how and if we can implement it into the official code base. Internal Ref: CMK-4103 |
|
I have tested your proposed MacOS Agent on my MacMini's with macOS 10.15.4. Regarding the |
Notausstieg0309
left a comment
There was a problem hiding this comment.
I would suggest some slight changes to get a bit closer to the linux agent implementation/behavior.
| export MK_LIBDIR='/usr/local/lib/check_mk_agent' | ||
| export MK_CONFDIR='/etc/check_mk' | ||
| export MK_VARDIR='/var/lib/check_mk_agent' |
There was a problem hiding this comment.
Please honor the environment before using the default paths as the official linux agent does as well:
| export MK_LIBDIR='/usr/local/lib/check_mk_agent' | |
| export MK_CONFDIR='/etc/check_mk' | |
| export MK_VARDIR='/var/lib/check_mk_agent' | |
| export MK_LIBDIR=${MK_LIBDIR:-/usr/local/lib/check_mk_agent} | |
| export MK_CONFDIR=${MK_CONFDIR:-/etc/check_mk} | |
| export MK_VARDIR=${MK_VARDIR:-/var/lib/check_mk_agent} |
These paths can be configured via the launch daemon definition to a custom path without modifying the agent.
| ;; | ||
| esac | ||
| done | ||
| elif type osx-cpu-temp >/dev/null |
There was a problem hiding this comment.
According to Linux Agent, this line should be changed by inserting and using the inpath() function as in the Linux agent:
# Function to replace "if type [somecmd]" idiom
# 'command -v' tends to be more robust vs 'which' and 'type' based tests
inpath() {
command -v "${1:?No command to test}" >/dev/null 2>&1
}
|
Hi catchdave, I am sorry to close this PR, in particular because it took us so long. Cheers, |
Change-Id: Ifd9ff34051096968f6ef6c4b104583c90dd357c8
Better OSX agent:
lnx_ifsince the originalnetctris no longer supported in check_mk.<<<job>>>). Different than original sinceheadis non-GNUModified mk-job for OSX
timedoes not work as written. It is common for OSX systems to use brew to install GNU-tools, so mk-job will now work as long asgnu-timeis installed.Installer for OSX agent
I could not find instructions for installing the OSX agent anywhere. So I put together a simple script that I used to install on my mac machines. I have done ZERO testing outside of my 2 machines.