Skip to content

Instantly share code, notes, and snippets.



Forked from sts/mrped
Last active Feb 16, 2021
What would you like to do?
#!/usr/bin/env zsh
# MK's Remote Plugin Executor NG ;-)
# Workaround for check_mks inability to use scripts from a mrpe.d directory
# Make sure mrpe.cfg doesn't exist, or you will end up with two <<<mrpe>>>
# output sections.
set -o pipefail
if [[ -e /etc/mrpe.conf ]]
echo "mrpe.conf should not exist when running mrped"
exit 1
if [ "$(ls -A /etc/check_mk/mrpe.d)" ] ; then
echo '<<<mrpe>>>'
grep -rhEv '^[[:space:]]*($|#)' "/etc/check_mk/mrpe.d" |
while read descr cmdline
PLUGIN=${cmdline%% *}
OUTPUT=$(eval "$cmdline" | tr \\n \\1)
echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT"
pids=(${pids[@]} $!)
for j in ${pids[@]}; do
wait $j &> /dev/null

This comment has been minimized.

Copy link
Owner Author

@Grauwolf Grauwolf commented Jan 9, 2014

Should probably do this with GNU Parallel instead.


This comment has been minimized.

Copy link

@sts sts commented Jan 31, 2014

Paralysed! :-) Thanks Farhad!

Downside: Currently its a drop in replacement ; GNU Parallel isn't installed on all systems and adds an additional dependency.

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