国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Nagios Plugin for Cacti 安裝使用篇

前言:
Nagios Plugin for Cacti 簡稱 npc,是cacti的一個插件,這篇文章主要介紹如何在cacti中使用npc插件。


測試環(huán)境:
操作系統(tǒng):rhel4u4 php4.4.4 mysql-4.1.22 httpd-2.2.4
npc主頁:http://www.divagater.com/npc/
npc 當前版本:NPC 0.1.1a
nagios 主頁:http://www.nagios.org
nagios 當前版本:nagios-2.7
nagios 插件當前版本:nagios-plugins-1.4.6
fruity:圖形化配置nagios的工具,需要php5.x版本才能運行
http://fruity.sourceforge.net/
http://heanet.dl.sourceforge.net/sourceforge/fruity/
http://pear.php.net/get/HTML_TreeMenu-1.2.0.tgz
http://puzzle.dl.sourceforge.net/sourceforge/adodb/adodb471-1.tgz
將HTML_TreeMenu-1.2.0.tgz和adodb471-1.tgz直接解壓復制到fruity 下 分別改名為HTML 和adodb 其他不做修改
修改 fruity/includes下的config.ifg,需要更改的地方有,路徑,mysql信息
mysql 添加fruity 數(shù)據(jù)庫和user,password.
這樣,就可以用fruity來進行配置了。
注意:
在cacti服務器上的mysql版本必須是4.1以上,因為npc是以mysql4.1為基礎(chǔ)進行開發(fā)的。

第一章:安裝nagios
我們在cacti中使用nagios,首先我們要安裝nagios環(huán)境,安裝過程如下:
# tar –xvzf nagios-2.7.tar.gz
# mkdir /usr/local/nagios
# useradd nagios –d /usr/local/nagios
# passwd nagios 1qazSE$
# chmod 755 /usr/local/nagios
# grep "^User" /etc/httpd/conf/httpd.conf //查找apache的承托用戶
我這里是daemon。2.2.0以前的apache版本可能會是nobody
# /usr/sbin/groupadd nagcmd

# /usr/sbin/usermod -G nagcmd daemon-----這個地方就是前面的aapche承托用戶

# /usr/sbin/usermod -G nagcmd nagios


# cd nagios-2.7
#./configure --prefix=/usr/local/nagios --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include --enable-event-broker
# make all
# make install
# make install-init 安裝啟動腳本到/etc/init.d/
# make install-commandmode
# make install-config 安裝初始配置文件到/usr/local/nagios

nagios-plugins的安裝
tar –xvzf nagios-plugins-1.4.6.tar.gz
cd nagiso-plugins-1.4.6
./configure --prefix=/usr/local/nagios-plugins
make all
make install
注意:
nagios-plugins 1.4.6編譯安裝時出錯修正:
Making install in po
make[1]: Entering directory `/opt/software/nagios/nagios-plugins-1.4.6/po'
/bin/sh @MKINSTALLDIRS@ /usr/local/nagios-plugins/share
/bin/sh: @MKINSTALLDIRS@: No such file or directory
make[1]: *** [install-data-yes] Error 127
make[1]: Leaving directory `/opt/software/nagios/nagios-plugins-1.4.6/po'
make: *** [install-recursive] Error 1

需要修改一下po/Makefile文件:

MKINSTALLDIRS = @MKINSTALLDIRS@
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
替換為:
MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
安裝完成以后在/usr/local/nagios-plugins-plugins會產(chǎn)生一個libexec的目錄,將該目錄全部移動到/usr/local/nagios目錄下即可。 如下:
# mv /usr/local/nagios-plugins/libexec /usr/local/nagios
到此,兩個基本的TAR包安裝完成

配置apache過程:

在apache的httpd.conf文件中加入如下字段:

ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/

<Directory "/usr/local/nagios/sbin/">

AllowOverride AuthConfig

Options ExecCGI

Order allow,deny

Allow from all

</Directory>

Alias /nagios/ /usr/local/nagios/share/

