Dashboards & Visualizations

Why is my "hello, world!" program not running after following instructions on http://dev.splunk.com/view/SP-CAAAERB?

shaoyongyang
Engager

I see the http://dev.splunk.com/view/SP-CAAAERB and already created a file path, but why is my "hello, world!" program not running?

C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\static\your_app_name\demoview.js
C:\Program Files\Splunk\etc\apps\your_app_name\django\your_app_name\templates\demoview.html

how can i do?

chimell
Motivator

Hi shaoyongyang

Enter manually this URL:

 http://localhost:8000/dj/your-djangoapp-name/demoview/

to find your "hello, world!" program

tell me if it satisfy you

0 Karma

vganjare
Builder

HI,

I followed same example, and was able to load the page successfully. I have created/modified following artifacts:

  1. demoview.js : No changes. Copied as it is from the example tutorial
  2. demoview.html : No Changes. Copied as it is from the example tutorial
  3. demoview.py : added as per "http://dev.splunk.com/view/SP-CAAAERA" tutorial. Please Note: update "your_app_name/demoview" with appropriate app name
  4. urls.py : Added entry url(r'^demoview/$', 'your_app_name.views.demoview', name='demoview'),
  5. views.py : @render_to('your_app_name:demoview.html') @login_required def demoview(request): return{ "message": "Hello World from your_app_name!", "app_name": "your_app_name", }

urls.py and views.py are present at : Splunk\etc\apps\your_app_name\django\your_app_name

Thanks!!

0 Karma

kvaga
Explorer

Hello!
What are you talking about python? Where did you find python files or snippets in the tutorial? Maybe I use incorrect URL of tutorial. Actually my question is: what I'm doing wrong?
My steps:

1) Created Application "customviewtutorial"
2) created dashboard with the following source code:

Custom View

<html>
  <div id="mycustomview"></div>
</html>

3) Created folders appserver/static under the $SPLUNK_HOME/etc/apps/customviewtutorial path.

4) Created customview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:

/* customview.js */

require([
    "/static/app/customviewtutorial/demoview.js",
    "splunkjs/mvc/simplexml/ready!"
], function(DemoView) {

    // Create a custom view
    var customView = new DemoView({
        id: "mycustomview",
        el: $("#mycustomview")
    }).render();

});

5) Created demoview.js file under $SPLUNK_HOME/etc/apps/customviewtutorial/appserver/static folder with the following source code:

/* demoview.js */
define(function(require, exports, module){
    // Base class for custom views
    var SimpleSplunkView = require('splunkjs/mvc/simplesplunkview');
    // Define the custom view class
    var DemoView = SimpleSplunkView.extend({
        className: "demoview",
        // Override the render function to make the view do something
        // In this example: print to the page and to the console
        render: function() {
            // Print to the page
            this.$el.html("Hello, world!");
            // Print to the console
            console.log("Hello, world!");
            return this;
        }
    });
    return DemoView;
});

6) Restarted Splunk Instance
7) Trying to call http://localhost:8000/en-GB/app/customviewtutorial/custom_view but noting is hapened. My dashboard is empty.

Maybe my instance doesn't support javascript? How can I test it?
Help me please

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...