<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<template>
    <type>DQL</type>
    <!-- 
        Meta description of the templates, that anybody
        knows what the template is doing
    -->
    <meta>
        <parameter name="name">All Icinga host problems</parameter>
        <parameter name="description">Displays problem hosts</parameter>
        <parameter name="author">icinga-web developers</parameter>
    </meta>
    
    <!-- 
        Options for the template. Change layout and view style to fit the type you
        want to display
    -->
    <option>
        <parameter name="mode">default</parameter>
        <parameter name="layout">CronkGridTemplateAjaxGridLayout</parameter> 


        
        <parameter name="gridEvents">
            
            <!-- Initialize comments -->
            <parameter>
                <parameter name="type">viewready</parameter>
                <parameter name="function">Cronk.grid.CommentColumnRenderer.init</parameter>
                <parameter name="arguments">
                    <parameter name="column_name">comments</parameter>
                    <!-- <parameter name="class">icinga-icon-comment icon-24 icinga-link icinga-notext</parameter> -->
                    <parameter name="title">Comments for {service_name}</parameter>
                </parameter>
            </parameter>
            
            <!-- Initialize info icons lazy -->
            <parameter>
                <parameter name="type">viewready</parameter>
                <parameter name="namespace">Cronk.grid.InfoIconColumnRenderer</parameter>
                <parameter name="function">init</parameter>

                <parameter name="arguments">
                    <parameter name="column_name">service_info_icons</parameter>
                </parameter>
            </parameter>
            
        </parameter>
        
        <parameter name="rowEvents">
            <parameter>
                <parameter name="title">Icinga</parameter>
                <parameter name="menuid">icinga</parameter>
                <parameter name="items">
                    
                    <!-- Host information -->
                    <parameter>
                        <parameter name="target">sub</parameter>

                        <parameter name="handler">
                            <parameter name="click">Cronk.grid.handler.Info.host</parameter>
                        </parameter>

                        <parameter name="handlerArguments">
                            <parameter name="objectid_field">host_object_id</parameter>
                        </parameter>

                        <parameter name="model"></parameter>

                        <parameter name="xtype">grideventbutton</parameter>
                        <parameter name="menuid">detail_info_host</parameter>
                        <parameter name="iconCls">icinga-icon-hostdetail</parameter>
                        <parameter name="tooltip">Detailed information</parameter>
                        <parameter name="text">Details</parameter>
                    </parameter>
                    
                    <!-- Show hosts for services -->
                    <parameter>
                        <parameter name="target">sub</parameter>

                        <parameter name="handler">
                            <parameter name="click">Cronk.grid.handler.Grid.openTemplateGrid</parameter>
                        </parameter>

                        <parameter name="handlerArguments">
                            <parameter name="template">icinga-service-template</parameter>
                            <parameter name="labelField">host_name</parameter>
                            <parameter name="idPrefix">services_subgrid_host</parameter>
                            <parameter name="titlePrefix">Services for</parameter>
                            <parameter name="filterMap">
                                <parameter name="host_object_id">host_object_id</parameter>
                            </parameter>
                        </parameter>

                        <parameter name="model"></parameter>

                        <parameter name="xtype">grideventbutton</parameter>
                        <parameter name="menuid">services_for_host</parameter>
                        <parameter name="iconCls">icinga-icon-service</parameter>
                        <parameter name="tooltip">Show services</parameter>
                        <parameter name="text">Services</parameter>
                    </parameter>
                    
                    <!-- Host history for that host -->
                    <parameter>
                        <parameter name="target">sub</parameter>

                        <parameter name="handler">
                            <parameter name="click">Cronk.grid.handler.Grid.openTemplateGrid</parameter>
                        </parameter>

                        <parameter name="handlerArguments">
                            <parameter name="template">icinga-host-history-template</parameter>
                            <parameter name="labelField">host_name</parameter>
                            <parameter name="idPrefix">hosthistory_subgrid_host</parameter>
                            <parameter name="titlePrefix">History for</parameter>
                            <parameter name="filterMap">
                                <parameter name="host_object_id">host_object_id</parameter>
                            </parameter>
                        </parameter>

                        <parameter name="model"></parameter>

                        <parameter name="xtype">grideventbutton</parameter>
                        <parameter name="menuid">host_history_for_host</parameter>
                        <parameter name="iconCls">icinga-icon-book</parameter>
                        <parameter name="tooltip">Show history</parameter>
                        <parameter name="text">History</parameter>
                    </parameter>
                    
                    <!-- Statusmap goto button -->
                    <parameter>
                        <parameter name="target">sub</parameter>

                        <parameter name="handler">
                            <parameter name="click">Cronk.grid.handler.Statusmap.show</parameter>
                        </parameter>

                        <parameter name="handlerArguments">
                            <parameter name="hostname_field">host_name</parameter>
                            <parameter name="hostobjectid_field">host_object_id</parameter>
                        </parameter>

                        <parameter name="model"></parameter>

                        <parameter name="xtype">grideventbutton</parameter>
                        <parameter name="menuid">host_statusmap_position</parameter>
                        <parameter name="iconCls">icinga-icon-folder-tree</parameter>
                        <parameter name="tooltip">Locate in statusmap</parameter>
                        <parameter name="text">Statusmap</parameter>
                    </parameter>
                </parameter>
            </parameter>
        </parameter>
        
        <!-- 
            Selection model of rows (checkbox/row). This is needed for
            commands and maybe other user things ...
        -->
        <parameter name="selection_model">checkbox</parameter>
        <parameter name="commands">
            <!-- 
                Generally enabled od disabled
            -->
            <parameter name="enabled">true</parameter>
        
            <!--
                Sourcefieldmapping
                * Which field content comes from the template data source
            -->
            <parameter name="source">
                <parameter name="IcingaApiConstants::COMMAND_HOST">host_name</parameter>
                <parameter name="IcingaApiConstants::COMMAND_INSTANCE">instance_name</parameter>
            </parameter>
            
            <parameter name="predefined">
                <parameter name="IcingaApiConstants::COMMAND_AUTHOR">${xmlfn.author}</parameter>
            <parameter name="IcingaApiConstants::COMMAND_ENDTIME">now+7200</parameter>
                    <parameter name="IcingaApiConstants::COMMAND_FIXED">1</parameter>
            </parameter>
            
            <!-- 
                Which commands are available in this template and can charged
                with template data
            -->
            <parameter name="items">
                <parameter name="PROCESS_HOST_CHECK_RESULT">
                    <parameter name="title">Process host check result</parameter>
                    <parameter name="icon_class">icinga-icon-cog</parameter>
                </parameter>
                <parameter name="ACKNOWLEDGE_HOST_PROBLEM">
                    <parameter name="title">Acknowledge host problem</parameter>
                    <parameter name="icon_class">icinga-icon-exclamation-white</parameter>
                </parameter>
                <parameter name="ACKNOWLEDGE_HOST_PROBLEM_EXPIRE">
                    <parameter name="title">Acknowledge host problem with expiration time</parameter>
                    <parameter name="icon_class">icinga-icon-exclamation-clock</parameter>
                </parameter>
                <parameter name="REMOVE_HOST_ACKNOWLEDGEMENT">
                    <parameter name="title">Remove host acknowledgement</parameter>
                    <parameter name="icon_class">icinga-icon-exclamation-red</parameter>
                </parameter>
                <parameter name="SCHEDULE_HOST_DOWNTIME">
                    <parameter name="title">Schedule a host downtime</parameter>
                    <parameter name="icon_class">icinga-icon-downtime</parameter>
                </parameter>
                <parameter name="SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME">
                    <parameter name="title">Schedule a host downtime (with childs, triggered)</parameter>
                    <parameter name="icon_class">icinga-icon-downtime</parameter>
                </parameter>
                <parameter name="SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME">
                    <parameter name="title">Schedule a host downtime (with childs)</parameter>
                    <parameter name="icon_class">icinga-icon-downtime</parameter>
                </parameter>
                <parameter name="SCHEDULE_HOST_SVC_DOWNTIME">
                    <parameter name="title">Schedule a downtime for this host and its services</parameter>
                    <parameter name="icon_class">icinga-icon-downtime</parameter>
                </parameter>
                <parameter name="ADD_HOST_COMMENT">
                    <parameter name="title">Add a host comment</parameter>
                    <parameter name="icon_class">icinga-icon-comment</parameter>
                </parameter>
                <parameter name="DEL_ALL_HOST_COMMENTS">
                    <parameter name="title">Delete all host comments</parameter>
                    <parameter name="icon_class">icinga-icon-delete</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="SCHEDULE_HOST_CHECK">
                    <parameter name="title">Schedule next host check</parameter>
                    <parameter name="icon_class">icinga-icon-cog</parameter>
                </parameter>
                <parameter name="SCHEDULE_FORCED_HOST_CHECK">
                    <parameter name="title">Schedule next forced host check</parameter>
                    <parameter name="icon_class">icinga-icon-cog</parameter>
                </parameter>
                <parameter name="SCHEDULE_FORCED_HOST_SVC_CHECKS">
                    <parameter name="title">Schedule a check of all services on this host</parameter>
                    <parameter name="icon_class">icinga-icon-cog</parameter>
                </parameter>
                <parameter name="SEND_CUSTOM_HOST_NOTIFICATION">
                    <parameter name="title">Send custom host notification</parameter>
                    <parameter name="icon_class">icinga-icon-notify</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_CHECK">
                    <parameter name="title">Enable active checks of this host</parameter>
                    <parameter name="icon_class">icinga-icon-arrow-out</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_CHECK">
                    <parameter name="title">Disable active checks of this host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_PASSIVE_HOST_CHECKS">
                    <parameter name="title">Start accepting passive checks for this host</parameter>
                    <parameter name="icon_class">icinga-icon-arrow-in</parameter>
                </parameter>
                <parameter name="DISABLE_PASSIVE_HOST_CHECKS">
                    <parameter name="title">Stop accepting passive checks for this host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="START_OBSESSING_OVER_HOST">
                    <parameter name="title">Start obsessing over host</parameter>
                    <parameter name="icon_class">icinga-icon-bricks</parameter>
                </parameter>
                <parameter name="STOP_OBSESSING_OVER_HOST">
                    <parameter name="title">Stop obsessing over host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_NOTIFICATIONS">
                    <parameter name="title">Enable notifications for this host</parameter>
                    <parameter name="icon_class">icinga-icon-notify</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_NOTIFICATIONS">
                    <parameter name="title">Disable notifications for this host</parameter>
                    <parameter name="icon_class">icinga-icon-notify-disabled</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_SVC_NOTIFICATIONS">
                    <parameter name="title">Enable notifications for all services on this host</parameter>
                    <parameter name="icon_class">icinga-icon-notify</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_SVC_NOTIFICATIONS">
                    <parameter name="title">Disable notifications for all services on this host</parameter>
                    <parameter name="icon_class">icinga-icon-notify-disabled</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_SVC_CHECKS">
                    <parameter name="title">Enable checks of all services on this host</parameter>
                    <parameter name="icon_class">icinga-icon-service</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_SVC_CHECKS">
                    <parameter name="title">Disable checks of all services on this host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_EVENT_HANDLER">
                    <parameter name="title">Enable event handler for this host</parameter>
                    <parameter name="icon_class">icinga-icon-bricks</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_EVENT_HANDLER">
                    <parameter name="title">Disable event handler for this host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                    <parameter name="seperator">true</parameter>
                </parameter>
                <parameter name="ENABLE_HOST_FLAP_DETECTION">
                    <parameter name="title">Enable flap detection for this host</parameter>
                    <parameter name="icon_class">icinga-icon-flapping</parameter>
                </parameter>
                <parameter name="DISABLE_HOST_FLAP_DETECTION">
                    <parameter name="title">Disable flap detection for this host</parameter>
                    <parameter name="icon_class">icinga-icon-cross</parameter>
                </parameter>
            </parameter>
            
        </parameter>
        
        <!-- 
            Additional filter
            * Keep in mind to map the names in datasource.additional_filter_fields
        -->
        <parameter name="filter">
            <paramter name="customvariable_name">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="label">CV Name</parameter>

                <!-- Operator type is needed because we don't know which type returned-->
                <parameter name="operator_type">text</parameter>

                <parameter name="api_target">customvariable</parameter>
                <parameter name="api_keyfield">CUSTOMVARIABLE_NAME</parameter>
                <parameter name="api_valuefield">CUSTOMVARIABLE_NAME</parameter>

            </paramter>
            <paramter name="customvariable_value">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="label">CV Val</parameter>

                <!-- Operator type is needed because we don't know which type returned-->
                <parameter name="operator_type">text</parameter>

                <parameter name="api_target">customvariable</parameter>
                <parameter name="api_keyfield">CUSTOMVARIABLE_VALUE</parameter>
                <parameter name="api_valuefield">CUSTOMVARIABLE_VALUE</parameter>
                
                <!-- Comma seperated list of additional select fields (e.g. distinct changes or tpl) -->
                <parameter name="api_additional">CUSTOMVARIABLE_NAME</parameter>

                <!-- If using the api_additional maybe api_exttpl should be defined too -->
                <parameter name="api_exttpl"><![CDATA[ {CUSTOMVARIABLE_NAME}: {CUSTOMVARIABLE_VALUE} ]]></parameter>

                <parameter name="api_id">CUSTOMVARIABLE_VALUE</parameter>
                
            </paramter>
            <paramter name="hostgroup_name">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="label">Hostgroup</parameter>

                <!-- Operator type is needed because we don't know which type returned-->
                <parameter name="operator_type">text</parameter>

                <parameter name="api_target">hostgroup</parameter>
                <parameter name="api_keyfield">HOSTGROUP_NAME</parameter>
                <parameter name="api_valuefield">HOSTGROUP_NAME</parameter>

            </paramter>
            <paramter name="notifications_enabled">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.bool</parameter>
                <parameter name="label">Notifications enabled</parameter>
            </paramter>
            <paramter name="problem_acknowledged">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.bool</parameter>
                <parameter name="label">Acknowledged</parameter>
            </paramter>
            <paramter name="scheduled_downtime_depth">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.bool</parameter>
                <parameter name="label">In downtime</parameter>
            </paramter>
            <paramter name="host_is_pending">
                <parameter name="enabled">true</parameter>
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.bool</parameter>
                <parameter name="label">Is pending</parameter>
            </paramter>
        </parameter>
      
    </option>
    
    <!-- 
        What data to display? Define icinga data targets and countfields
    -->
    <datasource>
        <parameter name="target">TARGET_HOST_PROBLEMS</parameter>
        <parameter name="countmode">field</parameter>
       
    </datasource>
    
    <!-- 
        Paging record on its result
    -->
    <pager>
        <parameter name="enabled">true</parameter>
        
        <parameter name="start">0</parameter>
    </pager>
    
    <fields>
        <field name="host_icon">
            <datasource>
                <parameter name="field">HOST_ICON_IMAGE</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Object image</parameter>
                <parameter name="icon">icinga-icon-image</parameter>
                <parameter name="width">25</parameter>
                <parameter name="Ext.grid.Column">
                    <parameter name="menuDisabled">true</parameter>
                    <parameter name="fixed">true</parameter>
                </parameter>
                <parameter name="jsFunc">
                    <parameter>
                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                        <parameter name="function">columnImage</parameter>

                        <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                        <parameter name="type">renderer</parameter>

                        <parameter name="arguments">
                            <parameter name="image">
                                <![CDATA[
                                    <tpl if="host_icon == ''" />
                                        images/icons/server.png
                                    </tpl>
                                    <tpl if="host_icon != ''" />
                                        images/icinga/{host_icon}
                                    </tpl>

                                ]]>
                            </parameter>
                        </parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>

        </field>
        <field name="instance_name">
            <datasource>
                <parameter name="field">INSTANCE_NAME</parameter>
            </datasource>

            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Instance</parameter>

                <parameter name="width">60</parameter>

                <parameter name="Ext.grid.Column">
                    <parameter name="fixed">false</parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>

                <!-- Operator type is needed because we don't know which type returned-->
                <parameter name="operator_type">text</parameter>

                <parameter name="api_target">instance</parameter>
                <parameter name="api_keyfield">INSTANCE_NAME</parameter>
                <parameter name="api_valuefield">INSTANCE_NAME</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>

        <field name="host_object_id">
            <datasource>
                <parameter name="field">HOST_OBJECT_ID</parameter>
            </datasource>

            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Id</parameter>
            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.number</parameter>

                <parameter name="no_operator">false</parameter>

                <parameter name="field">HOST_OBJECT_ID</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">true</parameter>
            </order>
        </field>


        <field name="host_name">
            <datasource>
                <parameter name="field">HOST_NAME</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Host</parameter>
                <parameter name="width">150</parameter>

                <parameter name="jsFunc">

                    <parameter>
                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                        <parameter name="function">columnElement</parameter>

                        <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                        <parameter name="type">renderer</parameter>

                        <parameter name="arguments">
                            <parameter name="css">x-icinga-grid-link</parameter>

                            <parameter name="attr">
                                <parameter name="ext:qtip">Click to view covered services</parameter>
                            </parameter>

                        </parameter>
                    </parameter>

                    <parameter>
                        <parameter name="namespace">Cronk.grid.IcingaColumnRenderer</parameter>
                        <parameter name="function">subGrid</parameter>

                        <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                        <parameter name="type">cellclick</parameter>

                        <parameter name="arguments">
                            <parameter name="idPrefix">servicesForHost</parameter>
                            <parameter name="titlePrefix">Services for</parameter>
                            <parameter name="targetTemplate">icinga-service-template</parameter>
                            <parameter name="filterMap">
                                <parameter name="host_object_id">host_object_id</parameter>
                            </parameter>
                            <parameter name="labelField">host_name</parameter>
                        </parameter>
                    </parameter>

                </parameter>

            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="operator_type">text</parameter>
                <parameter name="api_target">host</parameter>
                <parameter name="api_keyfield">HOST_NAME</parameter>
                <parameter name="api_valuefield">HOST_NAME</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">true</parameter>
                <parameter name="direction">ASC</parameter>

                <!--  <parameter name="field">A_NEW_FIELD_TO_SORT</parameter> -->
            </order>
        </field>

        <field name="host_alias">
            <datasource>
                <parameter name="field">HOST_ALIAS</parameter>
            </datasource>

            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Alias</parameter>

            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="operator_type">text</parameter>
                <parameter name="api_target">host</parameter>
                <parameter name="api_keyfield">HOST_ALIAS</parameter>
                <parameter name="api_valuefield">HOST_ALIAS</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
                <parameter name="direction">ASC</parameter>
            </order>
        </field>

        <field name="host_display_name">
            <datasource>
                <parameter name="field">HOST_DISPLAY_NAME</parameter>
            </datasource>

            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Display name</parameter>

            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.api</parameter>
                <parameter name="operator_type">text</parameter>
                <parameter name="api_target">host</parameter>
                <parameter name="api_keyfield">HOST_DISPLAY_NAME</parameter>
                <parameter name="api_valuefield">HOST_DISPLAY_NAME</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
                <parameter name="direction">ASC</parameter>
            </order>
        </field>



