您好,登錄后才能下訂單哦!
Nagios是一款開源的免費(fèi)網(wǎng)絡(luò)監(jiān)視工具,能有效監(jiān)控Windows、Linux和Unix的主機(jī)狀態(tài),交換機(jī)路由器等網(wǎng)絡(luò)設(shè)置,打印機(jī)等。在系統(tǒng)或服務(wù)狀態(tài)異常時(shí)發(fā)出郵件或短信報(bào)警第一時(shí)間通知網(wǎng)站運(yùn)維人員,在狀態(tài)恢復(fù)后發(fā)出正常的郵件或短信通知。
前提時(shí)間需要同步
1.nagios依賴于php、http
2.查看依賴包是否已經(jīng)被安裝好
#rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel
默認(rèn)的是沒有gd-devel和xinetd的
# yum -y localinstall gd-devel-2.0.35-11.el6.x86_64.rpm # yum install xinetd
3.添加nagios用戶組、用戶
# groupadd nagcmd # useradd -G nagcmd nagios # id nagios uid=501(nagios) gid=502(nagios) 組=502(nagios),501(nagcmd) # usermod -a -G nagcmd apache
4.安裝nagios和nagios-plugins
# tar xf nagios-4.0.2.tar.gz # cd nagios-4.0.2 # ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-event-broker --sysconfdir=/etc/nagios # make all # make install # make install-init # make install-commandmode # make install-config # make install-webconf # htpasswd -c /etc/nagios/htpasswd.users nagiosadmin New password: Re-type new password: Adding password for user nagiosadmin # service httpd restart # chkconfig --add nagios # chkconfig nagios on # tar xf nagios-plugins-1.5.tar.gz # cd nagios-plugins-1.5 # ./configure --with-nagios-user=nagios --with-nagios-group=nagios # make && make install # service nagios start 關(guān)閉selinux,防止selinux組織腳本運(yùn)行
5.登錄nagios-web界面
http://nagiosIP/nagios
輸入用戶名和密碼
6.被監(jiān)控端安裝nagios-plugins
所需軟件nagios-plugins、nrpe
# tar xf nagios-plugins-1.5.tar.gz # useradd -s /sbin/nologin nagios # cd nagios-plugins-1.5 # ./configure --with-nagios-user=nagios --with-nagios-group=nagios # make all # make install
7.被監(jiān)控端安裝nrpe
# tar xf nrpe-2.15.tar.gz # cd nrpe-2.15 # ./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl # make all # make install-plugin # make install-daemon # make install-daemon-config # /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d //啟動(dòng)nrpe服務(wù) 或者 # vim /etc/init.d/nrped #!/bin/bash # chkconfig: 2345 88 12 # description: NRPE DAEMON NRPE=/usr/local/nagios/bin/nrpe NRPECONF=/usr/local/nagios/etc/nrpe.cfg case "$1" in start) echo -n "Starting NRPE daemon..." $NRPE -c $NRPECONF -d echo " done." ;; stop) echo -n "Stopping NRPE daemon..." pkill -u nagios nrpe echo " done." ;; restart) $0 stop sleep 2 $0 start ;; *) echo "Usage: $0 start|stop|restart" ;; esac exit 0 # /etc/init.d/nrped start
8.在主監(jiān)控添加nrpe的定義
# 'check_nrpe' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
9.增加主機(jī)監(jiān)控配置項(xiàng)
# vim /etc/nagios/objects/131.cfg define host{ use linux-server host_name 192.168.235.131 alias 192.168.235.131 address 192.168.235.131 } define service{ use generic-service host_name 192.168.235.131 service_description load check_command check_nrpe!check_load } define service{ use generic-service host_name 192.168.235.131 service_description PING check_command check_ping!100.0,20%!200.0,50% max_check_attempts 5 normal_check_interval 1 } define service{ use generic-service host_name 192.168.235.131 service_description FTP check_command check_ftp!21 max_check_attempts 5 normal_check_interval 1 } define service{ use generic-service host_name 192.168.235.131 service_description SSH check_command check_ssh max_check_attempts 5 normal_check_interval 1 } define service{ use generic-service host_name 192.168.235.131 service_description HTTP check_command check_http max_check_attempts 5 normal_check_interval 1 } # vim /etc/nagios/nagios.cfg cfg_file=/etc/nagios/objects/131.cfg # service nagios reload 重載刷新nagios-web界面可以看到添加的被監(jiān)控主機(jī)
好了,此處nagios已經(jīng)被安裝好了,而且被監(jiān)控節(jié)點(diǎn)也已經(jīng)上線了!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。