diff --git a/plugins/solr/wfsolr_ b/plugins/solr/wfsolr_ index 1473979b..01408f39 100755 --- a/plugins/solr/wfsolr_ +++ b/plugins/solr/wfsolr_ @@ -104,6 +104,24 @@ function getSolrAdminUrl($core = null) return $url; } +/** + * Assure some conversions. KB and GB converted to MB + */ +function wffloatval($val) +{ + $fVal = floatval(str_replace(",", ".", $val)); + $valEnd = substr($val, -2); + if ($valEnd == "KB") + { + $fVal = $fVal / 1024; + } + elseif ($valEnd == "GB") + { + $fVal = $fVal * 1024; + } + return $fVal; +} + if ("config" == $action) { echo 'graph_category Solr ' . $core . "\n"; @@ -171,7 +189,7 @@ else { if($property == trim($stat->getAttribute('name'))) { - echo $core . $item . $property . 'solr.value ' . floatval(trim($stat->textContent)) . "\n"; + echo $core . $item . $property . 'solr.value ' . wffloatval(trim($stat->textContent)) . "\n"; exit(0); } }