<!--    Example for adding a iframe cronk that creates an url depending on db-variables
        <field name="eventDB_link">
            <datasource>
                <parameter name="field">HOST_NAME</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label"></parameter>

                <parameter name="width">22</parameter>


                <parameter name="Ext.grid.Column">
                    <parameter name="menuDisabled">true</parameter>
                    <parameter name="fixed">true</parameter>
                </parameter>

                <parameter name="jsFunc">
                    <parameter>
                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                        <parameter name="function">columnImage</parameter>

                         renderer/gridevent[cellclick|celldblclick|...]
                        <parameter name="type">renderer</parameter>

                        <parameter name="arguments">
                            <parameter name="image">images/icons/table.png</parameter>
                            <parameter name="css">x-icinga-grid-link</parameter>
                            <parameter name="attr">
                                <parameter name="ext:qtip">Go to Event DB</parameter>
                            </parameter>
                        </parameter>
                    </parameter>

                    <parameter>
                        <parameter name="namespace">Cronk.grid.IcingaColumnRenderer</parameter>
                        <parameter name="function">iFrameCronk</parameter>

                         renderer/gridevent[cellclick|celldblclick|...]
                        <parameter name="type">cellclick</parameter>

                        <parameter name="arguments">
                            <parameter name="title">EventDB for {host_name}</parameter>
                            <parameter name="url"><![CDATA[http://localhost/{host_name}/{host_object_id}]]></parameter>
                            <parameter name="activateOnClick">true</parameter>
                        </parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
            </order>
        </field>
        END EXAMPLE -->

        <!--  Example to include images on the fly
        <field name="image_hover">
            <datasource>
                <parameter name="field">HOST_NAME</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label"></parameter>

                <parameter name="width">22</parameter>


                <parameter name="Ext.grid.Column">
                    <parameter name="menuDisabled">true</parameter>
                    <parameter name="fixed">true</parameter>
                </parameter>

                <parameter name="jsFunc">
                    <parameter>
                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                        <parameter name="function">columnImage</parameter>

                         renderer/gridevent[cellclick|celldblclick|...]
                        <parameter name="type">renderer</parameter>

                        <parameter name="arguments">
                            <parameter name="image">images/icons/image.png</parameter>
                            <parameter name="css">x-icinga-grid-link</parameter>
                            <parameter name="attr">
                                <parameter name="ext:qtip">Display performance graph</parameter>
                            </parameter>
                        </parameter>
                    </parameter>

                    <parameter>
                        <parameter name="namespace">Cronk.grid.IcingaColumnRenderer</parameter>
                        <parameter name="function">imagePopup</parameter>

                         renderer/gridevent[cellclick|celldblclick|...]
                        <parameter name="type">cellclick</parameter>

                        <parameter name="arguments">
                            <parameter name="title">Image for {host_name}</parameter>
                            <parameter name="url"><![CDATA[http://localhost/pnp4nagios/image?host={host_name}&srv=_HOST_&view=0]]></parameter>
                            <parameter name="width">200</parameter>
                            <parameter name="height">200</parameter>
                        </parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
            </order>
        </field>
        END EXAMPLE -->

        <field name="comments">
            <datasource>
                <parameter name="field">HOST_OBJECT_ID</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Comments</parameter>
                <parameter name="icon">icinga-icon-comment</parameter>

                <parameter name="width">22</parameter>

                <!-- Config for the AJAX grid (see http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.Column) -->
                <parameter name="Ext.grid.Column">
                    <parameter name="menuDisabled">true</parameter>
                    <parameter name="fixed">true</parameter>
                </parameter>


                <parameter name="jsFunc">
                    <parameter>
                        <parameter name="namespace">Cronk.grid.CommentColumnRenderer</parameter>
                        <parameter name="function">commentColumn</parameter>

                        <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                        <parameter name="type">renderer</parameter>
                        <parameter name="arguments">
                            <parameter name="target">host</parameter>
                            <parameter name="target_field">host_object_id</parameter>
                        </parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
            </order>
        </field>

        <field name="host_state_type">
            <datasource>
                <parameter name="field">HOST_STATE_TYPE</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">State Type</parameter>
                <parameter name="width">60</parameter>
                <parameter name="Ext.grid.Column">
                    <parameter name="fixed">true</parameter>
                </parameter>
                <parameter name="jsFunc">
                    <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                    <parameter name="function">stateType</parameter>

                    <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                    <parameter name="type">renderer</parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.statetype</parameter>
                <parameter name="no_operator">false</parameter>
                <parameter name="field">host_state_type</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
            </order>
        </field>

        <field name="host_status">
            <datasource>
                <parameter name="field">HOST_CURRENT_STATE</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Status</parameter>
                <parameter name="width">100</parameter>

                <!-- Config for the AJAX grid (see http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.Column) -->
                <parameter name="Ext.grid.Column">
                    <parameter name="fixed">true</parameter>
                </parameter>

                <parameter name="jsFunc">
                    <parameter name="namespace">Cronk.grid.AdvancedHostStatusColumnRenderer</parameter>
                    <parameter name="function">hostStatus</parameter>

                    <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                    <parameter name="type">renderer</parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.hoststatus</parameter>

                <parameter name="no_operator">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>

        <field name="host_last_check">
            <datasource>
                <parameter name="field">HOST_LAST_CHECK</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Last check</parameter>
                <parameter name="width">120</parameter>

                <!-- Let the agavi translation manager transform the date -->
                <parameter name="userFunc">
                    <parameter name="model">Cronks.ColumnDisplay.Format</parameter>
                    <parameter name="method">agaviDateFormat</parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">true</parameter>
                <parameter name="order">DESC</parameter>
            </order>
        </field>

        <field name="host_duration">
            <datasource>
                <parameter name="field"><![CDATA[(CASE WHEN hs.last_state_change<='1970-01-01 00:00:00' THEN ps.program_start_time ELSE hs.last_state_change END)]]></parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Duration</parameter>
                <parameter name="width">110</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">host</parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
                <parameter name="order">DESC</parameter>
            </order>
        </field>

        <field name="host_info_icons">

            <datasource>
                <parameter name="field">HOST_OBJECT_ID</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Info</parameter>

                <parameter name="width">50</parameter>

                <parameter name="Ext.grid.Column">
                    <parameter name="menuDisabled">true</parameter>
                </parameter>

                <parameter name="jsFunc">
                    <parameter name="namespace">Cronk.grid.InfoIconColumnRenderer</parameter>
                    <parameter name="function">infoColumn</parameter>
                    <parameter name="type">renderer</parameter>
                    <parameter name="arguments">
                        <!-- 1==Host 2==Service -->
                        <parameter name="type">1</parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>

        </field>


        <field name="plugin_output">
            <datasource>
                <parameter name="field">HOST_OUTPUT</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Output</parameter>
                <parameter name="width">250</parameter>

                <parameter name="jsFunc">
                    <parameter>
                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
                        <parameter name="function">customColumnPerfdataSanitized</parameter>
                    </parameter>
                </parameter>

            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>

        <field name="check_attempt">
            <datasource>
                <parameter name="field">HOST_CURRENT_CHECK_ATTEMPT</parameter>
            </datasource>

            <display>
                <parameter name="visible">true</parameter>
                <parameter name="label">Attempt</parameter>
                <parameter name="width">60</parameter>

                <parameter name="userFunc">
                    <parameter name="model">Cronks.ColumnDisplay.Format</parameter>
                    <parameter name="method">formatTemplate</parameter>
                    <parameter name="arguments">
                        <parameter name="format"><![CDATA[${field.check_attempt} / ${field.max_attempt}]]></parameter>
                    </parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>
        <field name="max_attempt">
            <datasource>
                <parameter name="field">HOST_MAX_CHECK_ATTEMPT</parameter>
            </datasource>
            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Max attempt</parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>
        <field name="host_hard_status">
            <datasource>
                <parameter name="field">HOST_HARD_STATE</parameter>
            </datasource>

            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label">Hard state</parameter>
                <parameter name="width">100</parameter>

                <!-- Config for the AJAX grid (see http://www.extjs.com/deploy/dev/docs/?class=Ext.grid.Column) -->
                <parameter name="Ext.grid.Column">
                    <parameter name="fixed">true</parameter>
                </parameter>

                <parameter name="jsFunc">
                    <parameter name="namespace">Cronk.grid.AdvancedHostStatusColumnRenderer</parameter>
                    <parameter name="function">hostStatus</parameter>

                    <!-- renderer/gridevent[cellclick|celldblclick|...] -->
                    <parameter name="type">renderer</parameter>
                </parameter>
            </display>

            <filter>
                <parameter name="enabled">true</parameter>

                <!-- Filter configuration -->
                <parameter name="type">extjs</parameter>
                <parameter name="subtype">appkit.ext.filter.hoststatus</parameter>

                <parameter name="no_operator">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">true</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>


    </fields>
</template>
