Cacti (home)ForumsDocumentation

Differences

This shows you the differences between two versions of the page.

manual:100:8_rrdtool.05_external_rrds [2019/10/29 15:16] (current)
Line 1: Line 1:
 +===== Externally Updated RRDs =====
  
 +Cacti itself provides a very flexible and fast data gatherer, but situations may occur, where this is not what you want. Assuming, that there already is some rrd file filled by other means, question arises how to use this with cacti's flexible rrdtool front-end administration facilities.
 +
 +Sometimes people call this feature "Importing external rrds" to cacti. But what I'm going to explain is not an automated function. It will require some manual interaction.
 +
 +Of course, the webserver must have at least read access to the required rrd file(s). For sake of easiness, I'll assume the file to be located in cacti's default ./rra/ directory. In my examples, this file is called example.rrd.
 +
 +
 +==== Get rrdtool info ====
 +
 +First task is to get information about the **data sources** used in the rrd file. This is done using **rrdtool info <rrd file>**:
 +<code>rrdtool info ./rra/external.rrd
 +filename = "/var/www/html/cacti/rra/external.rrd"
 +rrd_version = "0003"
 +step = 300
 +last_update = 1140957748
 +ds[external_ds1].type = "GAUGE"
 +ds[external_ds1].minimal_heartbeat = 600
 +ds[external_ds1].min = 0.0000000000e+00
 +ds[external_ds1].max = 5.0000000000e+02
 +ds[external_ds1].last_ds = "UNKN"
 +ds[external_ds1].value = 4.4510209500e+02
 +ds[external_ds1].unknown_sec = 0
 +ds[external_ds2].type = "GAUGE"
 +ds[external_ds2].minimal_heartbeat = 600
 +ds[external_ds2].min = 0.0000000000e+00
 +ds[external_ds2].max = 5.0000000000e+02
 +ds[external_ds2].last_ds = "UNKN"
 +ds[external_ds2].value = 7.4183682500e+02
 +ds[external_ds2].unknown_sec = 0
 +ds[external_ds3].type = "GAUGE"
 +ds[external_ds3].minimal_heartbeat = 600
 +ds[external_ds3].min = 0.0000000000e+00
 +ds[external_ds3].max = 5.0000000000e+02
 +ds[external_ds3].last_ds = "UNKN"
 +ds[external_ds3].value = 1.0385715550e+03
 +ds[external_ds3].unknown_sec = 0
 +rra[0].cf = "AVERAGE"
 +rra[0].rows = 600
 +rra[0].pdp_per_row = 1
 +(... more to follow ...)</code>
 +From the **ds[.....]** statements, the names of the ds' are taken. In this case the **data sources** are named 
 +  * external_ds1,
 +  * external_ds2,
 +  * external_ds3
 +respectively. While this is not that a meaningful name, it should show you the principles when dealing with multi-ds rrds. Alongside with this, it is good to know the **ds[...].type**, **ds[...].min** and **ds[...].max** for correct definition of the data sources. In this case, all data sources are of type **GAUGE**. This will not affect data gathering nor graphing, but to me it seems to be advantageous to create the **correct** data sources.
 +All other paramaters (**step, heartbeat, xff, rra[..].rows**) are assumed to be standard settings.
 +
 +
 +==== Create the Data Template ====
 +
 +The Data Template will tell cacti, how the data is stored within the rrd file. This is the way to tell cacti about all **data sources** and their properties. The purpose is twofold:
 +  * tell cacti, how to create the correct rrd file with all parameters
 +  * store the name of the data sources for later use with Graph Templates
 +
 +While the first goal is not needed in this context, the second one is crucial. So lets define a new **Data Template**. Goto Data Templates and **Add** a new one:
 +
 +{{:manual:088:dt-01.preview_0.png|dt-01}}
 +
 +Fill in the usual header data:
 +
 +{{:manual:088:dt-02.preview_0.png|dt-02}}
 +
 +If you want to associate this to a certain host, you may use **|host_description|** as a placeholder as usual. As this external.rrd file is updated externally, you **must** set the **Data Input Method** to **None**.
 +Select the **Associated RRA's** as they will define the Detailed Graph Views (usually Daily, Weekly, Monthly, Yearly). And you'll have to **uncheck** the **Data Source Active** checkbox. This will prevent cacti from actually gathering data for this Data Template. Now add the first **Data Source**:
 +
 +{{:manual:088:dt-03.preview_0.png|dt-03}}
 +
 +|**Internal Data Source Name**|You **must** use the existing data source name of the rrd as retrieved in Chapter I. In this example, use **external_ds1**.|
 +|**Minimum Value**|Fill in the **ds[...].min** value from rrdtool info above. In this case, use 0. This is not really needed, but for sake of consistency I recommend this.|
 +|**Maximum Value**|Fill in the **ds[...].max** value from rrdtool info above. In this case, use 500. This is not really needed, but for sake of consistency I recommend this.|
 +|**Data Source Type**|Fill in the **ds[...].type** value from rrdtool info above. In this case, use GAUGE. This is not really needed, but for sake of consistency I recommend this.|
 +|**Heartbeat**|Fill in the **ds[...].minimal_heartbeat** value from rrdtool info above. In this case, use 600. This is not really needed, but for sake of consistency I recommend this.|
 +
 +Now **Create** to see:
 +
 +{{:manual:088:dt-04.preview_0.png|dt-04}}
 +
 +Repeat this for **all** other data sources of the example.rrd (use the **New** function of Data Source Items):
 +
 +{{:manual:088:dt-05.preview_0.png|dt-05}}
 +
 +You will have noticed, that no **Custom Data** is given as defined by the **Data Input Method** set to NONE. You'll see the result as:
 +
 +{{:manual:088:dt-06.preview.png|dt-06}}
 +
 +That's it.
 +==== Create the Graph Template ====
 +
 +The Graph template will tell cacti, what **Data Sources** should be shown on the Graph. This is very straightforward; simply use the **Data Sources** as defined in Chapter II and use all the Graph magic cacti provides. So **Add** a new Graph Template
 +
 +{{:manual:088:gt-01.preview_0.png|gt-01}}
 +
 +and fill in the usual header data:
 +
 +{{:manual:088:gt-02.preview_0.png|gt-02}}
 +
 +Now add the first **Graph Item**:
 +
 +{{:manual:088:gt-03.preview_0.png|gt-03}}
 +
 +and fill in the usual Data:
 +
 +{{:manual:088:gt-04.preview_0.png|gt-04}}
 +
 +Use the **Legend** Option as a time saver:
 +
 +{{:manual:088:gt-05.preview_0.png|gt-05}}
 +
 +And add all other Graph Items like that:
 +
 +{{:manual:088:gt-06.preview_0.png|gt-06}}
 +
 +{{:manual:088:gt-07.preview.png|gt-07}}
 +
 +to end up in
 +
 +{{:manual:088:gt-08.preview.png|gt-08}}
 +
 +Of course you will use more meaningful input for **Text Format**. That's all for now.
 +
 +
 +==== Prepare the Host ====
 +
 +Now its time for the Host to be prepared. You have the choice between two different approaches
 +  * the Host already exists (perhaps you're polling some other data from this host) and the status is **up**   
 +  * the Host does not yet exist in cacti's tables and shall never been polled for other data by cacti's own poller
 +
 +The first approach does not need any additional changes to the Devices list.
 +The second approch will be more common. You will need a Host entry in the **Devices** list even for this host. So we will create kind of a **dummy** entry. Please goto the **Devices** list and **Add** a new one:
 +
 +{{:manual:088:ho-01.preview.png|ho-01}}
 +
 +Fill in **Description** and **Name** as usual. To deactivate all checks, please check **Disable Host** and leave **SNMP Community** empty.
 +
 +{{:manual:088:ho-02.preview.png|ho-02}}
 +
 +**Create**
 +
 +{{:manual:088:ho-03.preview.png|ho-03}}
 +
 +Please proceed to the next chapter now.
 +
 +
 +==== Creating the Data Sources ====
 +
 +Usually, you would create the **Data Sources** and **Graphs** automagically using **Create Graphs for this Host**. But using this approach, cacti would enumerate and generate the needed rrd file(s) on its own. That's not wanted now.
 +Our task is: make cacti generate all **Data Sources** stuff but accept **our** external.rrd file name. This is accomplished by adding the Data Sources manually from the **Data Sources** list. In this case, there's no difference whether you're going to use an already existing host or the kind of host we generated in the previous chapter.
 +
 +{{:manual:088:ds-01.preview_0.png|ds-01}}
 +
 +Now select the **Data Template** from above:
 +
 +{{:manual:088:ds-02.preview.png|ds-02}}
 +
 +and **Create**. You will be prompted to fill in the **full path to your external.rrd file**. If this resides in cacti's default ./rra directory, you may use **<path_rra>** for this. **Remember, that the web server must have at least read access to that file.**:
 +
 +{{:manual:088:ds-03.preview.png|ds-03}}
 +
 +The result is shown in the next image
 +
 +{{:manual:088:ds-04.preview.png|ds-04}}
 +
 +
 +==== Create the new Graph ====
 +
 +Let's create a new **Graph** from **Graph Management** now.
 +
 +{{:manual:088:gm-01.preview_0.png|gm-01}}
 +
 +Select the **Selected Graph Template** defined previously:
 +
 +{{:manual:088:gm-02.preview.png|gm-02}}
 +
 +and **Create**. Now select all needed **Data Source [...]** and **Save**:
 +
 +{{:manual:088:gm-03.preview.png|gm-03}}
 +
 +The result is shown like:
 +
 +{{:manual:088:gm-04.png|gm-04}}
 +
 +Please select this Graph again and **Turn on Graph Debug Mode** to see
 +
 +{{:manual:088:gm-05.preview.png|gm-05}}





Personal Tools