这个只是总体脚本中的监控端的一个函数 installserver ()
具体脚本如下:
#!/bin/bash #this is nagios server or client install shell #at 2012/10/29 path=`pwd` httppath=/usr/local/apache2 mysqlpath=/usr/local/mysql nagiospath=/usr/local/nagios installserver () { yum install -y xinetd useradd -m nagios groupadd nagcmd useradd -a -G nagcmd nagios useradd -a -G nagcmd apache cd $path tar -zxvf nagios-3.2.0.tar.gz cd nagios-3.2.0 ./configure --with-command-group=nagcmd --with-nagios-user=nagios --with-nagios-group=nagios make all make install make install-init make install-config make install-commandmode make install-webconf echo "########################################" echo "please create the nagios user for apache" echo "----------------------------------------" cat $path/http.txt >> /etc/httpd/httpd.conf $httppath/bin/htpasswd -c $nagiospath/etc/htpasswd.users nagiosadmin chkconfig --add nagios chkconfig nagios on cd $path tar -zxvf nagios-plugins-1.4.14.tar.gz cd nagios-plugins-1.4.14 ./configure --prefix=$nagiospath --with-nagios-user=nagios --with-nagios-group=nagios make make install cd $path tar -zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure make all make install make install-plugin make install-daemon make install-daemon-config make install-xinetd read -p " Please input the nagios server IP: " serverip echo "nrpe 5666/tcp #nrpe" >> /etc/services sed -i "s#only_from.*#only_from = 127.0.0.1 $serverip#" /etc/xinetd.d/nrpe chkconfig --add xinetd chkconfig xinetd on service xinetd restart cd $path tar -zxvf check_mysql_health-2.1.tar.gz cd check_mysql_health-2.1 ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-perl=/usr/bin/perl make make install yum install perl-DBI perl-DBD-MySQL -y cd $path tar -zxvf check_iftraffic.tar.gz chmod +x check_iftraffic chmod +x check_mem.sh chmod +x check_cpu.sh chmod +x ip_conn.sh cp check_mem.sh /usr/local/nagios/libexec cp check_cpu.sh /usr/local/nagios/libexec cp check_iftraffic /usr/local/nagios/libexec cp ip_conn.sh /usr/local/nagios/libexec mv $path/cfg/server/etc/* /usr/local/nagios/etc mv $path/cfg/server/objects/* /usr/local/nagios/etc/objects chown -R nagios.nagios /usr/local/nagios service httpd restart service xinetd restart echo "###################################" echo "######### the result ########" echo "-----------------------------------" /usr/sbin/lsof -i:5666 echo "-----------------------------------" /usr/local/nagios/libexec/check_nrpe -H localhost }
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索path
, make
, nagios
, install
, usr
, local
nagios监控linux
nagios监控linux主机、nagios 监控linux、nagios监控linux内存、nagios监控远程linux、nagios部署,以便于您获取更多的相关知识。
时间: 2024-10-02 11:07:11