mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
[FIX] wfsolr_indexSize: always output values in the same unit (MB)
This commit is contained in:
parent
94c75daa81
commit
5c77c1a93b
1 changed files with 19 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue