Nagios圖形化Pnp安裝和配置

⑴安裝完nagios,繼續(xù)安裝pnp,要注意rrdtool的安裝。
tar -xvzf pnp-0.4.13.tar.gz
cd pnp-0.4.13
./configure
make all
make install
make install-config
make install-init
---------------------------------------------------------------------------------
FAQ:
*** Configuration summary for pnp 0.4.13 02-19-2009 ***

General Options:
------------------------- -------------------
Nagios user/group: nagios nagios
Install directory: /usr/local/nagios
HTML Dir: /usr/local/nagios/share/pnp
Config Dir: /usr/local/nagios/etc/pnp
Path to rrdtool: /usr/local/bin/rrdtool (Version 1.2.23)
RRDs Perl Modules: *** NOT FOUND ***
RRD Files stored in: /usr/local/nagios/share/perfdata
process_perfdata.pl Logfile: /usr/local/nagios/var/perfdata.log
Perfdata files (NPCD) stored in: /usr/local/nagios/var/spool/perfdata/
-----------------------------------------
process_perfdata.pl 安裝在 /usr/local/nagios/share/
配置示例文件安裝在/usr/local/nagios/libexecs
config.php安裝于/usr/local/nagios/etc/pnp

⑵修改配置文件

cd /usr/local/nagios/etc/pnp/
cp process_perfdata.cfg-sample process_perfdata.cfg
cp npcd.cfg-sample npcd.cfg
cp rra.cfg-sample rra.cfg
chown -R nagios:nagios *

vi /usr/local/nagios/etc/pnp/process_perfdata.cfg
....
LOG_FILE = /usr/local/nagios/var/perfdata.log
#
# Loglevel 0=silent 1=normal 2=debug
#
LOG_LEVEL = 2
#先改為2,為debug模式

創(chuàng)新互聯(lián)建站主營潤州網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,手機(jī)APP定制開發(fā),潤州h5小程序定制開發(fā)搭建,潤州網(wǎng)站營銷推廣歡迎潤州等地區(qū)企業(yè)咨詢


修改etc/objects/templates.cfg增加新命令(增加小太陽標(biāo)記)
#在use的后面添加"host-pnp"即可讓監(jiān)控圖上的主機(jī)名稱旁邊增加一個小太陽的標(biāo)記,點(diǎn)擊此標(biāo)記即可查看pnp圖片。
define host {
name host-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
#還可以在service欄添加srv-pnp,添加后會在相應(yīng)的欄內(nèi)增加小太陽。
define service {
name srv-pnp
register 0
action_url /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
process_perf_data 1
}
 



修改etc/nagios.cfg
找到如下幾項(xiàng),去掉注釋
process_performance_data=1
host_perfdata_command=process-host-perfdata
service_perfdata_command=process-service-perfdata


修改commands.cfg
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/process_perfdata.pl
}
 



⑥nginx下的安全問題,需作如下配置
修改pnp的web服務(wù)器配置文件nginx.conf,請注意安全問題,我這里未做安全驗(yàn)證。


location /pnp/ {
root /usr/local/nagios/share/;
location ~ .*/.php?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
如果開啟了open_basedir還需修改php.ini
open_basedir =
"/opt/htdoc:/opt/php/lib/php:/tmp/session:/tmp/upload:/usr/local/nagios/share/pnp:/usr/local/nagios/etc/pnp:/usr/local/nagios/share/perfdata:/usr/local/rrdtool/bin/rrdtool
 



㈢測試:
為localhost這臺主機(jī)在主機(jī)圖標(biāo)旁邊添加個小太陽標(biāo)記
vi /usr/local/nagios/etc/nagios.cfg
#為這個主機(jī)增加小太陽標(biāo)記
define host{
use linux-server,host-pnp
host_name localhost
alias localhost
address 127.0.0.1
}
#重新加載配置文件
service nagios reload
如果正確此時就會生成pnp文件
[root@localhost ~]# ls /usr/local/nagios/share/perfdata/localhost/
Current_Load.rrd Current_Users.xml PING.rrd Root_Partition.xml
Current_Load.xml HTTP.rrd PING.xml Swap_Usage.rrd
Current_Users.rrd HTTP.xml Root_Partition.rrd Swap_Usage.xml

打開網(wǎng)頁http://localhost/nagios
點(diǎn)擊小太陽就可以看到圖表,同訪問http://localhost/nagios/pnp
Nagios圖形化Pnp 安裝和配置

Nagios圖形化Pnp 安裝和配置

FAQ: 注意可能提示這個模塊沒有安裝:
Time/HiRes.pm模塊的安裝:
①執(zhí)行以下命令安裝該模塊。
#perl -MCPAN -e 'install Time::HiRes'
或安裝Time-HiRes-1.9707.tar.gz
②如果打開pnp頁面提示Hostname is not set,則檢查etc/pnp/里的sample文件都更改正確,檢查templates.cfg文件中url的正確性,還不行就等等,別太心急了,裝完沒那么快出圖。

文章題目:Nagios圖形化Pnp安裝和配置
文章URL:http://muchs.cn/article6/gjgeog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供標(biāo)簽優(yōu)化、網(wǎng)站設(shè)計(jì)企業(yè)網(wǎng)站制作、網(wǎng)站策劃、域名注冊、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)