真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

centos安裝nagios+nrpe

linux下有2大監(jiān)控神器cacti+nagios,下面我把我自己搭建nagios的步驟記錄下來,以便以后需要的時(shí)候看。
首先安裝依賴包
#yum install -y httpd MySQL mysql-devel mysql-server php php-mysql gcc gcc-c++ gblic gblic-devel gd gd-devel openssl-devel
添加nagios用戶,用戶組
#groupadd nagcmd
#useradd nagios
#usermod -a -G nagcmd nagios
#usermod -a -G nagcmd daemon(http的user)
下載nagios安裝包,解壓
開始編譯
#./configure --prefix=/etc/nagios \
>--with-nagios-user=nagios \
>--with-nagios-group=nagios \
>--enable-event-broker
#make all
#make install
#make install-init
#make install-commandmode
#make install-config
#make install-webconf(編譯安裝的httpd會(huì)出現(xiàn)錯(cuò)誤)
安裝nagios-plugins
#./configure --with-nagios-user=nagios \
>--with-nagios-group=nagios \
>--with-mysql=/path/to/mysql(監(jiān)控mysql必須添加此選項(xiàng))
#make && make install
下面開始安裝nrpe
首先確定開發(fā)環(huán)境
#yum grouplist
確定有Development tools和Development Libraries
如果沒有就安裝
#yum groupinstall -y "Development tools" "Development Libraries"
開始安裝nrpe
#./configure --with-nagios-user=nagios \
>--with-nagios-group=nagios \
>--with-nrpe-user=nagios \
>--with-nrpe-group=nagios \
>--enable-command-args \
>--enable-ssl
#make all
#make install-plugin
服務(wù)器端不需要開始nrpe服務(wù)


下面開始配置客戶端
nrpe依賴于nagios-plugins,首先安裝nagios-plugins
#./configure --with-nagios-user=nagios \
>--with-nagios-group=nagios \
>--with-mysql=/path/to/mysql(監(jiān)控mysql必須添加此選項(xiàng))
#make && make instal
下面開始安裝nrpe
#./configure --with-nagios-user=nagios \
>--with-nagios-group=nagios \
>--with-nrpe-user=nagios \
>--with-nrpe-group=nagios \
>--enable-command-args \
>--enable-ssl
#make all
#make install-plugin
#make install-daemon(安裝守護(hù)進(jìn)程)
#make install-daemon-config(安裝守護(hù)進(jìn)程配置文件)

修改nrpe.cfg文件
找到allowed_hosts添加你的服務(wù)器的IP

啟動(dòng)nrpe
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
下面就可以在服務(wù)器端定義主機(jī),定義命令開始監(jiān)控
定義命令
define command{
         command_name        check_nrpe
         command_line           $USER1$/check_nrpe -H  $HOSTADDRESS$  -c $ARG1$(-c表示在遠(yuǎn)程執(zhí)行命令)
}
定義主機(jī)
define host {
         use                            linux-server
         host_name                 webserver
         alias                           web-server
         address                      192.168.0.4
}
定義服務(wù)
define service {
         use                             linux-service
         host_name                  webserver
         service_description     PING
         check_command         check_nrpe!check_ping
}
想要監(jiān)控什么就在客戶端上定義命令,在服務(wù)器上填寫檢測(cè)內(nèi)容就可以了


下面附上nrpe的啟動(dòng)腳本
#!/bin/sh
#
# Source function library
if [ -f /etc/rc.d/init.d/functions ]; then
   . /etc/rc.d/init.d/functions
elif [ -f /etc/init.d/functions ]; then
   . /etc/init.d/functions
elif [ -f /etc/rc.d/functions ]; then
   . /etc/rc.d/functions
fi
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
NrpeBin=/usr/local/nagios/bin/nrpe
NrpeCfg=/usr/local/nagios/etc/nrpe.cfg
LockFile=/var/lock/subsys/nrpe
# See how we were called.
case "$1" in
 start)
    # Start daemons.
    echo -n "Starting nrpe: "
    daemon $NrpeBin -c $NrpeCfg -d
   echo
   touch $LockFile
    ;;
 stop)
   # Stop daemons.
   echo -n "Shutting down nrpe: "
    killproc nrpe
   echo
   rm -f $LockFile
    ;;
 restart)
   $0 stop
   $0 start
    ;;
 status)
   status nrpe
    ;;
 *)
   echo "Usage: nrpe {start|stop|restart|status}"
    exit 1
esac
exit 0

網(wǎng)站建設(shè)公司,為您提供網(wǎng)站建設(shè),網(wǎng)站制作,網(wǎng)頁設(shè)計(jì)及定制網(wǎng)站建設(shè)服務(wù),專注于企業(yè)網(wǎng)站制作,高端網(wǎng)頁制作,對(duì)資質(zhì)代辦等多個(gè)行業(yè)擁有豐富的網(wǎng)站建設(shè)經(jīng)驗(yàn)的網(wǎng)站建設(shè)公司。專業(yè)網(wǎng)站設(shè)計(jì),網(wǎng)站優(yōu)化推廣哪家好,專業(yè)seo優(yōu)化排名優(yōu)化,H5建站,響應(yīng)式網(wǎng)站。


當(dāng)前文章:centos安裝nagios+nrpe
網(wǎng)頁網(wǎng)址:http://weahome.cn/article/joieog.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部