After completing the server-side setting of the Nagios, it is necessary to make the relevant settings on the monitored host side and set some monitoring parameter values.
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/soft/tools/
The complete configuration script is as follows:
#!/bin/bash #auto Configure Nagios Linux client side #2012 -12-05 nagios_dir= "/usr/local/nagios" 192.16 8.0.50 ' function Install_nagios {yum-y Install Install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng Libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2 -devel ncurses ncurses-devel Curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl* openssl-de Vel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel NTP Libtool-ltdl bis On Libtool vim-enhanced gd* useradd nagios cd/usr/local/src tar zxvf nagios-plugins- 1.4.16.tar.gz tar zxvf nrpe-2.13.tar.gz cd/usr/local/src/nagios-plugins-1.4.16 #编译安装nagios插件包./C Onfigure--prefix= $nagios _dir make;make install chown-r nagios:nagios $nagios _dir cd/usr/l ocal/src/nrpe-2.13 #编译安装Nrpe package./configure make all make Install-plugin make Install-daemon make Install-daemon-config function Set_nagios () {CD $nagios _dir/etc/sed-i.bak '/server_address/s/^#//' nrpe.cfg #修改主机的n RPE configuration file Sed-i '/server_address/s/=.*$/=0.0.0.0/' nrpe.cfg sed-i '/allowed_hosts/s/^.*$/&, ' $nagiosrv '/' Nrpe.cfg sed-i ' 205acommand[check_disk]=/usr/local/nagios/libexec/check_disk-w 15%-C 5%-P/-p/b Oot ' nrpe.cfg #追加监控磁盘容量的命令 sed-i ' 206acommand[check_swap]=/usr/local/nagios/libexec/check_swap-w 30%-C 10% ' Nrpe. CFG #追加监控swap容量的命令} function Restart_nagios () #重启nrpe服务 {kill-9 ' cat/var/run/nrpe.pid ' >/ Dev/null 2>&1 $nagios _dir/bin/nrpe-c $nagios _dir/etc/nrpe.cfg-d} case $ in install) install
_nagios;;
config) Set_nagios;;
restart) Restart_nagios;; *) echo "Usage sh nagiosclient.sh {install|confIg|restart} ";; Esac
This article is from the "Strive for" blog, please be sure to keep this source http://carllai.blog.51cto.com/1664997/1085691