소스 검색

monitoringplugin: Add seconds_to_timedelta()

Signed-off-by: Sven Velt <sven@velt.de>
Sven Velt 13 년 전
부모
커밋
1a7b38f6f6
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      monitoringplugin.py

+ 6 - 2
monitoringplugin.py

@@ -22,10 +22,10 @@
 # along with this file. If not, see <http://www.gnu.org/licenses/>. #
 #####################################################################
 
-__version__ = '0.0.100802'
+__version__ = '0.0.110715'
 __all__ = ['MonitoringPlugin', 'SNMPMonitoringPlugin']
 
-import optparse, os, re, sys
+import datetime, optparse, os, re, sys
 
 try:
 	import netsnmp
@@ -296,6 +296,10 @@ class MonitoringPlugin(object):
 		return '%i:%02i:%02i' % (hours, minutes, seconds)
 
 
+	def seconds_to_timedelta(self, seconds):
+		return datetime.timedelta(seconds=long(seconds))
+
+
 	def human_to_number(self, value, total=None):
 		if total:
 			if not self.is_float(total):