i wanted to make a threshold based on % of used disk space (i saw few suggestions about this but none of them worked for me). However, i was able to do it after little modifications of cacti and threshold plugin
I'm polling disk total capacity and present usage using standard template Host MIB - Available Disk Space (screen01)
Step 1: I created new CDEF (screen02)
cdef=CURRENT_DATA_SOURCE,100,*,VALUE_OF_HDD_TOTAL,/
To get 'VALUE_OF_HDD_TOTAL' please add one line to file include/config_arrays.php
Code: Select all
$custom_data_source_types = array(
"CURRENT_DATA_SOURCE" => "Current Graph Item Data Source",
"ALL_DATA_SOURCES_NODUPS" => "All Data Sources (Don't Include Duplicates)",
"ALL_DATA_SOURCES_DUPS" => "All Data Sources (Include Duplicates)",
"CURRENT_DS_MINIMUM_VALUE" => "Current Data Source Item: Minimum Value",
"SIMILAR_DATA_SOURCES_NODUPS" => "All Similar Data Sources (Don't Include Duplicates)",
"CURRENT_DS_MAXIMUM_VALUE" => "Current Data Source Item: Maximum Value",
"CURRENT_GRAPH_MINIMUM_VALUE" => "Graph: Lower Limit",
"CURRENT_GRAPH_MAXIMUM_VALUE" => "Graph: Upper Limit",
"VALUE_OF_HDD_TOTAL" => "Value of hdd_total data source");
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add this line
Code: Select all
switch ($cdef['value']) {
case 'CURRENT_DATA_SOURCE':
$cdef['value'] = $oldvalue; // get_current_value($rra, $ds, 0);
break;
case 'VALUE_OF_HDD_TOTAL':
$cdef['value'] = get_current_value($rra, 'hdd_total', 0);
break;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ add 3 last lines
Step 3: After that, i created threshold template for data field "hdd_used " (screen03)
Step 4: At the bottom, select CDEF you created in step 1 ("Threshold CDEF Apply this CDEF before returning the data"). Save and wait 2 polling cycles. After that you should see current value in %! (screen04)
Forgive me my poor english.