[Reconnoiter-devel] [reconnoiter commit] r1250 - trunk/src/modules-lua/noit/module

svn-commit at lists.omniti.com svn-commit at lists.omniti.com
Wed Mar 24 14:44:53 EDT 2010


Author: jesus
Date: 2010-03-24 14:44:53 -0400 (Wed, 24 Mar 2010)
New Revision: 1250

Modified:
   trunk/src/modules-lua/noit/module/resmon.lua
Log:
omit state and duration if they are not present

Modified: trunk/src/modules-lua/noit/module/resmon.lua
===================================================================
--- trunk/src/modules-lua/noit/module/resmon.lua	2010-03-17 16:03:38 UTC (rev 1249)
+++ trunk/src/modules-lua/noit/module/resmon.lua	2010-03-24 18:44:53 UTC (rev 1250)
@@ -147,10 +147,14 @@
         local obj
         obj = (doc:xpath("last_runtime_seconds", result))()
         local ds = tonumber(obj and obj:contents())
-        if ds ~= nil then ds = math.floor(ds * 1000) end
-        check.metric_uint32(prefix .. "duration", ds)
+        if ds ~= nil then
+            ds = math.floor(ds * 1000)
+            check.metric_uint32(prefix .. "duration", ds)
+        end
         obj = (doc:xpath("state", result))()
-        check.metric_string(prefix .. "state", obj and obj:contents())
+        if obj ~= nil then
+            check.metric_string(prefix .. "state", obj and obj:contents())
+        end
 	local metrics = 0
         for metric in doc:xpath("metric", result) do
             metrics = metrics + 1



More information about the Reconnoiter-devel mailing list