<form script="modal.js" stylesheet="ui_simple.css,panel_decoration.css" isVisible="true" version="1.1" theme="dark">
    <label>UI CPUnn - CPU Percentage usage per core advanced analysis</label>
    <description>User Interface for the CPUnn monitor, Processor Percentage utilization statistics per logical core</description>

    <fieldset autoRun="false" submitButton="false">

        <input type="time" token="timerange" searchWhenChanged="true">
            <label>Time Range:</label>
            <default>
                <earliest>-24h</earliest>
                <latest>now</latest>
            </default>
            <change>
                <unset token="form.refresh"></unset>
            </change>
        </input>

        <input type="dropdown" token="timefilter" searchWhenChanged="true">
            <label>Time Filtering:</label>
            <choice value="No_Filter">No Filter (24/24, 7/7)</choice>
            <choice value="Day_BusinessDays_8h-19h">Day Business (08h-19h)</choice>
            <choice value="Day_WeekEnd_8h-19h">Day WE (08h-19h)</choice>
            <choice value="Day_AllDays_8h-19h">Day Week (08h-19h)</choice>
            <choice value="Night_BusinessDays_19h-8h">Night Business (19h-08h)</choice>
            <choice value="Night_WeekEnd_19h-8h">Night WE (19h-08h)</choice>
            <choice value="Night_AllDays_19h-8h">Night All Days (19h-08h)</choice>
            <default>No_Filter</default>
        </input>

        <input type="dropdown" token="osfilter" searchWhenChanged="true">
            <label>Filter OS Type:</label>
            <default>*</default>
            <prefix>OStype="</prefix>
            <suffix>"</suffix>
            <choice value="*">Any OS</choice>
            <choice value="AIX">AIX</choice>
            <choice value="Linux">Linux</choice>
            <choice value="Solaris">Solaris</choice>
        </input>

        <input id="frameID" type="multiselect" token="frameID" searchWhenChanged="true">
            <label>Frame IDs:</label>
            <!-- Populating Data Model Search -->
            <search base="populate">
                <query>stats count by frameID | dedup frameID | sort 0 frameID</query>
            </search>
            <valuePrefix>frameID=</valuePrefix>
            <delimiter> OR </delimiter>
            <choice value="*">Any</choice>
            <initialValue>*</initialValue>
            <fieldForLabel>frameID</fieldForLabel>
            <fieldForValue>frameID</fieldForValue>
        </input>

        <input type="text" token="host-prefilter" searchWhenChanged="true">
            <label>Optional: Filter hosts populating</label>
            <default>*</default>
        </input>

        <input id="host" type="multiselect" token="host" searchWhenChanged="true">
            <label>Hosts Selection:</label>
            <!-- Populating Data Model Search -->
            <search base="populate">
                <query>search $frameID$ host=$host-prefilter$
| stats count by host | dedup host | sort 0 host</query>
            </search>
            <valuePrefix>host="</valuePrefix>
            <valueSuffix>"</valueSuffix>
            <delimiter> OR </delimiter>
            <choice value="*">ALL Hosts</choice>
            <fieldForLabel>host</fieldForLabel>
            <fieldForValue>host</fieldForValue>
            <change>
                <condition>
                    <unset token="form.host_query_input"></unset>
                </condition>
            </change>
        </input>

        <!-- hidden form that handles the advanced definition of hosts selection -->

        <input id="host_query_input" type="dropdown" token="host_query" searchWhenChanged="true" depends="$hidden_form$">
            <label>Hosts Selection:</label>
            <search base="populate">
                <query>search $host$ $frameID$
| stats values(host) as host
| format | fields - host | rename search as host</query>
            </search>
            <selectFirstChoice>true</selectFirstChoice>
            <fieldForLabel>host</fieldForLabel>
            <fieldForValue>host</fieldForValue>
        </input>

        <input type="multiselect" token="cpu_core" searchWhenChanged="true">
            <label>Core Selection:</label>
            <search base="populate">
                <query>search $frameID$ host=$host-prefilter$ $host$
