check_mk_agent and ESXi 4.1

Decided to add our Esx servers to our check_mk monitoring suite today, ran into two small issues.

1. check_mk_agent uses bash interpreter – ESXi (4.1) uses ash
2. afaict, check_mk_agent relies on xinitd, ESXi uses inetd.

Solution?

Download the check_mk_agent package rpm for esx/linux and extract the usr/bin/check_mk_agent script and usr/bin/waitmax

Edit the first line of check_mk_agent to be

#!/bin/sh

save and exit, then scp both files to /usr/bin on the ESXi server.

ssh ./{waitmax,check_mk_agent} root@esx-host:/usr/bin

Next, scp /etc/services and /etc/inetd.conf from the ESXi server and make the following changes.

./services
Add line:

check_mk 6556/tcp check_mk_agent   # check MK agent

./inetd.conf
Add line:

check_mk stream   tcp   nowait   root   /usr/bin/check_mk_agent check_mk_agent

Upload the files back to the ESXi host and your (almost) done!

This is the basic jist of how to get it working but there’s a far easier way to do this on many hosts. I for one automated the process by creating a payload package, a deployment script and setup ssh keys.

Of course, then next part is to actually make this stuff persistent.