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()
|
||||
{
|
||||
return $this->val;
|
||||
|
|
|
@ -30,7 +30,7 @@ class PerfdataSet
|
|||
|
||||
public function getAll()
|
||||
{
|
||||
return $this->perfdata;
|
||||
return $this->perfdata === null ? array() : $this->perfdata;
|
||||
}
|
||||
|
||||
protected function readLabel()
|
||||
|
|
Loading…
Reference in New Issue