Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Console-Network Management imports MIB information base in Cacti system

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

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.

There are two ways to import a MIB file into CACTI. First, the easiest way is to modify an existing SNMP data query. Second, create a new SNMPdata query. Since the first method: modifying the created dataquery is a subset of the second new dataquery, only the second method is described below.

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

Step 1: create a new SNMP query xml file

First, we need to create an .xml file that tells the Cacti system what information to get and how to get it. The most difficult part of this step is to select the exact MIB variable to use. The industry standard server has a private MIB that counts the average CPU utilization for 5 minutes per system process. MIB variables are a set of information standards, such as total traffic, error packets, dropped packets, broadcast packets, and so on. However, such information may often have multiple data sources (for example, a switch may have hundreds of network interfaces). In order to keep these interfaces independent when querying information, an index value is added to the end of the normal MIB variable. This index value is used to distinguish the different interfaces associated with the MIB variable. However, this value is not fixed and will change after the device is rebooted. Therefore, we must tell the Cacti system what MIB variables contain the index, what variables can detect and use the index, and then get some useful information. Under industry standard server conditions, the index contained in 1.3.6.1.4.1.232.11.2.3.1.1.1 is actually used at .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.

Here are the new queries that need to be created for this xml file

"

Get CompaqProcessors

Queries a host for alist of monitorableprocessors

.1.3.6.1.4.1.232.11.2.3.1.1.1

Index

Walk

Value

Input

.1.3.6.1.4.1.232.11.2.3.1.1.1

5 MinuteUtilization

Walk

Value

Output

.1.3.6.1.4.1.232.11.2.3.1.1.3

"

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 and description are optional and have no effect on Cacti operations. The Oid index field should contain the MIB variable for this query. Queries in any area will use the index values collected by the oid index. Any data query field area must contain at least two variables: one is to use the index and the other is to collect data to draw.

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 murz 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.

In the above example, there are two variables in the fields field area: cpqHoCpuUtilIndex andcpqHoCpiUtilFiveMin. The name can be any character that contains uppercase and lowercase letters. Numbers and punctuation can cause errors. It is safe for most query methods to set the return value T to walk. The source value allows you to do some processing on the return value of the query. In this simple example, we set it to "value". The Direction field is very important. The Input field is immutable. Like an index value, a description field, or a name field. The Input field is used by cacti to index MIB variables. The Output field is a field about the settings of the drawing.

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.

Once you have created the xml file, save it in the / resource/snmp_queries/ directory. We will call compaq_cpu.xml. Do not use spaces or special characters in the name field to avoid problems later.

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)

Step 2: create a Data Query in Cacti

Open the Data Queries menu, click the add button in the upper right corner, and fill in the appropriate content

Name: the name of the query

Description: description of the query

Xml path: the path where the file is located. In this case, it should be in "/ resource/snmp_queries/compaq_cpu.xml"

Data Input Method: select the query type. Because it is snmp protocol, choose 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.

Click create. Enter the additional field. In the Data Input Method area, the first three options should always be set to the following values:

Index Type: SNMP Field Name (Dropdown)

Index Value: SNMP Field Value (From User)

Output Type ID: SNMP Output Type (Dropdown)

Click Save.

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.

Step 3: create a Data Template

Navigate to the data template interface and click the "add" button in the upper right corner. The following fields appear:

Name (Data Templates section): name of the data template

Name (Data Source Section): the name that Cacti automatically generates for the new data source. 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. Select an alphanumeric character name. It is only used within Cacti. The author uses compaq_cpu.

Minimum Value: Since this is a% utilization, 0 is the bestchoice. Percentage, the best is 0

Maximum Value: It is impossible to have more than 100% utilization,so enter 100. Enter 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:

Click the "add" button in the upper-right corner of the graph template view. The name of the graphtemplate appears on the screen, click Save, and some additional options appear. Click the add button on the right and fill in the following fields:

Data Source: Select the data source that you created in theprevious step. The data source created in the previous step

Color: Pick something that you like. Select Color

Graph Item Type: Since we are only graphing one item, selectAREA. Draw only one data item and select AREA

Consolidation Function: Select Average selection average

CDEF Function: None

Value: Leave this entry blank remains empty

Gprint Type: Normal ordinary

Text Format: This will be displayed at the bottom of the graph.Enter something logical like "CPU" will be displayed at the bottom of the graph. Enter words like "CPU".

Click on save. Click 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.

You can continue to add other items to show the maximum, minimum, and current CPU utilization. However, it is not necessary. We won't discuss it here.

Then click the add button on the right. Enter the name of the data source and set a check mark under item # 1. This associates the data source with the drawing. Click Save.

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.

Step 5: create a Host Template.

Open the HostTemplate menu and click the "add" button. Enter a template name and save it. Then open the template. I didn't find a way not to reopen the template. If anyone has any suggestions, I'm all ears. Select the dataquery you created previously in drop down box in the "Associated Data Queries" section, and click Save.

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.

Step 6: add Graph template to Data Query

Open Data Query, scroll down to the "Associated GraphTemplates" area, and click Add. Enter the name of the drawing, select the drawing template in the drop-down box, and click Save. You should now be able to use the new MIB variable.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report