<form script="modal.js" stylesheet="ui_simple.css,panel_decoration.css,hover.css" isVisible="true" version="1.1" theme="dark">
    <label>UI MEM, Solaris Memory and Swap Usage</label>
    <description>User Interface the MEM monitor</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>Solaris</default>
            <prefix>OStype="</prefix>
            <suffix>"</suffix>
            <choice value="*">Any OS</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="dropdown" token="statsmode" searchWhenChanged="true">
            <label>Select a stats mode:</label>
            <default>max</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>

    <!--
    Dynamic configuration
    The following searches are being used to define various tokens using event handlers
    -->

    <!-- 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 memory 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;">
                                    <h1>Solaris Memory statistics
                                        <br />(os.unix.nmon.memory.mem.*)</h1>
                                </div>

                                <div>
                                    <i>Effective fields: Effective statistics will deduce buffers and cached memory, This amount of memory can be freed by the kernel if it is required by the system or programs.</i>
                                    <br />
                                    <i>Available units: All fields (but total fields) are available in volume (Megabytes) or in percentage.</i>
                                </div>

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

                                    <h1>Physical memory statistics:</h1>

                                    <div class="list">
                                        <lu>
                                            <li><b>memused:</b> Total amount of physical RAM used</li>
                                            <li><b>memfree:</b> Total amount of physical RAM left unused by the system</li>
                                            <li><b>memtotal:</b> Total amount of physical RAM</li>
                                        </lu>
                                    </div>

                                    <br />

                                    <h1>Swap memory statistics:</h1>

                                    <div class="list" style="display: inline-block">
                                        <lu>
                                            <li><b>swapfree:</b> The total amount of swap free</li>
                                            <li><b>swapused:</b> The total amount of swap used</li>
                                            <li><b>swaptotal:</b> The total amount of swap available</li>
                                        </lu>
                                    </div>

                                </div>

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

                                <div style="text-align: center;" class="bootstrap_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.memory.mem.*&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.memory.mem.*%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.memory.mem.*%20(host%3D*)%20(OStype%3DLinux)%20(host%3D*)%20by%20OStype%20host%2C%20metric_name%20span%3D1m%0A%7C%20%60def_memory_volume_MB%60" class="tryitbtnxl">mstats volume pre-built 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.memory.mem.*%20(host%3D*)%20(OStype%3DLinux)%20(host%3D*)%20by%20OStype%20host%2C%20metric_name%20span%3D1m%0A%7C%20%60def_memory_load_percent_all_metrics%60" class="tryitbtnxl">mstats percentage pre-built query »
                                    </a>

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

                                    <a target="_blank" href="Nmon_baseline?form.osfilter=Linux" class="tryitbtnxl">Baseline Interface »
                                    </a>

                                    <a target="_blank" href="Dashboard_Bubblechart_top_processes?form.osfilter=Linux" class="tryitbtnxl">TOP Dashboard »
                                    </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.memory.memuse.*%20OStype%3DSolaris%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">os.unix.nmon.memory.memuse.* »
                                    </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.*%20OStype%3DSolaris%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">os.unix.nmon.cpu.top.* »
                                    </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.cpu_all.*%20OStype%3DSolaris%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">os.unix.nmon.cpu.cpu_all.* »
                                    </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.*%20OStype%3DSolaris%20host%3D*%20by%20metric_name%2C%20host%20span%3D1m" class="tryitbtnxl">os.unix.nmon.cpu.cpunn.* »
                                    </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>

    <!-- Base Searches for PostProcessing -->

    <search id="populate">
        <query>| mcatalog values(metric_name) where `nmon_metrics_index` `def_memory_all_os_metric_filters` $osfilter$ by host
| `mapping_frameID`
| stats count by frameID, host | sort 0 host</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
    </search>

    <search id="gaugestats">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by OStype, host, metric_name span=1m
