您好,登錄后才能下訂單哦!
安裝前準備檢查環境
iptables -F
setenforce 0
#gcc環境 lamp環境和其他的一些 nagios 的依賴包
yum -y install gcc* yum -y install httpd mysql mysql-server mysql-devel php php-server glibc glibc-common *gd*
#添加nagios運行所需要的用戶和組
groupadd nagcmd
useradd -G nagcmd nagios
usermod -G nagcmd apache
#編譯安裝nagios
mkdir /cdrom
cp -a /cdrom/* .
tar -xf nagios-3.3.1..tar.gz
cd nagios
./configure --with-commadn-group=nagcmd --enable-event-broker
make all && make install && make install-init make install-commandmode make install-config && make install-webconf
2.生成密碼文件
htpasswd -c /usr/local/nagios/etc/htpasswd.user nagiosadmin
service httpd restart
在瀏覽器中查看效果輸入用戶名和密碼
安裝插件管理器nagios-plugins
解壓編譯
tar -xf nagios-plugins-1.4.14.tar.gz
cd /root/nagios-plugins-1.4.14
./configure --with-nagios-user=nagios --wtih-nagios-group=nagios --with-mysql --enable-perl-modules
make && make install
配置并啟動nagios
chkconfig --add nagios
chkconfig nagios on
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
#此命令用來檢測語法
service nagios start
windows 主機的監控
安裝 NSCLIENt ++
服務器端設置windows監控
cd /usr/local/nagios
cd etc/
cd objects/
#進入nagios主目錄,啟用windows的支持
vim nagios.cf
vim /usr/local/nagios/etc/objects/contacts.cfg
#39 cfg_file=/usr/local/nagios/etc/objects/windows.cfg
vim /usr/local/nagios/etc/objects/contacts.cfg
#35 email nagios@localhost報警郵箱根據實際改找個軟件最好然后用qq郵箱然后跟微信關聯qq號然后微信就可以知道報警了
檢測,并啟動nagios服務
/usr/local/nagios/bin/nagios -v /usr/local/ngios/etc/nagios.cfg
service nagios restart
Linux的監控
安裝gcc,openssl openssl-devel
yum -y install openssl openssl-devel
安裝插件管理器nagios-plugins
創建個nagios用戶,否則會報錯
useradd nagios
cd /root
tar -xf nagios-plugins-1.4.14.tar.gz
cd nagios-plugins-1.4.14
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all && make install
安裝nrpe確保openssl,openss-devel已經安裝
tar -xf nrpe-2.8.1.tar.gz
cd nrpe-2.8.1
./configure --enable-ssl --with-ssl-lib=/usr/lib
make all
make install-plugin
make install-daemon
make install-daemon-config
vim /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=192.168.121.1 127.0.0.1
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
服務端裝
nagios-plugins
./configure --enable-ssl --with-ssl-lib=/usr/lib
make all
make install-plugin
cd /usr/local/nagios/etc/
cd objects/
ls
vim linux.cfg
vim cmmands.cfg
啟用自定義的liunx.cfg文件
vim /usr/local/nagios/etc/nagios.cfg
31# cfg_file=/usr/local/nagios/etc/objects/linux.cfg
檢測并啟用
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
服務的監控
客戶端
yum -y install mysql mysql-server
service mysqld start
mysqladmin -uroot password '123123'
mysql -uroot -p
create database nagios;
grant selcet on nagios.* to nagios@'%' identifed by '123123';
select user,password,host from mysql.user;
服務端檢查一下是否能夠連接數據庫
/usr/local/nagios/libexec/check_mysql -H 192.168.121.1 -u nagios -d nagios -p 123123
vim mysql.cfg
啟動配置
vim /usr/local/nagios/etc/nagios.cfg
vim commadns.cfg
檢測啟動nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
service nagios restart
在瀏覽器中查看
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。