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
Get Updates on the Splunk Community!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...