您好,登錄后才能下訂單哦!
nagios安裝指南
環(huán)境:rhel6.2
軟件:nagios-3.3.1.tar.gz
1、最小化安裝系統(tǒng)
2、安裝缺失插件
yum install -y httpd http-devel mysql mysql-devel mysql-server gcc glibc glibc-common gd gd-devel php make php-devel php-gd ntp make net-snmp net-snmp-devel
3、創(chuàng)建nagios用戶并創(chuàng)建nagcmd組,允許用戶在web上執(zhí)行命令.
useradd -m nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagcmd apache
3、編譯安裝nagios
./configure --with-gd-lib=/usr/local/lib --with-command-group=nagcmd --prefix=/var/www/html/nagios
make all
make install
make install-init
make install-config
make install-commandmode
4、修改發(fā)信郵箱、修改apache配置文件
vi /var/www/html/nagios/etc/objects/contacts.cfg
nagios-3.2.3/sample-config/httpd.conf中的片段拷貝到/etc/httpd/conf/httpd.conf中
5、添加登錄認證文件
htpasswd -c /var/www/html//nagios/etc/htpasswd.users nagiosadmin
6、安裝nagios-plugins插件
tar -zvxf nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --prefix=/var/www/html/nagios
make && make install
7、nagios 測試
chown nagios:nagios /var/www/html/nagios/ -R
/etc/init.d/httpd restart
chkconfig httpd on
/etc/init.d/nagios start
8、安裝nrpe
tar xzvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
9、修改nrpe配置
編輯/etc/xinetd.d/nrpe
only_from = 127.0.0.1 #這里只能加一個IP
編輯/etc/services,在最后一行加上
nrpe 5666/tcp # NRPE
在監(jiān)控主機上編輯 /var/www/html/nagios/etc/objects/commands.cfg,加入下面的command。
[plain] view plaincopy
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
10、配置snmp服務(wù)
yum install net-snmp net-snmp-devel net-snmp-libs net-snmp-utils
chkconfig –level 35 snmpd on
service snmpd start
vi /etc/snmp/snmpd.conf
修改com2sec notConfigUser default public
為:com2sec notConfigUser 127.0.0.1 public
修改access notConfigGroup "" any noauth exact systemview none none
為access notConfigGroup "" any noauth exact all none none
并啟用view all included .1 80此行;
11、解壓移動cacti
tar xvf cacti-0.8.7g.tar.gz
mv cacti-0.8.7g /var/www/html/cacti
12、安裝rrdtool
tar xzf rrdtool-1.4.5.tar.gz ;
cd rrdtool-1.4.5 ;
./configure –-prefix=/usr/local/rrdtool/ ;
make &&make install
ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
或者執(zhí)行:
yum install rrdtool*
13、配置cacti數(shù)據(jù)庫
mysql -uroot –p ##輸入你的密碼進入數(shù)據(jù)庫,然后創(chuàng)建數(shù)據(jù)庫:
create database cacti; ## 創(chuàng)建庫
grant all on cacti.* to cacti@’localhost’ identified by ’123456′; ##創(chuàng)建用戶并授權(quán)
flush privileges; ##刷新權(quán)限
mysql配置完畢后,把cacti數(shù)據(jù)導(dǎo)入cacti數(shù)據(jù)庫里面:
mysql -ucacti -p cacti </var/www/html/cacti/cacti.sql
回車輸入cacti用戶的密碼123456即可。
需要在修改/var/www/html/cacti/include/config.php ;
將
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "123456";
$database_port = "3306";
改成相應(yīng)的數(shù)據(jù)即可;
配置完mysql后,我們需要設(shè)置cacti rra、log 目錄的權(quán)限,這里設(shè)置為777 :
chmod -R 777 /var/www/html/cacti/rra/
chmod -R 777 /var/www/html/cacti/log/
為了繪制圖表,需要手動添加以下任務(wù)
* /5 * * * * php /var/www/html/cacti/poller.php
14、瀏覽器中打開:
http://localhost:/cacti
執(zhí)行install安裝即可;
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。