nagios 客戶端一鍵安裝安裝
創(chuàng)新互聯(lián)是專業(yè)的陽曲網(wǎng)站建設(shè)公司,陽曲接單;提供成都做網(wǎng)站、網(wǎng)站制作,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行陽曲網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊,希望更多企業(yè)前來合作!此腳本為個人線上生產(chǎn)環(huán)境使用,不一定適合大眾,腳本寫的也很一般。希望大家多提意見。
1 這是改過之后的腳本,nrpe是放在xinetd里面啟動的. 讓nrpe的信息獨(dú)立存放(本處放空文件了),snmpd的日志也獨(dú)立存放。都不在寫入系統(tǒng)messages。
#!/bin/bash #Date: 2013/12/6 useradd nagios cd /usr/local/src wget http://10.100.0.11/nagios-c.tar.gz tar zxvf nagios-c.tar.gz tar zxvf nagios-plugins-1.5.tar.gz cd nagios-plugins-1.5 ./configure make make install chown nagios:nagios /usr/local/nagios chown -R nagios:nagios /usr/local/nagios/libexec cd ../ tar zxvf nrpe-2.15.tar.gz cd nrpe-2.15 ./configure make all make install-plugin make install-daemon make install-daemon-config make install-xinetd sed -i "s@allowed_hosts=127.0.0.1@allowed_hosts=127.0.0.1,10.100.0.11@" /usr/local/nagios/etc/nrpe.cfg sed -i '/disable/i\ log_type = file /dev/null' /etc/xinetd.d/nrpe sed -i 's#127.0.0.1#10.100.0.11#' /etc/xinetd.d/nrpe chkconfig xinetd on service xinetd restart netstat -an | grep 5666 if [ $? -eq 0 ];then echo -e "$R nrpe is start $E" else echo -e "$R nrpe is not start!!!!!!! $E" fi echo -e "$R######################install snmpd ################################## $E" rpm -qa | grep net-snmp if [ $? -eq 0 ];then echo -e "$R net-snmp install ok! $E" sed -i 's#OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"#OPTIONS="-LS0-6d -Lf /var/log/snmpd.log -p /var/run/snmpd.pid"#' /etc/init.d/snmpd sed -i 's#access notConfigGroup "" any noauth exact systemview none none#access notConfigGroup "" any noauth exact all none none#' /etc/snmp/snmpd.conf sed -i 's#\#view all included .1 80#view all included .1 80#' /etc/snmp/snmpd.conf sed -i 's#com2sec notConfigUser default public#com2sec notConfigUser 10.100.0.11 100che#' /etc/snmp/snmpd.conf else echo -e "$R snmpd is not install $E" fi service snmpd restart chkconfig snmpd on ps -ef | grep -v grep | grep snmpd if [ $? -eq 0 ];then echo -e "$R snmpd is ok! $E " else echo -e "$R snmpd is error $E" fi
2 傳統(tǒng)腳本,所有信息都是按照基本方式來的:
useradd nagios cd /usr/local/src #wget http://nchc.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz #wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz #wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz #wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz wget http://10.100.0.11/nagios-c.tar.gz tar zxvf nagios-c.tar.gz tar zxvf nagios-plugins-1.5.tar.gz cd nagios-plugins-1.5 ./configure make make install chown nagios:nagios /usr/local/nagios chown -R nagios:nagios /usr/local/nagios/libexec cd ../ tar zxvf nrpe-2.15.tar.gz cd nrpe-2.15 ./configure make all make install-plugin make install-daemon make install-daemon-config sed -i 's@allowed_hosts=127.0.0.1@allowed_hosts=127.0.0.1,10.100.0.11@' /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d #check /etc/rc.local in nrpe process: grep "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" /etc/rc.local if [ $? -eq 0 ];then echo "nrpe existing , not Don't need to write." else echo " nrpe is not install ,but already write /etc/rc/local file. " echo "###this is nagios client BY:renzhenxing date:$(date +%F)" >> /etc/rc.local echo "/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d" >> /etc/rc.local fi netstat -an | grep -v "grep" | grep 5666 if [ $? -eq 0 ];then echo "nrpe is start " else echo "nrpe is not start!!!!!!!" fi
至此完成
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)站題目:nagios客戶端一鍵安裝-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://aaarwkj.com/article38/ccoesp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、商城網(wǎng)站、電子商務(wù)、搜索引擎優(yōu)化、小程序開發(fā)、服務(wù)器托管
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容