=== modified file 'nagios/bin/pmp-check-mysql-deleted-files' --- nagios/bin/pmp-check-mysql-deleted-files 2013-11-25 12:47:56 +0000 +++ nagios/bin/pmp-check-mysql-deleted-files 2013-12-10 15:18:18 +0000 @@ -29,6 +29,7 @@ for o; do case "${o}" in -c) shift; OPT_CRIT="${1}"; shift; ;; + -C) shift; OPT_COMM="${1}"; shift; ;; --defaults-file) shift; OPT_DEFT="${1}"; shift; ;; -H) shift; OPT_HOST="${1}"; shift; ;; -l) shift; OPT_USER="${1}"; shift; ;; @@ -52,6 +53,10 @@ fi fi + if [ "" = "${OPT_COMM}" ]; then + OPT_COMM="mysqld"; + fi + # If any connection option was given, then try to log in to find the server's # tmpdir. if [ "${OPT_DEFT}${OPT_HOST}${OPT_USER}${OPT_PASS}${OPT_PORT}${OPT_SOCK}" ]; then @@ -62,7 +67,7 @@ # TODO: We could auto-check every running instance, not just one. local NOTE="OK no deleted files" - local PROC_ID=$(_pidof mysqld | head -n1) + local PROC_ID=$(_pidof "$OPT_COMM" | head -n1) if [ "${PROC_ID}" ]; then local TEMP=$(mktemp -t "${0##*/}.XXXXXX") || exit $? trap "rm -f '${TEMP}' >/dev/null 2>&1" EXIT @@ -99,7 +104,7 @@ # ######################################################################## _pidof() { if ! pidof "${1}" 2>/dev/null; then - ps axo pid,ucomm | awk -v comm="${1}" '$2 == comm { print $1 }' + ps axo pid,command | awk -v comm="${1}" '$2 == comm { print $1 }' fi }