All Apps and Add-ons

how execute command at backend from a externally added button in the Inputs tab of a AddOn

sawgata12345
Path Finder

Hi,
I have created a Addon using the AddonBuilder in splunk.
it has three tabs Inputs|Configuration|Search
In the inputs tab a button appears "Create New Input". I want to add one more button just beside it and on click of the event i want to stop a python script.
While creating the Addon in the "Configure Data Collection " section I choose "Modular Inputs as Shell commands". there in the "Data Inputs Definition" tab i given
/home//testmain.sh
inside the .sh file:
/home//application/app1/test.py & (this starts it as daemon. the test.py has internal loop which keeps waiting for input, once it receives input it formats data and send to splunk at a specific index)

This .sh file is starting a python script in background which keeps on running.
In the Addon we have enable/disable option to prevent Splunk executing testmain.sh after every interval(mandatory to provide), but I want to kill python process by adding a button beside the "Create New Input". on click of the button it should stop the python script.
I can however again enable the python script from the Addon UI enable/disable option of the Actions.
How do I add the button and send an event so in backend it kills the python file.

0 Karma

chli_splunk
Splunk Employee
Splunk Employee

Currently it's not possible since AoB is leveraging another component to render data input configuration UI.

0 Karma

sawgata12345
Path Finder

ok, cant we send any rest call or edit the " another component" to add one more line same as for "Create New Input". This "another component " will also be present inside the addon folder created as "TA-sampleapp" or those components are defined in some other location?

Is it possible to create a App instead of Addon and do the above?
I created a "SampleApp", in backend it also created similar folder "TA-sampleapp". Is it possible to add one button for start and one button for stop?
I changed the config files in the default and local folders but nothing is changing on the UI.

0 Karma

chli_splunk
Splunk Employee
Splunk Employee

The data input configuration UI framework has both frontend components and backend rest endpoints. It's not easy to figure out a quick solution by "hacking" existing framework, otherwise it's more like a feature request.

0 Karma
Register for .conf21 Now! Go Vegas or Go Virtual!

How will you .conf21? You decide! Go in-person in Las Vegas, 10/18-10/21, or go online with .conf21 Virtual, 10/19-10/20.