Manipulating your dashboard layout

Our new dashboard is looking good, but there is a lot of wasted space that we can use a lot better. By now, you will have noticed the row elements that we have been using, and as you can well assume, each time we open the row element it also creates a new row for us. In our example, we can bunch our two single-value elements together in one row by removing the closing and opening elements in line 18 and 19 of our code. Or, instead of removing the code, we can use the comment feature of XML to comment out the two lines that we are talking about:

  1. We should by now know where our dashboard is on our development environment, so open the cell_counts.xml file.
  2. Change lines 18 and 19 to the following lines of code:
          18 <!--   </row> --> 
          19 <!--   <row> --> 
    
  3. Save your changes and refresh the cache. You will now see that the two single-value elements are now displaying on a single row.
  4. If we wanted to, we could continue to add single-value elements to the row, as Splunk no longer limits the number of columns that we have to three. In our example, we will also add a new single-value element, but let's see what happens when we put in some new comments in line 17 and 20 as well, so that we can combine our single-value elements into one panel.
  5. Once again, open the cell_counts.xml file and make the following change to the code:
          17 <!--    </panel> --> 
          18 <!--   </row> --> 
          19 <!--   <row> --> 
          20 <!--    <panel> --> 
    

    Tip

    In our example, we are adding in the comment tags in each line, but if we wanted to, we could start our comment tag on one line and then end it three lines later; all the lines would then be commented out.

  6. Move to the bottom of the file and remove the last two lines. Then replace it with the following lines of Simple XML to display any cell counts that are over 20 cells:
          33     <panel> 
          34       <single> 
          35         <title>Larger Cell Count</title> 
          36         <search> 
          37           <query><![CDATA[ index=main
                       sourcetype=cellsimulation | eval data=_raw | rex
                       field=data max_match=0 "(?<cells>@)" | stats
                       count(cells) AS Count by _time | where Count>=20
                       | stats count ]    ]> </query> 
          38           <earliest>0</earliest> 
          39           <latest></latest> 
          40         </search> 
          41         <option name="drilldown">none</option> 
          42         <option name="linkView">search</option> 
          43         <option name="underLabel">Alive Cells</option> 
          44       </single> 
          45     </panel> 
          46   </row> 
          47 </dashboard> 
    
  7. Save your changes, and once again refresh your cache. If all goes as planned, your dashboard should look like what is shown in the following screenshot.

    Manipulating your dashboard layout

  8. As we can see, the Zero Cell Count and Small Cell Count single-value elements are now displaying as a single panel that takes up the same amount of space as the Larger Cell Count single-value element. If we wanted to, we could remove all the panel elements in between the row elements and we would have one combined row with all three entries in place.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155