#!/bin/sh set -e NAGIOS_MASTER=192.25.206.57 if [ -e /etc/nagios/nrpe.cfg ] ; then if ! grep '^include=/etc/nagios/nrpe_dsa.cfg$' /etc/nagios/nrpe.cfg > /dev/null; then echo echo "WARNING: /etc/nagios/nrpe.cfg does not include /etc/nagios/nrpe_dsa.cfg. Please fix." echo fi if ! grep '^allowed_hosts=' /etc/nagios/nrpe.cfg > /dev/null; then echo echo "WARNING: /etc/nagios/nrpe.cfg does not define allowed_hosts. Please fix (set allowed_hosts=$NAGIOS_MASTER)." echo else found=0 for host in `grep '^allowed_hosts=' /etc/nagios/nrpe.cfg | sed -e 's/.*=//' | tr ',' "\n"`; do if [ "$host" = "$NAGIOS_MASTER" ]; then found=1 break fi done if [ "$found" = "0" ]; then echo echo "WARNING: /etc/nagios/nrpe.cfg does not have $NAGIOS_MASTER in allowed_hosts. Please fix." echo fi fi fi if [ -e /etc/default/nagios-nrpe-server ] ; then if ! grep '^DAEMON_OPTS="--no-ssl"$' /etc/default/nagios-nrpe-server > /dev/null; then echo echo "WARNING: /etc/default/nagios-nrpe-server probably does not set DAEMON_OPTS=\"--no-ssl\". Please fix." echo fi fi if [ -e /etc/sudoers ] ; then if ! grep '^nagios.*/usr/lib/nagios/plugins/dsa-check-dabackup' /etc/sudoers > /dev/null; then echo echo 'WARNIG: Add this line to sudoers:' echo 'nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/dsa-check-dabackup ""' echo fi fi if [ -e /etc/sudoers ] ; then if ! grep '^nagios.*/usr/sbin/samhain' /etc/sudoers > /dev/null; then echo echo 'WARNIG: Add this line to sudoers:' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/samhain -t check --foreground -p err -s none -l none -m none' echo fi fi if [ -e /usr/sbin/hpacucli ] && [ -e /dev/cciss/c0d0 ] ; then if ! grep '^nagios.*hpacucli' /etc/sudoers > /dev/null; then echo echo 'WARNIG: Add these lines to sudoers:' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller all show' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 pd all show' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 pd [0-9]\:[0-9] show' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 pd [0-9]I\:[0-9]\:[0-9] show' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 show status' echo elif ! grep '^nagios.*hpacucli.* pd .*:.* show' /etc/sudoers > /dev/null; then echo echo 'WARNIG: Add these lines to sudoers:' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 pd [0-9]\:[0-9] show' echo 'nagios ALL=(ALL) NOPASSWD: /usr/sbin/hpacucli controller slot=0 pd [0-9]I\:[0-9]\:[0-9] show' fi fi if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then invoke-rc.d nagios-nrpe-server restart || exit $? else /etc/init.d/nagios-nrpe-server restart || exit $? fi /usr/share/dsa/weak-ssh-keys-check -s /var/cache/dsa/nagios/weak-ssh-keys #DEBHELPER# exit 0