monitoringplugin: Added seconds_to_hms() method.
This method converts seconds to H:MM:SS representation (as a string).
This commit is contained in:
parent
2904249055
commit
264b0f5f21
|
@ -287,6 +287,15 @@ class MonitoringPlugin(object):
|
|||
return value
|
||||
|
||||
|
||||
def seconds_to_hms(self, seconds):
|
||||
seconds = int(seconds)
|
||||
hours = int(seconds / 3600)
|
||||
seconds -= (hours * 3600)
|
||||
minutes = seconds / 60
|
||||
seconds -= (minutes * 60)
|
||||
return '%i:%02i:%02i' % (hours, minutes, seconds)
|
||||
|
||||
|
||||
def human_to_number(self, value, total=None):
|
||||
if total:
|
||||
if not self.is_float(total):
|
||||
|
|
Loading…
Reference in a new issue