| stats count by cpu_core | dedup cpu_core | sort 0 cpu_core</query>
            </search>
            <valuePrefix>cpu_core="</valuePrefix>
            <valueSuffix>"</valueSuffix>
            <delimiter> OR </delimiter>
            <choice value="*">ALL cores</choice>
            <initialValue>*</initialValue>
            <fieldForLabel>cpu_core</fieldForLabel>
            <fieldForValue>cpu_core</fieldForValue>
        </input>

        <input type="dropdown" token="aggregate_input" searchWhenChanged="true">
            <label>Aggregate:</label>
            <choice value="none">Single Series</choice>
            <choice value="avg">Average by Time interval</choice>
            <choice value="median">Median by Time interval</choice>
            <choice value="max">Max by Time interval</choice>
            <default>none</default>
            <change>
                <condition value="none">
                    <set token="aggregate">fields *</set>
                </condition>
                <condition value="avg">
                    <set token="aggregate">stats avg(*) as &quot;*&quot; by _time, cpu_core | eval host=&quot;aggreg_host&quot;</set>
                </condition>
                <condition value="median">
                    <set token="aggregate">stats median(*) as &quot;*&quot; by _time, cpu_core | eval host=&quot;aggreg_host&quot;</set>
                </condition>
                <condition value="max">
                    <set token="aggregate">stats max(*) as &quot;*&quot; by _time, cpu_core | eval host=&quot;aggreg_host&quot;</set>
                </condition>
            </change>
        </input>

        <input type="dropdown" token="statsmode" searchWhenChanged="true">
            <label>Stats mode:</label>
            <default>avg</default>
            <choice value="max">Max</choice>
            <choice value="avg">Avg</choice>
            <choice value="min">Min</choice>
            <choice value="median">Median</choice>
            <choice value="mode">Mode</choice>
            <choice value="range">Range</choice>
        </input>

        <input type="dropdown" token="refresh" searchWhenChanged="true">
            <label>Auto-refresh:</label>
            <fieldForLabel>label</fieldForLabel>
            <fieldForValue>value</fieldForValue>
            <selectFirstChoice>true</selectFirstChoice>
            <search>
                <query>| `def_auto_refresh`</query>
                <earliest>$timerange.earliest$</earliest>
                <latest>$timerange.latest$</latest>
            </search>
        </input>

    </fieldset>

    <!-- Base Searches for PostProcessing -->

    <search id="populate">
        <query>| mcatalog values(metric_name) as metrics values(OStype) as OStype where `nmon_metrics_index` metric_name="os.unix.nmon.cpu.cpunn.*" $osfilter$ by host
