您好,登錄后才能下訂單哦!
去官方下載最新的版本nagios-4.0.8 http://www.nagios.org/download/core
[root@nagios nagios]# tar zxvf nagios-4.0.8.tar.gz
[root@nagios nagios-4.0.8]# make all
[root@nagios nagios-4.0.8]# make install
[root@nagios nagios-4.0.8]# make install-init
[root@nagios nagios-4.0.8]# make install-commandmode
[root@nagios nagios-4.0.8]# make install-config
[root@nagios nagios-4.0.8]# make install-webconf
[root@nagios nagios-4.0.8]# make install-exfoliation
[root@nagios nagios-4.0.8]# make install-classicui
2:安裝插件 nagios-plugins-2.0.3.tar.gz http://www.nagios.org/download/plugins
./configure&&make&&make install
ln -s /usr/local/nagios /etc/nagios
個性化的插件都拷貝到/etc/nagios/libexec 下
3:安裝iostat_plugins 需要如下rpm包包
[root@nagios iostat_plugins]# ls -h
perl-Class-Accessor-0.31-1.el5.rf.noarch.rpm perl-Params-Validate-0.89-1.el5.rf.i386.rpm
perl-Config-Tiny-2.12-1.el5.rf.noarch.rpm perl-Regexp-Common-2.120-1.2.el5.rf.noarch.rpm
perl-Math-Calc-Units-1.06-1.el5.rf.noarch.rpm
如下插件都可以網上找 主要是check_traffic.sh
cp check_memory.pl check_iostat check_file_des check_inode check_netstat check_traffic.sh /usr/local/nagios/libexec
chmod 755 /usr/local/nagios/libexec/check_memory.pl
chmod 755 /usr/local/nagios/libexec/check_iostat
dos2unix /usr/local/nagios/libexec/check_memory.pl
dos2unix /usr/local/nagios/libexec/check_iostat
使用check_traffic.sh之前需要安裝snmp包snmpwalk
rpm -ivh net-snmp-utils-5.3.2.2-9.el5_5.1.i386.rpm
mkdir -p /var/tmp/nagios && chown -R nagios.nagios /var/tmp/nagios
例子:如何獲取交換機的端口信息
/usr/local/nagios/libexec/check_traffic.sh -V 2c -C 3550b -H 172.16.40.9 -L
4:優化部分
[root@nagios etc]# cd /etc/nagios/etc
[root@nagios etc]# htpasswd -c /usr/local/nagios/etc/htpasswd.users admin
New password:
Re-type new password:
Adding password for user admin
編輯cgi.cfg文件,替換nagiosadmin 為admin
/etc/init.d/nagios start
/etc/init.d/httpd start
5:繪圖PNP
http://docs.pnp4nagios.org/pnp-0.6/dwnld
下載:pnp4nagios-0.6.24.tar.gz 文檔部分 http://docs.pnp4nagios.org/pnp-0.6/start
PNP是一個Nagios插件 ***能數據進行分析,并將它們存儲自動RRD-databases
RRDtool是開源行業標準,可以提供高性能數據記錄時間序列數據和圖形繪制系統
下載鏈接:http://oss.oetiker.ch/rrdtool/pub/?M=D
此處使用rrdtool-1.2.12.tar.gz
[root@nagios rrdtool-1.2.12]# ./configure
[root@nagios rrdtool-1.2.12]# make all &&make install
[root@nagios pnp4nagios-0.6.24]# ls /usr/local/rrdtool-1.2.12/ 安裝好的目錄
[root@nagios ~]# cd pnp4nagios-0.6.24
[root@nagios pnp4nagios-0.6.24]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-rrdtool=/usr/local/rrdtool-1.2.12/bin/rrdtool
[root@nagios pnp4nagios-0.6.24]# make all
[root@nagios pnp4nagios-0.6.24]# make install
[root@nagios pnp4nagios-0.6.24]# make install-webconf
[root@nagios pnp4nagios-0.6.24]# make install-config
*** PNP4Nagios sample config files installed ***
Please run 'make install-init' if you want to use
BULK Mode with NPCD
默認是運行Synchronous Mode 模式,比較浪費資源它是每一個事件將觸發process-service-perfdata的執行
所以此處使用Bulk mode 批量模式比同步模式更為復雜但能顯著降低nagios服務器上的負載,因為數據收集器process_perfdata.pl不調用每個服務/主機檢查。
在批量模式Nagios將數據寫入一個臨時文件中。這個文件是由process_perfdata進行處理。在特定的間隔。Nagios將定期照顧啟動和運行它
首先在nagios.cfg中 啟用收據收集開關
process_performance_data=1
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
編輯command.cfg
define command{
command_name process-service-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/service-perfdata
}
define command{
command_name process-host-perfdata-file
command_line /usr/local/pnp4nagios/libexec/process_perfdata.pl --bulk=/usr/local/pnp4nagios/var/host-perfdata
}
6: 調試
http://192.168.10.100/pnp4nagios/ 提示404錯誤
chown nagios.nagios /usr/local/nagios/etc/htpasswd.users
PNP4Nagios Version | pnp4nagios-0.6.24 |
---|---|
Prefix | /usr/local/pnp4nagios |
Configure Arguments | ./configure '--with-nagios-user=nagios' '--with-nagios-group=nagios' '--with-rrdtool=/usr/local/rrdtool-1.2.12/bin/rrdtool' |
RRD Storage | /usr/local/pnp4nagios/var/perfdata is readable. |
RRDtool Binary | /usr/local/rrdtool-1.2.12/bin/rrdtool is executable by PHP |
PHP GD extension | PHP GD extension not available |
PHP function proc_open() | Pass |
PHP zlib extension | Pass |
PHP session extension | Pass |
PHP JSON extension | Pass |
PHP magic_quotes_gpc | Off |
PHP socket extension | Pass |
Apache Rewrite Module | Pass |
在安裝光盤上查詢依次安裝即可,缺啥補啥
[root@nagios CentOS]# ls *php* | grep gd
php53-gd-5.3.3-1.el5.i386.rpm
php-gd-5.1.6-27.el5_5.3.i386.rpm
然后重啟WEB 刷新通過。
Your environment passed all requirements. Remove or rename the /usr/local/pnp4nagios/share/install.php
file now.
cd /usr/local/pnp4nagios/share/
[root@nagios share]# mv install.php install.php.bak
編輯模板新增vim templates.cfg
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
在LINUX 被監控端安裝nagios-plugins-2.0.3 nrpe-2.15.tar.gz
運行方式:
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。