中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

nagios插件pnp安裝

發布時間:2020-06-14 11:57:51 來源:網絡 閱讀:469 作者:inbank2012 欄目:移動開發

1、安裝rrdtool

# tar zxvf rrdtool-1.4.5.tar.gz && cd rrdtool-1.4.5 && ./configure --prefix=/usr/local/rrdtool && make && make install

2、安裝pnp

tar zxvf pnp-0.4.13.tar.gz && cd pnp-0.4.13 && ./configure --with-nagios-user=nagios  --with-nagios-group=nagios  --with-rrdtool=/usr/local/rrdtool/bin/rrdtool --with-perfdata-dir=/usr/local/nagios/share/perfdata && make all && make install && make install-config && make install-init 

 

安裝完成,PNP默認文件放置情況如下:
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.4.5)
  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/
 
ps:RRDs Perl Modules:                *** NOT FOUND ***
在這里我遇到一個很奇怪的問題,由于沒有安裝rrds perl模塊,導致pnp出圖的數據是亂碼,附上圖片:
nagios插件pnp安裝
后來通過yum install rrdtool-perl就恢復正常了,有圖有真相
 

nagios插件pnp安裝

3、配置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 /usr/local/nagios/etc/pnp
修改process_perfdata.cfg文件
vim /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模式。
4、修改Nagios配置文件
1、增加小太陽圖標
修改templates.cfg,增加一個定義PNP的host和service。修改后的內容如下:
define host {
  name       host-pnp
  register   0
#action_url /nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_' class='tips' rel='/nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
action_url /nagios/pnp/index.php?host=$HOSTNAME$
process_perf_data 1
}
ps:我這里只添加了主機的小太陽圖標,每當添加某主機的服務的時候,都會自動生成該服務的數據文件
 

nagios插件pnp安裝

 

 

nagios插件pnp安裝

2、修改commands.cfg,定義host-perfdata

 

define command{

       command_name  process-host-perfdata

       command_line  /usr/local/nagios/libexec/process_perfdata.pl

       }

3、讓主機引用host-perfdata

 

root># cat hosts.cfg 

define host{

        use     host-pnp        

        host_name               xx

        alias                    xx(x)

        address                  xx

        contact_groups            shyygroup

        check_command           check-host-alive

        max_check_attempts       5

        notification_interval       10

        notification_period        24x7

        notification_options       d,u,r

}

 

4、重啟nagios服務后,在這個目錄下會產生2個主機的目錄

ls /usr/local/nagios/share/perfdata/

xxjshyy  xxysix

cd xxjshyy 

 

-rw-rw-r-- 1 nagios nagioscmd 1151496 Dec 21 16:13 Current_Load.rrd

-rw-rw-r-- 1 nagios nagioscmd   12165 Dec 21 16:13 Current_Load.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:11 Java_9800.rrd

-rw-rw-r-- 1 nagios nagioscmd   11208 Dec 21 16:11 Java_9800.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:12 Java_9801.rrd

-rw-rw-r-- 1 nagios nagioscmd   11208 Dec 21 16:12 Java_9801.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 18 17:35 mysql_3306.rrd

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:11 Mysql_3306.rrd

-rw-rw-r-- 1 nagios nagioscmd   11199 Dec 18 17:35 mysql_3306.xml

-rw-rw-r-- 1 nagios nagioscmd   11202 Dec 21 16:11 Mysql_3306.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:12 Nrpe_5666.rrd

-rw-rw-r-- 1 nagios nagioscmd   11198 Dec 21 16:12 Nrpe_5666.xml

-rw-rw-r-- 1 nagios nagioscmd  768224 Dec 21 16:14 Ping.rrd

-rw-rw-r-- 1 nagios nagioscmd   11702 Dec 21 16:14 Ping.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:14 sda3.rrd

-rw-rw-r-- 1 nagios nagioscmd   11170 Dec 21 16:14 sda3.xml

-rw-rw-r-- 1 nagios nagioscmd 1534768 Dec 21 16:13 traffic.rrd

-rw-rw-r-- 1 nagios nagioscmd   12701 Dec 21 16:13 traffic.xml

-rw-rw-r-- 1 nagios nagioscmd  384952 Dec 21 16:12 Users.rrd

-rw-rw-r-- 1 nagios nagioscmd   11120 Dec 21 16:12 Users.xml

 

 

ps:點擊小太陽也能會報以下這種錯誤:

 

Deprecated: Assigning the return value of new by reference is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1026
 
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 557
 
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 559
 
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 563
 
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/nagios/share/pnp/include/function.inc.php on line 565
 
Deprecated: Function eregi() is deprecated in /usr/local/nagios/share/pnp/include/function.inc.php on line 1502

 

解決:

 

這是因為pnp-0.4.14對PHP 5.3.0的支持還不是很好,其中有幾個bug需要修改:
根據錯誤提示打開
vi /usr/local/nagios/share/pnp/include/function.inc.php
找到行1541修改為
if($level == 2 && $type == "complete" && preg_match("/^NAGIOS_/",$tag)){
還會有兩處錯誤需要修改,根據提示找到對應行進行修改:
line 556: 添加:date_default_timezone_set('UTC');
line 1032:修改為$pdf = new PDF('P', 'mm', 'A4'); 刪除&
再重新重啟nagios,應該就能看到圖表了

 

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

体育| 唐海县| 阿勒泰市| 泌阳县| 囊谦县| 固原市| 隆化县| 横山县| 甘洛县| 上高县| 高清| 杂多县| 临沭县| 扎鲁特旗| 镇平县| 长春市| 渑池县| 库车县| 瑞安市| 革吉县| 西乌| 育儿| 海城市| 夏津县| 长垣县| 蕲春县| 金堂县| 六枝特区| 平顺县| 武清区| 西青区| 行唐县| 西宁市| 普兰县| 海林市| 普洱| 北流市| 哈尔滨市| 营山县| 浦县| 历史|