Cacti Data Templates Step
Creating a custom indexed SNMP Data QueryIn this section we shall describe how to create a custom Data Query to retrieveindexed data from an SNMP enabled device. For the purposes of thisexample we shall use the Temperature Sensors table located under theLM-SENSORS-MIB::lmTempSensorsTable branch of the MIB tree.More information on this topic can be found in thesection of the.This example assumes you have a correctly configured lmsensorsinstallation.
If you require more information on this subject then theguide, particularly the section,may be of interest.Locating the data in the SNMP treeBefore we can create a new Data Query we need to decide exactly what we shall beretrieving and where in the MIB tree that data is located. As mentioned above we shallbe using the Temperature Sensors table located under theLM-SENSORS-MIB::lmTempSensorsTable OID. We can display this table using thesnmptable utility to ensure that the data we desire is actuallyavailable from our selected device. Lisa # snmptable -c hacking -v 2c host1 LM-SENSORS-MIB::lmTempSensorsTableSNMP table: LM-SENSORS-MIB::lmTempSensorsTable lmTempSensorsIndex lmTempSensorsDevice lmTempSensorsValue 12 Temp: CPU 1 37750 13 Temp: Memory 45000 14 Temp: Bridge 48000Once we have verified that the lmTempSensorsTable is indeed availablewe can examine its structure in more detail using the snmpwalkutility, as shown in the example below. As Cacti only works withdotted-decimal addresses we have selected that output mode using the-On parameter.
Example Data Query binding for the LM-SENSORS-MIB::lmTempSensorsTableYou can see in the above example code that the schema is extremely simple. Lines 2 and 3 provide aname and a description respectively. Line 4 describes the index order, which inthis case is numeric, and line 5 gives the dotted-decimal address ofthe index column of the SNMP table we are going to query.Following this basic information (starting at line 7) is the description of the data fields which will bereturned by this Data Query.
As you can see each field is then described by a series ofXML elements.The element allows a name to be specified for the field. Cacti main menuNow that we have created an XML Data Query Binding we can use theCacti web interface to create a new Data Query.To accomplish this task we first need to select the Data Queries page from theCacti main menu, as shown in.Once the Data Queries page has finished loading you should see a list of the existingData Queries, similar to that shown below in. As youcan see Cacti is shipped with a number of DataQueries already defined. The list shows the template name, which Data InputMethod is employed and provides a check-box which may be used to select one or more of theData Queries and perform a variety of actions on them, including Deletewhich you can see in our example is the default option.Additional Data Query Templates, including many contributed by end-users, areavailable from thesection of the.Besides deleting a Data Query the Data Queries page can also be usedto create a new Data Query by clicking on the Add link located at thetop right hand corner of the Data Queries box. As we are interested in doing just thatclick on the Add link now to display the Data Queries new page,as shown in. Data Templates newAs you can see in the example above there are several fields which need completing before we cansubmit the Data Templates new form and create a new Data Template.The table below describes the fields on the Data Templates new form and providessuggested values where appropriate.Suggested values for the Data Template new formData Template NameThe Data Template Name field allows a name to be specified for thisData Template. As this value will be used in theCacti user interface it should be descriptive.LM-SENSORS-MIB - lmTempSensorsTableData Source NameWhen the corresponding Data Source is created the value of this fieldwill be used as the Data Source Name.
In this example we are using thespecial keyword hostdescription which expands to the name of the associatedDevice. hostdescription - lmTempSensorsTableData Input MethodAs mentioned before there are a variety of Data Input Methods available. Herewe are using the Get SNMP Data (Indexed) method to retrieve data from anSNMP enabled device.Get SNMP Data (Indexed)Associated RRAsEach Data Template may write data to one or more of the available RoundRobin Archives. As we are using a Step time of 60we will need to select all of the available RRAs.
If we were using aStep time of 300 (five minutes) then it would make nosense to select the first RRA.AllStepThe Step time is the amount of time which passes between polling usingthe associated Data Query. A step time of 60 seconds(one minute), or 300 seconds (five minutes) is usually appropriate althoughoccasionally a step time of 86400 seconds (one day) is useful.60Data Source ActiveThis check-box must be checked for the associated Data Source to be active.YesInternal Data Source NameWhen we created the XML Data Query Binding we named the fields using theXML element name.
The value used here should correspond to that chosenearlier.lmTempSensorsValueMinimum ValueAny value below the value specified here will be recorded by the RRDtool application as Not A Number (NaN). A value of0 (zero) disables this function.0Maximum ValueAny value above the value specified here will be recorded by the RRDtool application as Not A Number (NaN). A value of0 (zero) disables this function.0Data Source TypeThere are a number of Data Source Types available.
In this example we areusing the GUAGE type as every reading from the Data Querywill return an unrelated value describing the current temperature. Data Templates newAs we wish to use the Index Type, Index Value and OutputType ID we specified when we created the Data Source we need to tick thosecheck-boxes as shown above and then click on the Save button.Associate the new Data Query with a DeviceBefore we can test that our new Data Query is correctly receiving data we need toassociate it with a Device so that the query has a target to run against. Select theDevices entry on the Cacti main menu, as shown in, todisplay the Device List. Once the Device List appears select thedevice for which you wish to generate temperature graphs. At the bottom of the Devicepage there is a box containing Associated Data Queries which shows a list of all theData Queries associated with that device, as shown inbelow.
Associated Data QueriesIn our example there are already two Data Queries listed, one to measure NetworkInterface Statistics and another to measure the amount of free and used space on the monitoreddisk partitions. You can also see in our example that we have started the process of adding a newData Query by selecting the SNMP - lmTempSensorsTable entryfrom the Add Data Query drop-down list. We have also chosen Index CountChanged as the Re-Index Method so that the RRA indexeswill be automatically regenerated should the number of available sensors change. The DataQuery can then beassociated with our chosen Device by clicking theAdd button.Once the Data Query has been added the page will refresh and the new DataQuery will be shown in the list. We can now verify that the query is operating correctly byselecting the Verbose Query entry for the Data Query we justcreated. Assuming that everything has worked as expected you should see output similar to thatshown in the example below.
Create a dataflow that connects to your source data (in this case a file), add a query to select the required columns, rename columns, add calculations (like string manipulations or conversions) and add a template table at the end.To add the template table you can use the palette at the right and click the template table icon.With this dataflow the dimcustomer target table will be defined based on the output schema for the Query transform.In the dataflow below we do something similar for the fact table where we want to join data from multiple tables to load it into one fact table. Of course we make sure that the customerID is available both in the dimcustomer as well as in the factsales so that we can create a star schema with one dimension and one fact.As a result the two template tables are now available in the repository.You have the possibility now to execute the job and effectively create and load the template tables with some data, this makes it easier to validate the design and check results.
Cacti Template Downloads
But for this example, we will not execute the job and use the (virtual) template tables as a starting point to create the BWA cube.