<Directory "/usr/local/nagios/share">

Options None

AllowOverride AuthConfig

Order allow,deny

Allow from all

</Directory>

注意:

如果你的apache版本是2.2.0,那么你需要把以上這段加到

<IfModule alias_module>和 </IfModule> 之間。

配置頁面訪問權(quán)限:

在/usr/local/nagios/share目錄下

# cd /usr/local/nagios/share

# vi .htaccess

AuthName "Nagios Access"

AuthType Basic

AuthUserFile /usr/local/nagios/etc/.htpasswd

require valid-user

然后在/usr/local/nagios/sbin編輯.htaccess

#vi .htaccess

AuthName "Nagios Access"

AuthType Basic

AuthUserFile /usr/local/nagios/etc/.htpasswd

require valid-user

#/usr/local/apache/bin/htpasswd –c /usr/local/nagios/etc/.htpasswd nagiosadmin

New password:

Re-type new password:

Adding password for user nagiosadmin

這個apache目錄根據(jù)安裝目錄的不同而不同,用htpasswd命令生成用戶名和密碼以控制訪問權(quán)限。

配置和啟動nagios過程

# cd /usr/local/nagios/etc

把目錄里的.cfg-sample文件全部拷貝成.cfg

例如:

# cp nagios.cfg-sample nagios.cfg

修改cgi.cfg,把use_authentication=1改為use_authentication=0,即不用驗證.不然有一些頁面不會顯示。

修改后用如下命令檢查配置文件是否正常:

#/usr/local/nagios/bin/nagios –v /usr/local/nagios/etc/nagios.cfg

Nagios 2.7