| `$timefilter$`
| `def_memory_load_percent`
| stats max(mem_used_effective_PCT) AS max_mem, avg(mem_used_effective_PCT) AS avg_mem, max(swap_used_effective_PCT) AS max_swap, avg(swap_used_effective_PCT) AS avg_swap</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <refresh>$refresh$</refresh>
        <refreshType>delay</refreshType>
    </search>

    <search id="chartstats_byhost_percentage">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by OStype, host, metric_name span=1m
| `$timefilter$`
| `def_memory_load_percent_all_metrics`
| timechart $span$ useother=f limit=0 $statsmode$(buffers) as buffers, $statsmode$(cached) as cached, $statsmode$(mem_used_effective) as mem_used_effective by host</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <refresh>$refresh$</refresh>
        <refreshType>delay</refreshType>
    </search>

    <search id="chartstats_byhost_volume">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by OStype, host, metric_name span=1m
| `$timefilter$`
| `def_memory_volume_MB`
| timechart $span$ useother=f limit=0 $statsmode$(active) AS active, $statsmode$(buffers) as buffers, $statsmode$(cached) as cached,
$statsmode$(inactive) as inactive, $statsmode$(mem_used_effective) as mem_used_effective, $statsmode$(memtotal) as memtotal,
$statsmode$(swap_used_effective) as swap_used_effective, $statsmode$(swap_used_effective) as swap_used_effective, $statsmode$(swapcached) as swap_cached_MB, $statsmode$(swaptotal) as swaptotal by host</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <refresh>$refresh$</refresh>
        <refreshType>delay</refreshType>
    </search>

    <search id="chartstats_bydeployment_percentage">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by OStype, host, metric_name span=1m
| `$timefilter$`
| `def_memory_load_percent_all_metrics`
| timechart $span$ $statsmode$(*) AS *</query>
        <earliest>$timerange.earliest$</earliest>
        <latest>$timerange.latest$</latest>
        <refresh>$refresh$</refresh>
        <refreshType>delay</refreshType>
    </search>

    <search id="chartstats_bydeployment_volume">
        <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by OStype, host, metric_name span=1m
| `$timefilter$`
| `def_memory_volume_MB`
| timechart $span$ $statsmode$(*) AS *</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_mem=round(max_mem,2) | gauge max_mem</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 %Mem</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_mem=round(avg_mem,2) | gauge avg_mem</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 %Mem</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 max_swap=round(max_swap,2) | fillnull value="0" max_swap | gauge max_swap</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 %Swap</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_swap=round(avg_swap,2) | fillnull value="0" avg_swap | gauge avg_swap</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 %Swap</option>
                <option name="height">180</option>
                <option name="refresh.display">preview</option>
            </viz>
        </panel>
    </row>

    <row>
        <panel id="memory1">
            <title>Memory table stats</title>
            <input type="dropdown" token="memmode" searchWhenChanged="true">
                <label></label>
                <default>percentage</default>
                <choice value="percentage">Usage in percentage (%)</choice>
                <choice value="volume">Activity in Data Volume (MB)</choice>
                <change>
                    <condition value="percentage">
                        <set token="show_memory_percentage">True</set>
                        <unset token="show_memory_volume"></unset>
                    </condition>
                    <condition value="volume">
                        <set token="show_memory_volume">True</set>
                        <unset token="show_memory_percentage"></unset>
                    </condition>
                </change>
            </input>

            <table depends="$show_memory_percentage$">
                <title></title>
                <search depends="$show_memory_percentage$">
                    <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by host, metric_name span=1m
