Nagios监控服务器安装和部署
生活随笔
收集整理的這篇文章主要介紹了
Nagios监控服务器安装和部署
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
注:
本文檔基于nagios+apache的模式,安裝nagios時須預先編譯安裝apache,在此不進行apache編譯安裝的贅述。
?
?
一:配置apache
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #?vi?/usr/local/apache/conf/extra/httpd-vhosts.conf NameVirtualHost?*:80 <VirtualHost?*:80> ????ServerName??192.168.189.132? ????DocumentRoot?"/www" ????<Directory?"/www"> ????Order?deny,allow ????Deny?from?all ????</Directory> ????#以下是apache上,nagios所需的配置信息: ????Scriptalias/nagios/cgi-bin??/usr/local/nagios/sbin ????<directory"/usr/local/nagios/sbin"> ????Authtype?basic ????Options?execcgi ????Allowoverride?none ????Order?allow,deny ????Allow?from?all ????Authname?"nagios?access" ????Authuserfile?/usr/local/nagios/etc/htpasswd ????Require?valid-user ????</directory> ?? ???Alias?/nagios?/usr/local/nagios/share ???<directory"/usr/local/nagios/share"> ???Authtype?basic ???Options?none ???Allowoverride?none ???Order?allow,deny ???Allow?from?all ???Authname?"nagios?access" ???//配置nagios用戶驗證 ???Authuserfile?/usr/local/nagios/etc/htpasswd? ???Require?valid-user ???</directory> </VirtualHost> |
?
二:創建nagios用戶與組
| 1 2 3 4 | #?useradd?nagios #?groupadd?nagios #?usermod?–a?–Gnagios?nobody #?usermod?–a?–Gnagios?nagios |
二:下載nagios相關軟件包,并編譯安裝及環境配置
| 1 2 3 4 5 6 7 | #?cd?/usr/local/src #?wget?http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.1.tar.gz #?wget?http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz #?wget?http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.13.tar.gz #?tar?-zxvf?nagios-3.4.1.tar.gz #?tar?-zxvf?nagios-plugins-1.4.16.tar.gz #?tar?-zxvf?nagios/nrpe-2.13.tar.gz |
?編譯安裝nagios
| 1 2 3 4 5 6 7 | #?cd?nagios-3.4.1/ #?./configure?--prefix=/usr/local/nagios?--with-command-group=nagios #?make?all #?make?install #?make?install-init #?make?install-commandmode #?make?install-config |
?編譯安裝nagios插件
# cd ../nagios-plugins-1.4.16
# ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios
# make && make install
?編譯安裝nrpe
| 1 2 3 4 | #?cd?../nrpe-2.13 #?./configure?--prefix=/usr/local/nagios #?make?all #?make?install-plugin |
?設置nagios目錄權限
| 1 | #?chown?–R?nagios:nagios?/usr/local/nagios/ |
?配置用戶密碼訪問
| 1 2 3 4 | #?/usr/local/apache/bin/htpasswd?-cm?/usr/local/nagios/etc/htpasswd?nagiosadmin New?password:? Re-type?new?password:? Adding?password?for?usernagiosadmin |
三:啟用nagios,并訪問測試
?開啟apache服務
| 1 | #?/usr/local/apache/bin/apachectl?-k?start |
?檢測nagios配置文件語法是否正確
| 1 | #?/usr/local/nagios/bin/nagios?-v?/usr/local/nagios/etc/nagios.cfg |
?若語法正確,則可以正常啟動nagios
| 1 | #?/usr/local/nagios/bin/nagios?-v?/usr/local/nagios/etc/nagios.cfg?-d |
(也可使用系統服務方式啟動:service nagios start)
?
?頁面訪問測試
?出現以上頁面,說明nagios安裝部署成功。后續需在服務中添加主機與服務,方能開始進行監控。
本文轉自 icenycmh 51CTO博客,原文鏈接:http://blog.51cto.com/icenycmh/1852000,如需轉載請自行聯系原作者
總結
以上是生活随笔為你收集整理的Nagios监控服务器安装和部署的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 《Qt on Android核心编程》夹
- 下一篇: 6. ZooKeeper访问控制列表