| rename metrics as metric_name
| rex field="metric_name" "os\.unix\.nmon\.\w*\.\w*\.(?&lt;cpu_core&gt;\w*)\.(?&lt;metric&gt;\w*)"
| `mapping_frameID`
| stats count by frameID, host, cpu_core | sort 0 host</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
    </search>

    <!-- Help the user -->

    <row rejects="$host$">
        <panel>
            <html>
                <div class="red_help_user">
                    <p>- - - - - - - - - - ACTION REQUIRED: please select your server name(s) in the host selector above - - - - - - - - - -</p>
                </div>
            </html>
        </panel>
    </row>

    <!-- Information panel -->

    <row>
        <panel>
            <html>

                <div class="imgheader custom-modal">
                    <img src="../../static/app/metricator-for-nmon/icons/dark_theme/info.png" alt="Info"/>
                    <h4><a data-modal-name="Help_modal">Help, information and related links for CPU statistics</a></h4>
                </div>

                <!-- Modal -->
                <div class="modal custom-modal-60 fade" id="Help_modal" tabindex="-1" role="dialog" aria-labelledby="Help_modal_Label">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"></span></button>
                                <div style="text-align: left;">
                                    <h4 class="modal-title" id="Help_modal_Label">Integrated Navigation:</h4>
                                </div>
                            </div>
                            <div class="modal-body">

                                <div style="text-align: center;">
                                    <img src="../../static/app/metricator-for-nmon/icons/dark_theme/cpu.png" alt="CPU"/>
                                    <h1>
                                        CPU percentage statistics per logical processor
                                        <br />
                                        (metric_name=os.unix.nmon.cpu.cpunn.*)
                                    </h1>
                                </div>

                                <div>
                                    <i>The CPUnn monitor represents average metrics on a per logical CPU level available to the system.</i>
                                    <br />
                                    <i>These metrics are common to every supported operating systems.</i>
                                </div>

                                <div style="text-align: left;">

                                    <h1>raw metrics:</h1>

                                    <div class="list">
                                        <lu>
                                            <li><b>os.unix.nmon.cpu.cpunn.*.Sys_PCT:</b> % of CPU time spent in kernel mode</li>
                                            <li><b>os.unix.nmon.cpu.cpunn.*.User_PCT:</b> % of CPU time spent in user mode</li>
                                            <li><b>os.unix.nmon.cpu.cpunn.*.Wait_PCT:</b> % of CPU time spent in waiting for resources</li>
                                        </lu>
                                    </div>

                                    <div class="list">
                                        <lu>
                                            <li><b>os.unix.nmon.cpu.cpunn.*.Steal_PCT:</b> % of time a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor</li>
                                        </lu>
                                        <lu>
                                            <li><b>os.unix.nmon.cpu.cpunn.*.Idle_PCT:</b> % of CPU time free, meaning not having task to do</li>
                                        </lu>
                                        <br />
                                    </div>

                                    <h1>calculated metrics:</h1>

                                    <div class="list">
                                        <lu>
                                            <li><b>cpu_load_percent:</b> % of CPU usage for all available cores (Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)</li>
                                        </lu>
                                    </div>

                                    <h1>metric dimensions:</h1>

                                    <div>
                                        <i>The CPUnn monitor owns a dimension which is the name of the cpu core, it is part of the metric_name as the 6th segment: <b>os.unix.nmon.cpu.cpunn.&lt;CPU_core&gt;.*</b>
                                        </i>
                                        <br />
                                    </div>

                                </div>

                                <div style="text-align:left;">
                                    <h1>Related links:</h1>
                                </div>

                                <div style="text-align: center;" class="cat_title">

                                    <a target="_blank" href="search?q=%7C%20mcatalog%20values(metric_name)%20as%20metrics%20where%20%60nmon_metrics_index%60%20metric_name%3D&quot;os.unix.nmon.cpu.cpunn.*&quot;%20host%3D&quot;*&quot;" class="tryitbtnxl">mcatalog »
                                    </a>

                                    <a target="_blank" href="search?q=%7C%20mstats%20avg(_value)%20as%20value%20where%20%60nmon_metrics_index%60%20metric_name%3Dos.unix.nmon.cpu.cpunn.*%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">mstats raw query»
                                    </a>

                                    <a target="_blank" href="search?q=%7C%20mstats%20avg(_value)%20as%20value%20where%20%60nmon_metrics_index%60%20metric_name%3Dos.unix.nmon.cpu.cpunn.*%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m%0A%7C%20%60extract_metrics_cpu_all(&quot;Sys_PCT%2C%20User_PCT%2C%20Wait_PCT%2C%20Idle_PCT%2C%20Steal_PCT&quot;)%60%0A%7C%20stats%20values(Sys_PCT)%20as%20Sys_PCT%2C%20values(User_PCT)%20as%20User_PCT%2C%20values(Steal_PCT)%20as%20Steal_PCT%2C%20values(Wait_PCT)%20as%20Wait_PCT%2C%20values(Idle_PCT)%20as%20Idle_PCT%20by%20_time%2C%20host%2C%20cpu_core%0A%7C%20fillnull%20value%3D0%20Sys_PCT%20User_PCT%20Wait_PCT%20Steal_PCT%0A%7C%20eval%20cpu_load_percent%3D(Sys_PCT%2BUser_PCT%2BWait_PCT%2BSteal_PCT)" class="tryitbtnxl">mstats pre-built query »
                                    </a>

                                    <a target="_blank" href="Howto_CPU_ALL_spl" class="tryitbtnxl">HOWTO Interface »
                                    </a>

                                    <a target="_blank" href="UI_data_dictionary?&amp;form.itemfilter=CPU%20USAGE%20STATISTICS" class="tryitbtnxl">CPU Data Dictionary »
                                    </a>

                                </div>

                                <div style="text-align:left;">
                                    <h1>Related metrics:</h1>
                                </div>

                                <div style="text-align: center;" class="cat_title">

                                    <a target="_blank" href="search?q=%7C%20mstats%20avg(_value)%20as%20value%20where%20%60nmon_metrics_index%60%20metric_name%3Dos.unix.nmon.cpu.cpunn.*%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">os.unix.nmon.cpu.cpunn.* »
                                    </a>

                                    <a target="_blank" href="search?q=%7C%20mstats%20avg(_value)%20as%20value%20where%20%60nmon_metrics_index%60%20metric_name%3Dos.unix.nmon.processes.top.*%20host%3D*%20by%20metric_name%2C%20host%2C%20dimension_Command%20span%3D1m" class="tryitbtnxl">os.unix.nmon.processes.top.* »
                                    </a>

                                    <a target="_blank" href="search?q=search%20eventtype%3Dnmon%3Aevents%20type%3DUARG" class="tryitbtnxl">UARG events »
                                    </a>

                                </div>

                            </div>

                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                            </div>

                        </div>
                    </div>
                </div>

            </html>
        </panel>
    </row>

    <search id="gaugestats">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name, host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core