Copyright (c) 1999-2007 Ethan Galstad (http://www.nagios.org)

Last Modified: 01-19-2007

License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...

Checked 5 services.

Checking hosts...

Checked 1 hosts.

Checking host groups...

Checked 1 host groups.

Checking service groups...

Checked 0 service groups.

Checking contacts...

Checked 1 contacts.

Checking contact groups...

Checked 1 contact groups.

Checking service escalations...

Checked 0 service escalations.

Checking service dependencies...

Checked 0 service dependencies.

Checking host escalations...

Checked 0 host escalations.

Checking host dependencies...

Checked 0 host dependencies.

Checking commands...

Checked 22 commands.

Checking time periods...

Checked 4 time periods.

Checking extended host info definitions...

Checked 0 extended host info definitions.

Checking extended service info definitions...

Checked 0 extended service info definitions.

Checking for circular paths between hosts...

Checking for circular host and service dependencies...

Checking global event handlers...

Checking obsessive compulsive processor commands...

Checking misc settings...

Total Warnings: 0

Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

如上紅色字標注,兩個為0就是正常的,如果出錯,那一定是你修改的配置文件有問題,請返回修改。

這時候你訪問http://your IP/nagios/可以看到如下圖

但點擊其他按鈕只能看到

Whoops!

Error: Could not read object configuration data!

Here are some things you should check in order to resolve this error:

Verify configuration options using the -v command-line option to check for errors.

Check the Nagios log file for messages relating to startup or status data errors.

Makesure you've compiled the main program and the CGIs to use the sameobject data storage options (i.e. default text file or template-basedfile).

Make sure you read the documentation oninstalling, configuring and running Nagios thoroughly beforecontinuing. If all else fails, try sending a message to one of themailing lists. More information can be found at http://www.nagios.org.

提示,這是因為你還沒有啟動nagios后臺進程,按如下命令啟動nagios

# /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

# /usr/local/etc/rc.d/nagios start

這個時候你返回剛才的URL,點擊Tactical Overview


證明你已經(jīng)配置成功nagios了。使用我就不在這里講了,網(wǎng)上有一些文章專門介紹。讓我們開始進入cacti的世界。

第二章:npc插件的安裝

就和其他插件的安裝一樣

# tar xzvf npc-0.1.1a.tar.gz //這會出現(xiàn)一個npc目錄

# mv npc <cacti install folder>/plugins/

# vi <cacti install folder>/plugins/npc/neb/inserter.c

修改第143行

&mysql,"localhost","USERNAME","PASSWORD","DATABASE",3306,NULL,CLIENT_MULTI_STATEMENTS

把以上幾個大寫字母地方改成你自己實際情況,不會改的看我下面的例子

&mysql,"localhost","***","***","cactidb",3306,"/tmp/mysql.sock",0

否則make 會出現(xiàn)如下錯誤

# make

gcc -g -O2 -Wall -o inserter.o inserter.c -shared -I../include -I/usr/include/mysql -lmysqlclient -fPIC

inserter.c: In function `nebmodule_init':

inserter.c:143: error: `CLIENT_MULTI_STATEMENTS' undeclared (first use in this function)

inserter.c:143: error: (Each undeclared identifier is reported only once

inserter.c:143: error: for each function it appears in.)

make: *** [all] Error 1

# cp <cacti install folder>/plugins/npc/neb/* <nagios source code>/modules/

# cd <nagios source code>/modules/

# make

這里做的主要是編譯inserter.o文件,要注意的問題:

gcc -g -O2 -Wall -o inserter.o inserter.c -shared -I../include -I/usr/local/mysql/include/mysql -lmysqlclient -fPIC

/usr/bin/ld: cannot find -lmysqlclient

collect2: ld returned 1 exit status

make: *** [all] Error 1

這個錯誤是不能找到libmysqlclient,這個其實是mysql版本問題,我們當前環(huán)境下沒有能包含mysql早期版本的庫,就會出現(xiàn)這個問題,好在mysql官方已經(jīng)給我想到了解決方法,你下載一個和你當前用的版本一致的MySQL-shared-compat-***.i386.rpm包,它就是原來解決這個問題的。(***是你的版本)

編譯后會發(fā)現(xiàn)有個inserter.o文件

# cp insert.o /usr/local/nagios/modules/

如果沒有modules文件夾,你要自己建立一個。

# vi /usr/local/nagios/etc/nagios.cfg

設(shè)置如下

retain_state_information=0

event_broker_options=-1 and

broker_module=/usr/local/nagios/modules/inserter.o

原因作者寫得很清楚:

NOTE:Setting retain_state_information=0 causes all hosts and services to goto a pending state until rechecked by Nagios. Without this setting theinserter module will never update any data in NPC. Its a minorinconvenience that I will try to fix in the inserter module.

# vi <cacti install folder>/include/config.php

加入$plugins[] = 'npc';到$plugins = array();下面,完成后如下:

$plugins = array();

$plugins[] = 'thold';

$plugins[] = 'monitor';

$plugins[] = 'npc'; //這個需要你自己添加的,如果不是很理解請參考我寫的 插件安裝

$plugins[] = 'reports';

$plugins[] = 'haloe';

$plugins[] = 'update';

登陸你的cacti

點擊--Console--User Management--admin

向下拉看到

Realm permissions control which sections of Cacti this user will have access to.

找到View NPC 副選框,點上鉤,如下圖,為了看得方便我把它圈起來了。


這樣,我們就可以看到如下


NPC插件出現(xiàn)了?。∵@個時候你還要檢查你的cactidb中是否多了npc開頭的數(shù)據(jù)庫,如果沒有,請重新登陸cacti界面。

我們點擊npc,就可以看到相應的情況了,如下圖


那么恭喜你,整合安裝結(jié)束了,你想擴展什么,直接按原來的nagios方法進行就可以了,但不同的是cacti也可以提供相應的監(jiān)控界面來幫助你整合資源。

本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Nagios 整合Cacti
手把手實現(xiàn)企業(yè)級開源監(jiān)控軟件cacti nagios ntop整合(圖解)
【博文推薦】Cacti+Nagios監(jiān)控平臺完美整合(2)
nagios+cacti整合文檔
centreon+nagios安裝配置操作手冊(6)-常見監(jiān)控配置
也談cacti整合nagios(centos)
更多類似文章 >>
生活服務
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服