| `$timefilter$`
| `extract_metrics`
| eval {metric}=value
| stats values(memtotal) as memtotal, values(memfree) as memfree, values(swaptotal) as swaptotal, values(swapfree) as swapfree by _time, host
| eval mem_used_effective= round((((memtotal-memfree)/memtotal)*100),2)
| eval mem_free_effective = round(((memfree/memtotal)*100),2)
| eval swap_used_effective = round((((swaptotal-swapfree)/swaptotal)*100),2)
| eval swap_free_effective = round(((swapfree/swaptotal)*100),2)
| fields - memtotal, memfree, memtotal, swaptotal, swapfree
| stats $statsmode$(*) as "*" by host
| rename "*_PCT" as "*"
| fields host, "mem*total*", "mem*used*", "mem*free*", "swap*total*", "swap*used*", "swap*free*", *
| rename "mem*" AS "mem* (%)", "swap*" AS "swap* (%)"
| foreach "*%*" [ eval "&lt;&lt;FIELD&gt;&gt;"=round('&lt;&lt;FIELD&gt;&gt;', 2) ]</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">cell</option>
                <option name="count">10</option>
                <option name="refresh.display">none</option>
                <option name="percentagesRow">false</option>
                <format type="color" field="mem_used_effective (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="swap_used_effective (%)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
            </table>

            <table depends="$show_memory_volume$">
                <title></title>
                <search depends="$show_memory_volume$">
                    <query>| mstats avg(_value) as value where `nmon_metrics_index` `def_memory_all_os_metric_filters` host=$host-prefilter$ $host_query$ by host, metric_name span=1m