| `$timefilter$`
| fillnull value=0 Sys_PCT,User_PCT,Wait_PCT,Steal_PCT
| eval cpu_load_percent=(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| stats avg(cpu_load_percent) as cpu_load_percent by _time, host
| stats avg(cpu_load_percent) as cpu_load_percent by _time
| stats max(cpu_load_percent) AS max, avg(cpu_load_percent) AS avg, median(cpu_load_percent) AS median</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <refresh>$refresh$</refresh>
        <refreshType>delay</refreshType>
    </search>

    <!-- ################################ -->

    <row>
        <panel>
            <viz type="horseshoe_meter_app.horseshoe_meter">
                <search base="gaugestats">
                    <query>eval max=round(max,2) | gauge max</query>
                </search>
                <option name="horseshoe_meter_app.horseshoe_meter.backgroundColor">#212527</option>
                <option name="horseshoe_meter_app.horseshoe_meter.dialColor">#d0d5d9</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeColor">#b44441</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeThreshold">85</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxValue">100</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeColor">#fbcd2f</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeThreshold">55</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minRangeColor">#3fc77a</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minValue">0</option>
                <option name="horseshoe_meter_app.horseshoe_meter.thresholdStyle">percentage</option>
                <option name="horseshoe_meter_app.horseshoe_meter.useRangemap">false</option>
                <option name="horseshoe_meter_app.horseshoe_meter.valueColor">#779ecb</option>
                <option name="horseshoe_meter_app.horseshoe_meter.caption">Max %CPU</option>
                <option name="height">180</option>
                <option name="refresh.display">preview</option>
            </viz>
        </panel>
        <panel>
            <viz type="horseshoe_meter_app.horseshoe_meter">
                <search base="gaugestats">
                    <query>eval avg=round(avg,2) | gauge avg</query>
                </search>
                <option name="horseshoe_meter_app.horseshoe_meter.backgroundColor">#212527</option>
                <option name="horseshoe_meter_app.horseshoe_meter.dialColor">#d0d5d9</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeColor">#b44441</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeThreshold">85</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxValue">100</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeColor">#fbcd2f</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeThreshold">55</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minRangeColor">#3fc77a</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minValue">0</option>
                <option name="horseshoe_meter_app.horseshoe_meter.thresholdStyle">percentage</option>
                <option name="horseshoe_meter_app.horseshoe_meter.useRangemap">false</option>
                <option name="horseshoe_meter_app.horseshoe_meter.valueColor">#779ecb</option>
                <option name="horseshoe_meter_app.horseshoe_meter.caption">Avg %CPU</option>
                <option name="height">180</option>
                <option name="refresh.display">preview</option>
            </viz>
        </panel>
        <panel>
            <viz type="horseshoe_meter_app.horseshoe_meter">
                <search base="gaugestats">
                    <query>eval median=round(median,2) | gauge median</query>
                </search>
                <option name="horseshoe_meter_app.horseshoe_meter.backgroundColor">#212527</option>
                <option name="horseshoe_meter_app.horseshoe_meter.dialColor">#d0d5d9</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeColor">#b44441</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxRangeThreshold">85</option>
                <option name="horseshoe_meter_app.horseshoe_meter.maxValue">100</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeColor">#fbcd2f</option>
                <option name="horseshoe_meter_app.horseshoe_meter.midRangeThreshold">55</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minRangeColor">#3fc77a</option>
                <option name="horseshoe_meter_app.horseshoe_meter.minValue">0</option>
                <option name="horseshoe_meter_app.horseshoe_meter.thresholdStyle">percentage</option>
                <option name="horseshoe_meter_app.horseshoe_meter.useRangemap">false</option>
                <option name="horseshoe_meter_app.horseshoe_meter.valueColor">#779ecb</option>
                <option name="horseshoe_meter_app.horseshoe_meter.caption">Median %CPU</option>
                <option name="height">180</option>
                <option name="refresh.display">preview</option>
            </viz>
        </panel>
    </row>

    <row>
        <panel>
            <table>
                <search>
                    <query>| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name, host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core
| `$timefilter$`
| fillnull value=0 Sys_PCT,User_PCT,Wait_PCT,Steal_PCT
| eval cpu_load_percent=(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| $aggregate$
| stats avg(cpu_load_percent) as cpu_load_percent, avg(Sys_PCT) as Sys_PCT, avg(User_PCT) as User_PCT, avg(Wait_PCT) as Wait_PCT, avg(Steal_PCT) as Steal_PCT by host, cpu_core
| foreach cpu_load_percent Sys_PCT User_PCT Wait_PCT Steal_PCT [ eval &lt;&lt;FIELD&gt;&gt; = round('&lt;&lt;FIELD&gt;&gt;', 3) ]
| rename cpu_load_percent as "cpu (%)", Sys_PCT as "Sys (%)", User_PCT as "User (%)", Wait_PCT as "Wait (%)", Steal_PCT as "Steal (%)"
                    </query>
                    <earliest>$timerange.earliest$</earliest>
                    <latest>$timerange.latest$</latest>
                    <refresh>$refresh$</refresh>
                    <refreshType>delay</refreshType>
                </search>
                <option name="wrap">true</option>
                <option name="rowNumbers">false</option>
                <option name="dataOverlayMode">none</option>
                <option name="drilldown">row</option>
                <option name="count">10</option>
                <option name="refresh.display">none</option>
                <option name="percentagesRow">false</option>
                <format type="sparkline" field="sparkline">
                    <option name="lineColor">#5379af</option>
                    <option name="fillColor">#CCDDFF</option>
                    <option name="lineWidth">1</option>
                    <option name="height">25</option>
                </format>
                <format type="color" field="User (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="Sys (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="Wait (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="Steal (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="cpu (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
            </table>
        </panel>
    </row>

    <row>
        <panel id="settings">
            <title>Charting parameters</title>
            <input type="dropdown" token="cpumode" searchWhenChanged="true">
                <label>Show CPU load by:</label>
                <default>global_cpu</default>
                <choice value="global_cpu">Global CPU Percent Utilization</choice>
                <choice value="multi_cpu">MultiSeries: Sys,User,Wait,Steal,Idle</choice>
                <change>
                    <condition value="global_cpu">
                        <set token="form.chart">line</set>
                        <set token="form.charting.chart.nullValueMode">gaps</set>
                        <set token="form.chart.stackingmode">default</set>
                        <set token="show_by_cpu_global">True</set>
                        <unset token="show_by_cpu_category"></unset>
                    </condition>
                    <condition value="multi_cpu">
                        <set token="form.chart">area</set>
                        <set token="form.charting.chart.nullValueMode">connect</set>
                        <set token="form.chart.stackingmode">stacked</set>
                        <set token="show_by_cpu_category">True</set>
                        <unset token="show_by_cpu_global"></unset>
                    </condition>
                </change>
            </input>
            <input type="checkbox" token="cpumode_cat" searchWhenChanged="true" depends="$cpu_by_category$">
              <label>Categories:</label>
              <choice value="Sys_PCT*">Sys_PCT</choice>
              <choice value="User_PCT*">User_PCT</choice>
              <choice value="Wait_PCT*">Wait_PCT</choice>
              <choice value="Steal_PCT*">Steal_PCT</choice>
              <choice value="Idle_PCT*">Idle_PCT</choice>
              <default>Idle_PCT*,Wait_PCT*,User_PCT*,Sys_PCT*,Steal_PCT*</default>
              <delimiter>,</delimiter>
            </input>
            <input type="dropdown" token="chart" searchWhenChanged="true">
                <label>Select a type of chart:</label>
                <default>line</default>
                <choice value="area">Area</choice>
                <choice value="line">Line</choice>
                <choice value="column">Column</choice>
                <choice value="bar">Bar</choice>
            </input>
            <input type="dropdown" token="charting.chart.nullValueMode" searchWhenChanged="true">
                <label>Missing Data:</label>
                <default>gaps</default>
                <choice value="gaps">Gaps</choice>
                <choice value="connect">Connect</choice>
                <choice value="zero">Zero</choice>
            </input>
            <input type="dropdown" token="chart.stackingmode" searchWhenChanged="true">
                <label>Select a stacking mode:</label>
                <default>unstacked</default>
                <choice value="stacked">stacked (lines excluded)</choice>
                <choice value="stacked100">100% stacked (lines excluded)</choice>
                <choice value="unstacked">unstacked</choice>
            </input>
            <input type="dropdown" token="charting.legend.placement" searchWhenChanged="true">
                <label>Legend placement:</label>
                <default>bottom</default>
                <choice value="bottom">Bottom</choice>
                <choice value="top">Top</choice>
                <choice value="left">left</choice>
                <choice value="right">right</choice>
                <choice value="none">none</choice>
            </input>
            <input type="dropdown" token="span" searchWhenChanged="true">
                <label>Span:</label>
                <default>`nmon_span`</default>
                <choice value="`nmon_span`">auto</choice>
                <choice value="span=1m">1 minute</choice>
                <choice value="span=2m">2 minutes</choice>
                <choice value="span=3m">3 minutes</choice>
                <choice value="span=4m">4 minutes</choice>
                <choice value="span=5m">5 minutes</choice>
                <choice value="span=10m">10 minutes</choice>
                <choice value="span=15m">15 minutes</choice>
                <choice value="span=30m">30 minutes</choice>
                <choice value="span=1h">1 hour</choice>
                <choice value="span=2h">2 hours</choice>
                <choice value="span=12h">12 hours</choice>
                <choice value="span=4h">4 hours</choice>
                <choice value="span=1d">1 day</choice>
                <choice value="span=2d">2 days</choice>
                <choice value="span=1w">7 days</choice>
                <choice value="span=1mon">1 month</choice>
            </input>
        </panel>
    </row>

    <row>
        <panel id="cpu">
            <title>CPU Logical Core statistics</title>
            <input type="checkbox" token="cpu_scale" searchWhenChanged="true">
                <label></label>
                <initialValue>0</initialValue>
                <choice value="0">Starts scale at 0 %</choice>
            </input>
            <input type="checkbox" token="cpu_scaleend" searchWhenChanged="true">
                <label></label>
                <choice value="100">Ends scale at 100 %</choice>
                <initialValue>100</initialValue>
            </input>
            <chart depends="$show_by_cpu_global$">
                <search depends="$show_by_cpu_global$">
                    <query>| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core
| fillnull value=0 Sys_PCT,User_PCT,Wait_PCT,Steal_PCT
| `$timefilter$`
| search ($cpu_core$)
| eval cpu_PCT=(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| $aggregate$
| eval key=host . ":" . cpu_core
| timechart $span$ useother=f limit=0 avg(cpu_PCT) AS cpu_PCT by key</query>
                    <earliest>$timerange.earliest$</earliest>
                    <latest>$timerange.latest$</latest>
                    <refresh>$refresh$</refresh>
                    <refreshType>delay</refreshType>
                </search>
                <option name="charting.axisTitleX.visibility">visible</option>
                <option name="charting.axisTitleY.visibility">visible</option>
                <option name="charting.axisX.scale">linear</option>
                <option name="charting.axisY.scale">linear</option>
                <option name="charting.chart">$chart$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">$chart.stackingmode$</option>
                <option name="charting.chart.style">shiny</option>
                <option name="charting.drilldown">all</option>
                <option name="charting.layout.splitSeries">0</option>
                <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
                <option name="charting.legend.placement">$charting.legend.placement$</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">% CPUs</option>
                <option name="charting.axisY.minimumNumber">$cpu_scale$</option>
                <option name="charting.axisY.maximumNumber">$cpu_scaleend$</option>
                <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
                <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
                <option name="charting.axisTitleY2.visibility">visible</option>
                <option name="charting.axisY2.enabled">false</option>
                <option name="charting.axisY2.scale">inherit</option>
                <option name="refresh.display">none</option>
                <drilldown target="search">
                    <link>
                        <![CDATA[
                            search?earliest=$earliest$&latest=$latest$&q=| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core
| fillnull value=0 Sys_PCT,User_PCT,Wait_PCT,Steal_PCT
| `$timefilter$`
| search ($cpu_core$)
| eval cpu_PCT=(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| $aggregate$
| eval key=host . ":" . cpu_core
| timechart $span$ useother=f limit=0 avg(cpu_PCT) AS cpu_PCT by key
                        ]]>
                    </link>
                </drilldown>
            </chart>
            <chart depends="$show_by_cpu_category$">
                <search depends="$show_by_cpu_category$">
                    <query>| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core | fillnull value=0
| `$timefilter$`
| search ($cpu_core$)
| eval Idle_PCT=100-(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| $aggregate$
| timechart $span$ useother=f limit=0 avg(Idle_PCT) as "Idle_PCT", avg(Wait_PCT) as Wait_PCT, avg(User_PCT) as User_PCT, avg(Sys_PCT) as Sys_PCT, avg(Steal_PCT) as Steal_PCT by host
| fields _time,$cpumode_cat$</query>
                    <earliest>$timerange.earliest$</earliest>
                    <latest>$timerange.latest$</latest>
                    <refresh>$refresh$</refresh>
                    <refreshType>delay</refreshType>
                </search>
                <option name="charting.axisTitleX.visibility">visible</option>
                <option name="charting.axisTitleY.visibility">visible</option>
                <option name="charting.axisX.scale">linear</option>
                <option name="charting.axisY.scale">linear</option>
                <option name="charting.chart">$chart$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">$chart.stackingmode$</option>
                <option name="charting.chart.style">shiny</option>
                <option name="charting.drilldown">all</option>
                <option name="charting.layout.splitSeries">0</option>
                <option name="charting.legend.labelStyle.overflowMode">ellipsisMiddle</option>
                <option name="charting.legend.placement">$charting.legend.placement$</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">% CPUs</option>
                <option name="charting.axisY.minimumNumber">$cpu_scale$</option>
                <option name="charting.axisY.maximumNumber">$cpu_scaleend$</option>
                <option name="charting.axisLabelsX.majorLabelStyle.overflowMode">ellipsisNone</option>
                <option name="charting.axisLabelsX.majorLabelStyle.rotation">0</option>
                <option name="charting.axisTitleY2.visibility">visible</option>
                <option name="charting.axisY2.enabled">false</option>
                <option name="charting.axisY2.scale">inherit</option>
                <option name="refresh.display">none</option>
                <drilldown target="search">
                    <link>
                        <![CDATA[
                            search?earliest=$earliest$&latest=$latest$&q=| mstats avg(_value) as value where `nmon_metrics_index` metric_name=os.unix.nmon.cpu.cpunn.* host=$host-prefilter$ $host_query$ by metric_name host span=1m
| `extract_metrics_cpu_all("Sys_PCT, User_PCT, Wait_PCT, Steal_PCT")`
| stats values(Sys_PCT) as Sys_PCT, values(User_PCT) as User_PCT, values(Wait_PCT) as Wait_PCT, values(Steal_PCT) as Steal_PCT by _time, host, cpu_core | fillnull value=0
| `$timefilter$`
| search ($cpu_core$)
| eval Idle_PCT=100-(Sys_PCT+User_PCT+Wait_PCT+Steal_PCT)
| $aggregate$
| timechart $span$ useother=f limit=0 avg(Idle_PCT) as "Idle_PCT", avg(Wait_PCT) as Wait_PCT, avg(User_PCT) as User_PCT, avg(Sys_PCT) as Sys_PCT, avg(Steal_PCT) as Steal_PCT by host
| fields _time,$cpumode_cat$
                        ]]>
                    </link>
                </drilldown>
            </chart>
        </panel>
    </row>

</form>
