您好,登錄后才能下訂單哦!
nagios安裝指南
環境:rhel6.2
軟件:nagios-3.3.1.tar.gz
1、最小化安裝系統
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、創建nagios用戶并創建nagcmd組,允許用戶在web上執行命令.
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、修改發信郵箱、修改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
在監控主機上編輯 /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服務
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/
或者執行:
yum install rrdtool*
13、配置cacti數據庫
mysql -uroot –p ##輸入你的密碼進入數據庫,然后創建數據庫:
create database cacti; ## 創建庫
grant all on cacti.* to cacti@’localhost’ identified by ’123456′; ##創建用戶并授權
flush privileges; ##刷新權限
mysql配置完畢后,把cacti數據導入cacti數據庫里面:
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";
改成相應的數據即可;
配置完mysql后,我們需要設置cacti rra、log 目錄的權限,這里設置為777 :
chmod -R 777 /var/www/html/cacti/rra/
chmod -R 777 /var/www/html/cacti/log/
為了繪制圖表,需要手動添加以下任務
* /5 * * * * php /var/www/html/cacti/poller.php
14、瀏覽器中打開:
http://localhost:/cacti
執行install安裝即可;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。