| `$timefilter$`
| `extract_metrics`
| eval {metric}=value
| stats values(memtotal) as memtotal, values(memfree) as memfree, values(swaptotal) as swaptotal, values(swapfree) as swapfree by _time, host
| eval mem_used_effective = (memtotal-memfree)
| eval swap_used_effective = (swaptotal-swapfree)
| stats $statsmode$(*) as "*" by host
| fields host, "mem*total*", "mem*used*", "mem*free*", "swap*total*", "swap*used*", "swap*free*", *
| rename "mem*" AS "mem* (MB)", "swap*" AS "swap* (MB)"
| foreach "*MB*" [ eval "&lt;&lt;FIELD&gt;&gt;"=round('&lt;&lt;FIELD&gt;&gt;', 0) ]</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">cell</option>
                <option name="count">10</option>
                <option name="refresh.display">none</option>
                <option name="percentagesRow">false</option>
                <format type="color" field="mem_used_effective (MB)">
                    <colorPalette type="minMidMax" maxColor="#31A35F" minColor="#353535"></colorPalette>
                    <scale type="minMidMax"></scale>
                </format>
                <format type="color" field="swap_used_effective (MB)">
                    <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="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="memory2">
            <title>Memory charts</title>

            <input type="link" token="linkinput">
                <label></label>
                <choice value="chart1">Deployment: Free/Used/Total memory (MB)</choice>
                <choice value="chart2">Deployment: Effective memory/swap used (%)</choice>
                <choice value="chart3">By host: Effective memory Used/Total available (MB)</choice>
                <choice value="chart4">By host: Used memory (%)</choice>
                <choice value="chart5">By host: Used/Total memory (MB)</choice>
                <choice value="chart6">By host: Swap Used/Total available (MB)</choice>
                <default>chart1</default>
                <change>
                    <condition value="chart1">
                        <set token="chart1">true</set>
                        <unset token="chart2"></unset>
                        <unset token="chart3"></unset>
                        <unset token="chart4"></unset>
                        <unset token="chart5"></unset>
                        <unset token="chart6"></unset>
                    </condition>
                    <condition value="chart2">
                        <set token="chart2">true</set>
                        <unset token="chart1"></unset>
                        <unset token="chart3"></unset>
                        <unset token="chart4"></unset>
                        <unset token="chart5"></unset>
                        <unset token="chart6"></unset>
                    </condition>
                    <condition value="chart3">
                        <set token="chart3">true</set>
                        <unset token="chart1"></unset>
                        <unset token="chart2"></unset>
                        <unset token="chart4"></unset>
                        <unset token="chart5"></unset>
                        <unset token="chart6"></unset>
                    </condition>
                    <condition value="chart4">
                        <set token="chart4">true</set>
                        <unset token="chart1"></unset>
                        <unset token="chart2"></unset>
                        <unset token="chart3"></unset>
                        <unset token="chart5"></unset>
                        <unset token="chart6"></unset>
                    </condition>
                    <condition value="chart5">
                        <set token="chart5">true</set>
                        <unset token="chart1"></unset>
                        <unset token="chart2"></unset>
                        <unset token="chart3"></unset>
                        <unset token="chart4"></unset>
                        <unset token="chart6"></unset>
                    </condition>
                    <condition value="chart6">
                        <set token="chart6">true</set>
                        <unset token="chart1"></unset>
                        <unset token="chart2"></unset>
                        <unset token="chart3"></unset>
                        <unset token="chart4"></unset>
                        <unset token="chart5"></unset>
                    </condition>
                </change>
            </input>

            <chart depends="$chart1$">
                <title></title>
                <search base="chartstats_bydeployment_volume">
                    <query>fields _time, memfree, mem_used_effective, memtotal</query>
                </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">area</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">stacked</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">volume (MB)</option>
                <option name="charting.axisY.minimumNumber">0</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">0</option>
                <option name="charting.axisY2.scale">inherit</option>
                <option name="charting.chart.bubbleMaximumSize">50</option>
                <option name="charting.chart.bubbleMinimumSize">10</option>
                <option name="charting.chart.bubbleSizeBy">area</option>
                <option name="charting.chart.overlayFields">mem_total_MB</option>
                <option name="charting.chart.showDataLabels">none</option>
                <option name="charting.layout.splitSeries.allowIndependentYRanges">0</option>
                <option name="charting.fieldColors">{"mem_total_MB": 0xe50000}</option>
                <option name="refresh.display">none</option>
            </chart>
            <chart depends="$chart2$">
                <title></title>
                <search base="chartstats_bydeployment_percentage">
                    <query>fields _time, mem_used_effective, swap_used_effective</query>
                </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">line</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">default</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">percentage (%)</option>
                <option name="charting.axisY.minimumNumber">0</option>
                <option name="charting.axisY.maximumNumber">100</option>
                <option name="refresh.display">none</option>
            </chart>
            <chart depends="$chart3$">
                <title></title>
                <search base="chartstats_byhost_volume">
                    <query>fields _time, *mem_used_effective*, *memtotal*</query>
                </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">line</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">default</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">volume (MB)</option>
                <option name="charting.axisY.minimumNumber">0</option>
                <option name="refresh.display">none</option>
            </chart>
            <chart depends="$chart4$">
                <title></title>
                <search base="chartstats_byhost_percentage">
                    <query>fields _time, mem_used*</query>
                </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">line</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">default</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">percentage (%)</option>
                <option name="charting.axisY.minimumNumber">0</option>
                <option name="charting.axisY.maximumNumber">100</option>
                <option name="refresh.display">none</option>
            </chart>
            <chart depends="$chart5$">
                <title></title>
                <search base="chartstats_byhost_volume">
                    <query>fields _time, mem_used*, memtotal*</query>
                </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">line</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">default</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">volume (MB)</option>
                <option name="charting.axisY.minimumNumber">0</option>
                <option name="refresh.display">none</option>
            </chart>
            <chart depends="$chart6$">
                <title></title>
                <search base="chartstats_byhost_volume">
                    <query>fields _time, swap_used*, swaptotal*</query>
                </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">line</option>
                <option name="charting.chart.nullValueMode">$charting.chart.nullValueMode$</option>
                <option name="charting.chart.sliceCollapsingThreshold">0.01</option>
                <option name="charting.chart.stackMode">default</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="height">680</option>
                <option name="charting.axisTitleX.text">Time</option>
                <option name="charting.axisTitleY.text">volume (MB)</option>
                <option name="charting.axisY.minimumNumber">0</option>
                <option name="refresh.display">none</option>
            </chart>
        </panel>
    </row>

</form>
