溫馨提示×

溫馨提示×

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

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

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

發(fā)布時間:2020-06-04 11:25:54 來源:網(wǎng)絡(luò) 閱讀:743 作者:cinnarnia 欄目:網(wǎng)絡(luò)管理

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.


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


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)建一個新的SNMP query xml 文件

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

以下是這個xml文件需要創(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是可選項,對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.

在上面的實例中,在fields字段區(qū)域中有兩個變量: cpqHoCpuUtilIndex andcpqHoCpiUtilFiveMin。名字可以是任何包含大小寫字母的字符。數(shù)字和標點會引起錯誤。 多數(shù)查詢方法設(shè)置成walk返回值T是安全的。源值允許你對查詢的返回值進行一些處理。在這個簡單的例子中,我們設(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)建一個Data Query

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

Name:查詢的名稱

Description:查詢的描述

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

Data Input Method:選擇查詢類型。因為是snmp協(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.

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

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

點擊保存。

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

導航至data template界面點擊右上角的“add”按紐。出現(xiàn)以下字段:
Name (Data Templates section): 數(shù)據(jù)模板的名稱
Name (Data Source Section): Cacti自動為新數(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. 選擇一個字母數(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視圖的右上角點擊“add”按紐。屏幕中出現(xiàn)graphtemplate的名稱,點擊保存,出現(xià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.只畫一個數(shù)據(jù)項,選擇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”將會顯示在圖形的底部。輸入像“CPU”這類的一些文字。
Click on save.點擊保存。
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ù)增加其它項去顯示最大、最小和當前CPU利用率。然而,不是必需的。這里不討論了。

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

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)建一個Host Template.

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

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ū)域,點擊Add。輸入圖形名稱,選擇下拉框中的圖形模板,點擊保存。你現(xiàn)在應(yīng)該可以使用新的MIB變量了。


向AI問一下細節(jié)

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

AI