All Apps and Add-ons

Can i connect to new JMX connections via SPL?

Motivator

Hi

I have a situation where i need to connect to a dynamic list of URL and retrieve JMX data (I think if i could do this via SPL this would be the best, but open for suggestions!).

I have a new source-type JMX_DYNAMIC and i would like to use this source-type dynamically to view data via SPL. (Example below)

LAUNCHERHIBERNATE - service:jmx:rmi://hp656srv.fr.murex.com:58884/jndi/rmi://hp656srv.fr.murex.com:58884/jmxrmi
 LAUNCHER_WAREHOUSE - service:jmx:rmi://hp656srv.fr.murex.com:46153/jndi/rmi://hp656srv.fr.murex.com:46153/jmxrmi
 etc....

The idea would be the list can keep been produced and change and i would like to keep retrieving data via JMX on the new ports as they arive into the system.

At the moment with the "splunk add on for Java management extension" this has to be done static.

for example /dell425srv2/apps/splunk_old_versions/splunk_7_0_3/splunk/etc/apps/Splunk_TA_jmx/local

jmx_tasks.conf
[MUREX]
description = MUREX
disabled = 0
index = jmx
interval = 20
servers = Splunk_TA_jmx:TEST2 | Splunk_TA_jmx:TRADE_INSERTION
sourcetype = jmx
templates = Splunk_TA_jmx:MUREX

This would also need jmx_servers.conf
[TEST2]
description = TEST2
has_account = 1
interval = 60
jmx_url = service:jmx:rmi://mx12673vm:9092/jndi/rmi://mx12673vm:9092/jmxrmi

[TRADE_INSERTION]
description = TRADE_INSERTION
has_account = 1
interval = 5
jmx_url = service:jmx:rmi://hp656srv:26827/jndi/rmi://hp656srv:26827/jmxrmi

What i need is to add multiple jmx_url onto the jmx_server.conf and create an increased line in servers = Splunk_TA_jmx:TEST2 | Splunk_TA_jmx:TRADE_INSERTION + X + Y etc...

So I have two options

  • 1st Add to .conf files dynamically 2nd Run a JMX command via SPL -

I am open to suggestions 🙂

Thanks in Advance
Robert Lynch

0 Karma

SplunkTrust
SplunkTrust

@robertlynch2020,

If you want to collect data from jmx Urls defined in the specific file then you have to configure dynamic JMX URL in jmx_servers.conf and jmx_tasks.conf.

In jmx_servers.conf you have to add all JMX URLs from your file. One JMX URL entry , one server stanza with URL in jmx_servers.conf. Make server stanza name sequential like, TEST_1,TEST_2,TEST_3,.....,TEST_n. So this names can be easily used in jmx_task.conf as you mentioned in the question.

To make this changes dynamically, you have to write a script which can read JMX URLs and customize appropriate changes in jmx_servers.conf and 'jmx_tasks.conf`. This script should be executed when JMX URLs file is changed. Means whenever JMX URLs file changed at that moment jmx configuration files will be changed.

If we talk about data collection, Splunk Add-on for JMX is using default modular input. This modular input is written in such a way where any changes detected in any configurations all the server, task and template configurations will be reloaded and data collection will start with new configurations. There is no need to do any extra handing or execution of SPL for data collection.

So you can go with this approach.

Thanks
Kamlesh

0 Karma
State of Splunk Careers

Access the Splunk Careers Report to see real data that shows how Splunk mastery increases your value and job satisfaction.

Find out what your skills are worth!