All Apps and Add-ons

Dashboards and icons help

strawi
New Member

Hi

Im a newbie to splunk and just started developing dashboards etc
I have been following some examples in the Splunk "dashboard examples" app but still struggling to achieve the result.

As a test I have a csv file that has several headers such as Hostname, ServiceA, ServiceB, ServiceC etc etc

My js file ICONS is set to

TRUE: 'check-circle'
FALSE: 'alert-circle'
Stopped: 'alert-circle'
Running: 'check-circle'

I am trying to produce a dashboard that shows the host name and the either a tick or an alert in each cell depending if the cell reads , TRUE, FALSE, stopped or running.

So far i Can only get one volume to show ticks. Can anyone help?
Thank you

Tags (1)
0 Karma

strawi
New Member

here is my latest script? any ideas?

require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, TableView) {

         var CustomIconRenderer = TableView.BaseCellRenderer.extend({
             canRender: function(cell) {
               var allowedCells = ["service1","service2", "serviceA", "serviceB", "servicec", "serviced"]
                           return (allowedCells.indexOf(cell.field)) > -1;
             },

              render: function($td, cell) {
                 var count = cell.value;

                 // Compute the icon base on the field value
                 var icon;
                 if(count == "TRUE" || "Running" ) {
                     icon = 'check';
                // } else if(count != TRUE && count != Running) {
                  //   icon = 'severe';
                 //} else if(count == 100) {
                 //    icon = 'low';
                 } else {
                     icon='alert';
                 }

                 // Create the icon element and add it to the table cell
                 $td.addClass('icon-inline numeric').html(_.template('<%- text %> <i class="icon-<%-icon%>"></i>', {
                     icon: icon,
                     text: cell.value
                 }));
             }
         });

         mvc.Components.get('table1').getVisualization(function(tableView){
             // Register custom cell renderer
             tableView.table.addCellRenderer(new CustomIconRenderer());
             // Force the table to re-render
             tableView.table.render();
         });
     });
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...