标签归档:nrpe

Install NRPE On MacOSX Server

Get the files
Nagios Plugins: http://www.nagios.org/download/plugins/
Nagios NRPE: http://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE–2D-Nagios-Remote-Plugin-Executor/details

Set up the system
Create the nagios user using Workgroup Manager
Create the nagios group using Workgroup Manager
Change the primary group for the nagios user to be nagios 继续阅读

Nagios nrpe and sudo: “NRPE: Unable to read output”

On CentOS 5 (and RedHat EL as well), you can encounter the following behaviour when configuring an nrpe plugin with sudo:

[andrea@feyd ~]$ /usr/lib/nagios/plugins/check_nrpe -H 1.2.3.4 -c check_md_raid
NRPE: Unable to read output


Given that check_md_raid is defined as follows, in nrpe.conf:

command[check_md_raid]=sudo /usr/local/bin/nagios_check_md_raid

And given (for completeness) its relative /etc/sudoers line as follows:

nagios ALL=(ALL) NOPASSWD:/usr/local/bin/nagios_check_md_raid

Then the problem is in the requiretty options in /etc/sudoers, enabled by default on CentOS. Simply comment it as follows:

#Defaults requiretty

After that the plugin should work as expected:

[andrea@feyd ~]$ /usr/lib/nagios/plugins/check_nrpe -H 1.2.3.4 -c check_md_raid
RAID OK: All arrays OK [1 array checked]

nrpe自动安装脚本

nrpe自动安装脚本

#!/bin/sh
#nrpe install script writed by sery([email=sery@163.com),2009-11-23]  

Os_is=`uname`
Nagios_is=`grep nagios /etc/passwd | wc -l`  

if [ "$Os_is" = "Linux" ]
then
  ipadd=$(ifconfig | sed -n ‘2p’|awk ‘{print $2}’|awk -F: ‘{print $2}’)
  if [ $Nagios_is = 0 ]
  then
    useradd nagios -s /sbin/nologin
  fi
elif [ "$Os_is" = "FreeBSD" ]
   then
    ipadd=$(ifconfig | sed -n ‘4p’|awk ‘{print $2}’)
    if [ $Nagios_is = 0 ]
    then
    /usr/sbin/pw useradd nagios -s /sbin/nologin
    fi
else echo “this is other os,please modify the script”
exit 1
fi  

#install nrpe
PREFIX=/usr/local/nrpe
tar zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure –prefix=$PREFIX
make
make install
echo “nrpe install ok….!”
sleep 3  

cd ..
if [ ! -d $PREFIX/etc ]
   then
     mkdir $PREFIX/etc
fi  

#install nagios-plugins
tar zxvf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure –prefix=$PREFIX
make
make install
cd ..
echo “nagios-plugins is ok!”
sleep 3  

#setting nrpe
cp ip_conn.sh $PREFIX/libexec
chmod -R +x $PREFIX/libexec
sed -e /^server_add/s/$/”$ipadd”/ -e /^allowed_hosts/s/$/$ipadd/ nrpe.cfg > $PREFIX/etc/nrpe.cfg
#running nrpe
cd $PREFIX
bin/nrpe -c etc/nrpe.cfg -d
echo “haha! nrpe is running!!!”

在linux及freebs下测试通过
请于此处下载 http://221.202.126.2/apmg/nrpe_install.tgz 或者本地下载,然后解包执行 ./setup.sh即