nagios的安裝不再贅述,直接在nagios服務(wù)端進(jìn)行安裝pnp4nagios軟件
網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專注于網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、微信平臺小程序開發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項目。為回饋新老客戶創(chuàng)新互聯(lián)還提供了寶山免費建站歡迎大家使用!安裝展示圖形頁面pnpnagios(rrdtool工具用來存儲數(shù)據(jù)并畫圖,pnpnagios用來展示圖形數(shù)據(jù))
參考:http://docs.pnp4nagios.org/pnp-0.6/install
http://docs.pnp4nagios.org/pnp-0.6
tar xf pnp4nagios-0.6.25.tar.gz
cd pnp4nagios-0.6.25
yum install rrdtool rrdtool-perl -y
./configure
編譯報錯:
checking for Perl Module Time::HiRes... no
configure: error: Perl Module Time::HiRes not available
解決辦法:
yum -y install perl-Time-HiRes
再次編譯
./configure
make all
make install
make install-webconf
make install-config
make install-init
make fullinstall
安裝后出現(xiàn)如下輸出:
*** Configuration summary for pnp4nagios-0.6.25 03-01-2015 ***
General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/pnp4nagios
HTML Dir: /usr/local/pnp4nagios/share
Config Dir: /usr/local/pnp4nagios/etc
Location of rrdtool binary: /usr/bin/rrdtool Version 1.3.8
RRDs Perl Modules: FOUND (Version 1.3008)
RRD Files stored in: /usr/local/pnp4nagios/var/perfdata
process_perfdata.pl Logfile: /usr/local/pnp4nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/pnp4nagios/var/spool
Web Interface Options:
------------------------- -------------------
HTML URL: http://localhost/pnp4nagios
Apache Config File: /etc/httpd/conf.d/pnp4nagios.conf
Review the options above for accuracy. If they look okay,
type 'make all' to compile.
由于nagios采用的是4.1.1,pnp4nagios采用的是0.6.25
在官方文檔有好幾種配置pnp4nagios的模式,但是采用sync的模式會一直收集不到數(shù)據(jù),而報錯,于是改用了Bulk Mode with NPCD,成功出圖,這里分析配置過程:
參考:http://www.aboutmonitoring.com/installing-nagios-core-4-pnp4nagios-check_mk-nagvis-centos-7-redhat-7/
1、編輯nagios.cfg文件,修改
process_performance_data=0將這個值改為1
##### Values: 1 = process performance data, 0 = do not process performance data
enable_environment_macros=1
2、然后去掉下面兩個注釋,使之啟用:
#host_perfdata_command=process-host-perfdata
#service_perfdata_command=process-service-perfdata
然后在nagios.cfg配置文件中加入以下:
# 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
各個文件的使用可以查看官方說明
3、修改commands.cfg
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
然后開啟npcd服務(wù):
/usr/local/pnp4nagios/bin/npcd -d -f /usr/local/pnp4nagios/etc/npcd.cfg
4、
[root@RS1 libexec]# /etc/init.d/nagios checkconfig
Running configuration check...
OK.
[root@RS1 libexec]# service httpd restart
停止 httpd: [確定]
正在啟動 httpd:
[root@RS1 libexec]# /etc/init.d/nagios reload
Running configuration check...
Reloading nagios configuration...
done
5、瀏覽器訪問
http://192.168.1.155/pnp4nagios/
出現(xiàn)報錯:PHP GD extensionPHP GD extension not available
解決:
yum -y install php-gd
[root@RS1 libexec]# /etc/init.d/nagios checkconfig
Running configuration check...
OK.
[root@RS1 libexec]# service httpd restart
停止 httpd: [確定]
正在啟動 httpd:
[root@RS1 libexec]# /etc/init.d/nagios reload
Running configuration check...
Reloading nagios configuration...
done
再看觀察瀏覽器報錯:
Your environment passed all requirements. Remove or rename the /usr/local/pnp4nagios/share/install.php file now.
解決辦法:
mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ignore
以上只是解決了收集數(shù)據(jù)的功能,還必須在每一個host、service上展示相應(yīng)的圖形
設(shè)置如下:
編輯templates.cfg模板文件,創(chuàng)建host和service支持pnp4nagios功能:
define host {
name host-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_
register 0
}
define service {
name srv-pnp
action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
register 0
}
定義完成之后,最后只需在定義的hosts、services配置文件中加入下操作:
define host{
use linux-server,host-pnp ; Name of host templates to use
; This host definition will inherit all variables that are defined
; in (or inherited by) the linux-server host template definition.
host_name localhost
alias localhost
address 127.0.0.1
}
define service{
use local-service,srv-pnp ; Name of service template to use
host_name localhost
service_description PING
check_command check_ping!100.0,20%!500.0,60%
}
于是整個配置工作完成,訪問瀏覽器出圖如下
至此結(jié)合圖形展示成功
新建菜鳥學(xué)習(xí)交流群:584498750
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
新聞標(biāo)題:為nagios裝上pnp4nagios功能-創(chuàng)新互聯(lián)
文章地址:http://jinyejixie.com/article8/diodip.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、服務(wù)器托管、網(wǎng)站導(dǎo)航、微信小程序、建站公司、靜態(tài)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容