控制臺(tái)-網(wǎng)絡(luò)管理之在Cacti系統(tǒng)中導(dǎo)入MIB信息庫

There are two possible ways to add a new indexed MIB variable toCacti. The first, and easiest, is to modify an existing SNMP query.The second, is to create a new SNMP data query from scratch. Sincemodifying an existing query is simply a subset of creating a newquery, only the second will be described.
This how-to will lead you through the steps of creating acompletely new SNMP data query and integrating it into Cacti, usingthe CPU utilization of a Compaq Proliant server as an example.

公司主營業(yè)務(wù):成都網(wǎng)站建設(shè)、做網(wǎng)站、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭能力。成都創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。成都創(chuàng)新互聯(lián)推出臨滄免費(fèi)做網(wǎng)站回饋大家。

有兩種方法可以將MIB文件導(dǎo)入CACTI。首先,最容易的方法是修改一個(gè)已存在的SNMP data query。其次,是新建一個(gè)SNMPdata query。由于第一種方法:修改已創(chuàng)建的data query是第二種新建dataquery的一個(gè)子集,以下只介紹第二種方法。

Step 1: Create a new SNMP query XML file
First we need to create an XML file to tell Cacti what informationto get and how to get it. The most difficult part of this step isdetermining the exact MIB variables to use. Proliant servers have aproprietary MIB that contains the 5 minute average CPU utilizationfor each processor.
MIB variables stand for one piece of information like totaltraffic, errors, discards, multicast packets..... However, it isoften possible to have more than one source for this data (I.E. aswitch can have several hundred network interfaces). To keep theseinterfaces separate when querying a device for a single piece ofinformation, an index value is added to the end of the normal MIBvariable. This index value is used to distinguish one interfacefrom the others on all MIB variables associated with thatinterface. However, this value is not fixed. It can change any timethat the device is rebooted. Thus we must tell Cacti what MIBvariable contains the index, and then tell it what variables it canpoll, using this index, to get some useful information. In the caseof our proliant server, the index is contained at1.3.6.1.4.1.232.11.2.3.1.1.1 The actual utilization is located at.1.3.6.1.4.1.232.11.2.3.1.1.3

步驟1:創(chuàng)建一個(gè)新的SNMP query xml 文件

首先我們需要?jiǎng)?chuàng)建一個(gè).xml文件告訴Cacti系統(tǒng)要獲取什么信息以及如何獲取。此步驟最困難的部分是準(zhǔn)確選定要使用的MIB變量。工業(yè)標(biāo)準(zhǔn)服務(wù)器有一個(gè)統(tǒng)計(jì)每個(gè)系統(tǒng)進(jìn)程5分鐘平均CPU利用率的私有MIB。MIB變量是一整套信息標(biāo)準(zhǔn),像總流量、錯(cuò)誤包、丟棄包、廣播包等。但是,這類信息常常可能有著多個(gè)數(shù)據(jù)來源(比如,一臺(tái)交換機(jī)有可能擁有幾百個(gè)網(wǎng)絡(luò)接口)。為了讓這些接口在信息查詢時(shí)保持各自的獨(dú)立性,在普通的MIB變量的結(jié)尾加上了一個(gè)索引值。這個(gè)索引值用于區(qū)分MIB變量關(guān)聯(lián)的不同接口。然而,這個(gè)值不是固定的,設(shè)備重啟后值會(huì)發(fā)生改變。因此,我們必須告訴Cacti系統(tǒng)什么MIB變量包含這個(gè)索引,什么變量能檢測(cè)、使用這個(gè)索引,然后得到一些有用的信息。在工業(yè)標(biāo)準(zhǔn)的服務(wù)器條件下,索引包含在1.3.6.1.4.1.232.11.2.3.1.1.1實(shí)際使用率位置在.1.3.6.1.4.1.232.11.2.3.1.1.3。

The following is the XML file that needs to be created for this newquery.

以下是這個(gè)xml文件需要?jiǎng)?chuàng)建的新查詢

<interface>

<name>Get CompaqProcessors</name>
<description>Queries a host for alist of monitorableprocessors</description>
<oid_index>.1.3.6.1.4.1.232.11.2.3.1.1.1</oid_index>

<fields>
<cpqHoCpuUtilIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.232.11.2.3.1.1.1</oid>
</cpqHoCpuUtilIndex>
<cpqHoCpiUtilFiveMin>
<name>5 MinuteUtilization</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.232.11.2.3.1.1.3</oid>
</cpqHoCpiUtilFiveMin>
</fields>
</interface>


Name and description are optional fields and have no affect on theoperation of Cacti. The oid_index field should contain the MIBvariable that contains the index for this query.
Anything inside of the section will be queried using the indexvalues gathered from the oid_index. There must be at least twovariables in the fields section in any data query: one to use as anindex and one gathering data to plot.

