AIX Open Source

 View Only
  • 1.  Issue with SYSV management script for "nrpe" agent

    Posted Tue May 25, 2021 04:17 PM

    Toolbox Package = nagios-nrpe-4.0.3-1.ppc

    There are issues with the nrpe SYSV management script in /etc/rc.d/init.d/nrpe

    Specifically, it's not correctly using the PIDFILE to manage the current invocation.

    Example:

    nrpe isn't currently running:

    # ps -eaf |grep nrpe
    #

    Start nrpe:

    # /etc/rc.d/init.d/nrpe start
    Starting NRPE daemon... done.
    #

    It's now running:

    # ps -eaf | grep nrpe
    root 20709472 1 0 13:27:39 - 0:00 /opt/freeware/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
    #

    However, management script doesn't see it's running:

    # /etc/rc.d/init.d/nrpe status
    NRPE daemon is not running.

    In the script, it's looking for the PID file to be PIDFILE or /var/run/nagios-nrpe/nrpe.pid

    start)
    if [ -r ${PIDFILE} ]; then
    pid=`$CAT ${PIDFILE}`
    if [ "`$PS -ef | $GREP -v grep | $GREP ${PROG} | $GREP ${pid} | $AWK '{ print $2 }' | $GREP ${pid}`" = "${pid}" ]
    ; then
    $ECHO "NRPE daemon is already running with PID ${pid}."
    exit 1
    else
    $RM -f ${PIDFILE}
    fi
    fi
    $PRINTF "Starting NRPE daemon... "

    ## start daemon and write PID to file ${PIDFILE}
    $MKDIR -p /var/run/${NAME}
    ${PROG_BIN} -c ${NRPE_CONFIG} -d
    $ECHO "done."
    ;;

    As you can see, it never writes the PID file.

    This prevents other functions, like "status", "restart" and "stop" from working.









    ------------------------------
    SCOTT FIELDS
    ------------------------------


  • 2.  RE: Issue with SYSV management script for "nrpe" agent

    Posted Mon May 31, 2021 09:30 AM

    Please share the output of the following command

    /usr/bin/ksh -x /etc/rc.d/init.d/nrpe status



    ------------------------------
    RESHMA KUMAR
    ------------------------------