[icinga-checkins] icinga.org: icinga-web/r1.7: Duration missing in unhandled service problems

git at icinga.org git at icinga.org
Mon Jun 18 13:30:21 CEST 2012


Module: icinga-web
Branch: r1.7
Commit: a051b615b73e976c250cf4494b9f4371f44d9f9a
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=a051b615b73e976c250cf4494b9f4371f44d9f9a

Author: Marius Hein <marius.hein at netways.de>
Date:   Wed May 16 16:52:55 2012 +0200

Duration missing in unhandled service problems

Added fields and joins to view

---

 app/modules/Api/config/views/service.xml           |    2 ++
 .../xml/grid/icinga-unhandled-service-problems.xml |   16 +++++++++-------
 .../Cronks/lib/js/grid/renderer/ColumnRenderer.js  |    2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/app/modules/Api/config/views/service.xml b/app/modules/Api/config/views/service.xml
index 1a71426..a090193 100644
--- a/app/modules/Api/config/views/service.xml
+++ b/app/modules/Api/config/views/service.xml
@@ -133,6 +133,7 @@
                 os.name2 AS SERVICE_NAME,
                 s.display_name AS SERVICE_DISPLAY_NAME,
                 ss.current_state AS SERVICE_CURRENT_STATE,
+                GREATEST(ss.last_state_change,ps.program_start_time) AS DURATION_START,
                 ss.process_performance_data AS SERVICE_PROCESS_PERFORMANCE_DATA,
                 ss.last_check AS SERVICE_LAST_CHECK,
                 ss.next_check AS SERVICE_NEXT_CHECK,
@@ -152,6 +153,7 @@
             INNER JOIN s.host h
             INNER JOIN h.object oh
             INNER JOIN s.object os
+            INNER JOIN i.programstatus as ps
             WHERE
                 s.config_type = '${retained_flag}' AND
                 ss.scheduled_downtime_depth = 0 AND
diff --git a/app/modules/Cronks/data/xml/grid/icinga-unhandled-service-problems.xml b/app/modules/Cronks/data/xml/grid/icinga-unhandled-service-problems.xml
index b181f6e..0fb5fde 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-unhandled-service-problems.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-unhandled-service-problems.xml
@@ -879,18 +879,20 @@
         </field>
 
         <field name="service_duration">
-            <datasource>
-                <parameter name="field">SERVICE_LAST_STATE_CHANGE</parameter>
+               <datasource>
+                <parameter name="field">COALESCE(ss.last_state_change,ps.program_start_time)</parameter>
             </datasource>
 
             <display>
                 <parameter name="visible">true</parameter>
                 <parameter name="label">Duration</parameter>
-
-                <!-- Let the agavi translation manager transform the date -->
-                <parameter name="userFunc">
-                    <parameter name="model">Cronks.ColumnDisplay.Format</parameter>
-                    <parameter name="method">durationString</parameter>
+                <parameter name="jsFunc">
+                    <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
+                    <parameter name="function">durationField</parameter>
+                    <parameter name="type">renderer</parameter>
+                    <parameter name="arguments">
+                        <parameter name="type">service</parameter>
+                    </parameter>
                 </parameter>
             </display>
 
diff --git a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
index 710d2f0..a4cd3f1 100755
--- a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
@@ -304,7 +304,7 @@ Ext.ns('Cronk.grid');
 
             durationField: function(cfg) {
                 return function (value, metaData, record, rowIndex, colIndex, store) {
-                    
+                    AppKit.log(record.json)
                     return AppKit.util.Date.toDurationString(
                         record.json.DURATION_START
                     );





More information about the icinga-checkins mailing list