mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
Small perfdata improvements
This commit is contained in:
parent
5d3fbd1cdf
commit
3ac869981a
@ -36,6 +36,22 @@ class Perfdata
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasMax()
|
||||||
|
{
|
||||||
|
return $this->max !== null && $this->max > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPercentage()
|
||||||
|
{
|
||||||
|
if ($this->unit === self::PERCENT) {
|
||||||
|
return $this->val;
|
||||||
|
}
|
||||||
|
if ($this->hasMax()) {
|
||||||
|
return $this->val / $this->max * 100;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function getValue()
|
public function getValue()
|
||||||
{
|
{
|
||||||
return $this->val;
|
return $this->val;
|
||||||
|
@ -30,7 +30,7 @@ class PerfdataSet
|
|||||||
|
|
||||||
public function getAll()
|
public function getAll()
|
||||||
{
|
{
|
||||||
return $this->perfdata;
|
return $this->perfdata === null ? array() : $this->perfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function readLabel()
|
protected function readLabel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user