Name和description是可選項(xiàng),對(duì)Cacti操作沒有影響。Oid索引字段應(yīng)該包含此次查詢的MIB變量。任何區(qū)域內(nèi)的查詢將使用oid索引采集到的索引值。任何數(shù)據(jù)查詢字段區(qū)域內(nèi)必須包含至少兩種變量:一種是使用索引另一種是采集數(shù)據(jù)去繪制。

In the example above, there are two variables given in the fieldssection: cpqHoCpuUtilIndex and cpqHoCpiUtilFiveMin. The names canbe anything so long as they only contain characters from a-z andA-Z. Numbers and punctuation will cause an error. T is safe toleave method set to walk for most queries. The source value allowsyou to do some processing on the value that the query returns. Inthis simple case, we will leave this set to “value”. The Directionfield is very important. Input fields are fields that do not changeover time. These are generally things like the index value, adescription field, or a name. Input fields will be used withincacti to index the MIB mariables. Output fields are those fieldswhich can be graphed.

在上面的實(shí)例中,在fields字段區(qū)域中有兩個(gè)變量: cpqHoCpuUtilIndex andcpqHoCpiUtilFiveMin。名字可以是任何包含大小寫字母的字符。數(shù)字和標(biāo)點(diǎn)會(huì)引起錯(cuò)誤。 多數(shù)查詢方法設(shè)置成walk返回值T是安全的。源值允許你對(duì)查詢的返回值進(jìn)行一些處理。在這個(gè)簡單的例子中,我們?cè)O(shè)置成“value”。Direction字段是非常重要的。Input字段是不變的字段。就像索引值、description字段、或者name字段。Input字段被cacti用來索引MIB變量。Output字段關(guān)于制圖的設(shè)置的字段。

Once you have created your XML file, save it in the/resource/snmp_queries/ directory. We will call our filecompaq_cpu.xml. Do not use any spaces or special characters in thefile name as it may cause problems later.

一旦你創(chuàng)建了xml文件,保存在/resource/snmp_queries/目錄下。我們將調(diào)用compaq_cpu.xml。不要在name字段中使用空格或特殊字符,以免后面引起問題。

Step 2: Create a Data Query in Cacti
Open the Data Queries menu in Cacti and click on the add button atthe top right hand side of the screen. Fill in the fields asappropriate:
Name: your name for this query
Description: a description of this query… What does it do?
Xml Path: The path to your query. In this example it should read“/resource/snmp_queries/compaq_cpu.xml”
Data Input Method: Select the type of query. Since this is SNMP,choose Get SNMP Data (Indexed)

步驟2:在Cacti中創(chuàng)建一個(gè)Data Query

打開Data Queries菜單,點(diǎn)擊右上角的add按紐,填寫適合的內(nèi)容

Name:查詢的名稱

Description:查詢的描述

Xml path:文件所在路徑。在本例中應(yīng)該在“/resource/snmp_queries/compaq_cpu.xml”

Data Input Method:選擇查詢類型。因?yàn)槭莝nmp協(xié)議,選擇SNMP Data(Indexed)

The click on “Create”. This will bring up some additional fields.In the Data Input Method section, the first three options shouldalmost always all be checked and have the following values:
Index Type: SNMP Field Name (Dropdown)
Index Value: SNMP Field Value (From User)
Output Type ID: SNMP Output Type (Dropdown)

Click on Save.

點(diǎn)擊創(chuàng)建。進(jìn)入附加字段。在Data Input Method區(qū)域,最前面的三個(gè)選項(xiàng)應(yīng)該總是被設(shè)置為下面的值:

Index Type: SNMP Field Name (Dropdown)
Index Value: SNMP Field Value (From User)
Output Type ID: SNMP Output Type (Dropdown)

點(diǎn)擊保存。

Step 3: Create a Data Template
Navigate to the data template screen and click on the “add” buttonat the top right hand side of the screen. In the screen thatappears fill in the fields as follows:
Name (Data Templates section): the name for the data template
Name (Data Source Section): The name that cacti will automaticallygenerate for all new data sources of this type. The author hasused: |host_description| CPU |query_cpqHoCpuUtilIndex|.
Data Input Method: Get SNMP Data (Indexed)
Internal Data Source Name: Choose a name that only usesalphanumeric characters. This is for Cacti Internal use only. Theauthor has used compaq_cpu.
Minimum Value: Since this is a % utilization, 0 is the bestchoice.
Maximum Value: It is impossible to have more than 100% utilization,so enter 100.

Click on Save. This will bring up yet more fields to fill in. Placea check mark next to the fields: Index Type, Index Value, andOutput Type ID and click on save.

步驟3:創(chuàng)建Data Template

導(dǎo)航至data template界面點(diǎn)擊右上角的“add”按紐。出現(xiàn)以下字段:
Name (Data Templates section): 數(shù)據(jù)模板的名稱
Name (Data Source Section): Cacti自動(dòng)為新數(shù)據(jù)源生成的名稱。 The author has used:|host_description| CPU |query_cpqHoCpuUtilIndex|. sources of thistype. The author has used: |host_description| CPU|query_cpqHoCpuUtilIndex|.
Data Input Method: Get SNMP Data (Indexed)
Internal Data Source Name: Choose a name that only usesalphanumeric characters. 選擇一個(gè)字母數(shù)字的字符名稱。只在Cacti內(nèi)部使用。筆者在本例中用了compaq_cpu.
Minimum Value: Since this is a % utilization, 0 is the bestchoice.百分比,最佳是0
Maximum Value: It is impossible to have more than 100% utilization,so enter 100.輸入100

Step 4: Create a Graph Template

Navigate to the graph template screen and click on the “add” buttonat the top right hand side of the screen. In the screen thatappears type in a name for the graph template and click on save.This will display some additional sections.
Click on the add button to the right of the Graph Template Itemssection. Fill in the fields as follows:

在graph template視圖的右上角點(diǎn)擊“add”按紐。屏幕中出現(xiàn)graphtemplate的名稱,點(diǎn)擊保存,出現(xiàn)一些額外的選項(xiàng)。點(diǎn)擊右邊的add按紐,填寫以下的字段:

Data Source: Select the data source that you created in theprevious step.上一步創(chuàng)建的data source
Color: Pick something that you like.選擇顏色
Graph Item Type: Since we are only graphing one item, selectAREA.只畫一個(gè)數(shù)據(jù)項(xiàng),選擇AREA
Consolidation Function: Select Average選擇平均值
CDEF Function: None
Value: Leave this entry blank保持為空
Gprint Type: Normal普通
Text Format: This will be displayed at the bottom of the graph.Enter something logical like “CPU”將會(huì)顯示在圖形的底部。輸入像“CPU”這類的一些文字。
Click on save.點(diǎn)擊保存。
You can continue adding other items to display the maximum,minimum, and current CPU utilization. However, they are notnecessary, and will not be covered here.
Next click on the add button to the right of the Graph Input Items.Enter a name for the data source and place a check mark next toItem #1. This will link the data source with a graph item. Click onSave.

你可以繼續(xù)增加其它項(xiàng)去顯示最大、最小和當(dāng)前CPU利用率。然而,不是必需的。這里不討論了。

再點(diǎn)擊右邊的add按紐。輸入數(shù)據(jù)源的名稱,在#1項(xiàng)的下面設(shè)置一個(gè)檢查標(biāo)記。這將關(guān)聯(lián)數(shù)據(jù)源和圖形。點(diǎn)擊保存。

Step 5: Create a Host Template
Open the Host Templates menu and click on the “add” button. Enter aname for the Host Template and click on save. Reopen this template.(I have not found a way to do this without having to reopen thetemplate. If anyone has any suggestions, I would love to hear them)Select the data query that you created earlier from the drop downbox under the “Associated Data Queries” section and click onadd.

步驟5:創(chuàng)建一個(gè)Host Template.

打開HostTemplate菜單點(diǎn)擊"add"按紐。輸入一個(gè)模板名稱,保存。再打開這個(gè)模板。(我沒有找到方法不用重新打開模板。如果誰有建議,我會(huì)洗耳恭聽。)選擇之前在“Associated Data Queries” 部分的drop down box創(chuàng)建的dataquery,點(diǎn)擊保存。

Step 6: Add the Graph template to the Data Query

Open up the Data Query, scroll down to the “Associated GraphTemplates” section and then click on Add. Enter a name for thisgraph and select the graph template from the drop down window.Click on save. You should now be able to use your new MIBvariables.

步驟6:為Data Query增加Graph template

打開Data Query,下滾到 “Associated GraphTemplates”區(qū)域,點(diǎn)擊Add。輸入圖形名稱,選擇下拉框中的圖形模板,點(diǎn)擊保存。你現(xiàn)在應(yīng)該可以使用新的MIB變量了。

本文標(biāo)題:控制臺(tái)-網(wǎng)絡(luò)管理之在Cacti系統(tǒng)中導(dǎo)入MIB信息庫
鏈接分享:http://muchs.cn/article36/jejssg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版商城網(wǎng)站、品牌網(wǎng)站制作軟件開發(fā)、App設(shè)計(jì)域名注冊(cè)

廣告

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

成都網(wǎng)站建設(shè)