All Apps and Add-ons
Highlighted

Why is my REST Modular API input throwing an error

Path Finder

I have wrestled with this issue for the last few days and am becoming frustrated.

I am new to this REST Modular API but not Splunk.

Here is my input.conf info:

[rest://dynatrace_api_2]
activation_key = 3C3FA5F032624FA3CAD44F2D37F87A8B
endpoint = https://ultraapi-prod.dynatrace.com/v3.2/synthetic/trend
http_method = GET
auth_type = none
url_args = rltime=60000&bucket=second&group=mname,monid&metrics=count,avail,nwtme,uxtme&monid=32175486&login=raynold.peterson@bbva.com&pass=750B1219B68A4EAD8336B2EA0B30284B
response_type = json
http_proxy = http://10.10.126.46:8080/
https_proxy = https://10.10.126.46:8080/
polling_interval = */1 * * * *
index_error_response_codes = 1
delimiter = &
index = dynatrace_api
sequential_mode = 0
sourcetype = dynatrace_api
streaming_request = 0
disabled = 0

To test this I ran some debug commands at the command line to test outside of the Web URL.

./splunk.exe cmd splunkd print-modinput-config rest rest://dynatrace_api_2 | ./splunk.exe cmd python "d:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py"

<stream><event unbroken="1"><data>{&quot;meta&quot;:{&quot;bucket&quot;:&quot;second&quot;,&quot;bucketsize&quot;:&quot;1&quot;,&quot;tstart&quot;:1528146128316,&quot;tend&quot;:1528146188316,&quot;group&quot;:{&quot;mname&quot;:{&quot;desc&quot;:&quot;Monitor name of measurement&quot;,&quot;type&quot;:&quot;string&quot;,&quot;name&quot;:&quot;Monitor Name&quot;},&quot;monid&quot;:{&quot;desc&quot;:&quot;Slot ID of measurement&quot;,&quot;type&quot;:&quot;number&quot;,&quot;name&quot;:&quot;Slot ID&quot;}},&quot;monid&quot;:[32175486],&quot;metrics&quot;:{&quot;count&quot;:{&quot;desc&quot;:&quot;Number of total hits or datapoints&quot;,&quot;unit&quot;:&quot;number&quot;,&quot;name&quot;:&quot;Total number of hits&quot;},&quot;avail&quot;:{&quot;desc&quot;:&quot;Average Availability of selected Measurements&quot;,&quot;unit&quot;:&quot;%&quot;,&quot;name&quot;:&quot;Availability&quot;},&quot;nwtme&quot;:{&quot;desc&quot;:&quot;Total time of all network traffic measured by the agent&quot;,&quot;unit&quot;:&quot;ms&quot;,&quot;name&quot;:&quot;Total Network time&quot;},&quot;uxtme&quot;:{&quot;desc&quot;:&quot;Full User Experience time as reported by the browser&quot;,&quot;unit&quot;:&quot;ms&quot;,&quot;name&quot;:&quot;User Experience&quot;}},&quot;limit&quot;:100000,&quot;dbtime&quot;:2,&quot;dbname&quot;:&quot;db_dt_wa_raw_7 &quot;,&quot;apiversion&quot;:&quot;61.0.0.201804130656.158053-7&quot;},&quot;data&quot;:[]}</data><done/></event></stream>
Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\Program Files\Splunk\Python-2.7\Lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "D:\Program Files\Splunk\Python-2.7\Lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "d:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py", line 570, in do_run
    checkParamUpdated(req_args_cookies_current,dictParameterToStringFormat(req_args["cookies"]),"cookies")
  File "d:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py", line 611, in checkParamUpdated
    item = service.inputs.__getitem__(STANZA[7:])
  File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 1963, in __getitem__
    for kind in self.kinds:
  File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 2160, in kinds
    return self._get_kind_list()
  File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 2137, in _get_kind_list
    response = self.get('/'.join(subpath))
  File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 681, in get
    **query)
  File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 246, in wrapper
    raise AuthenticationError("Request failed: Session is not logged in.", he)
AuthenticationError: Request failed: Session is not logged in.

As you can see, my target API is returning the data that I requested but I'm getting errors about Authentication or some such. Can I get some help? I am not sure where to turn at this point.

Thanks in advance,
Rcp

0 Karma
Highlighted

Re: Why is my REST Modular API input throwing an error

Ultra Champion

That is a valid error.

You have tried to run the Mod Input's script from the command line so it's Splunk session key (for REST callbacks to SplunkD) has expired.

You would not get that error if you ran the Modular Input inside Splunk.

0 Karma
Highlighted

Re: Why is my REST Modular API input throwing an error

Path Finder

Ok, out of Splunk I am getting these messages:

06-05-2018 08:50:47.919 -0500 ERROR AdminManager - The following required arguments are missing: activation_key.
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py"" Exception in thread Thread-1:
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py"" Traceback (most recent call last):
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\Python-2.7\Lib\threading.py", line 801, in __bootstrap_inner
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     self.run()
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\Python-2.7\Lib\threading.py", line 754, in run
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     self.__target(*self.__args, **self.__kwargs)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py", line 570, in do_run
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     checkParamUpdated(req_args_cookies_current,dictParameterToStringFormat(req_args["cookies"]),"cookies")
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py", line 612, in checkParamUpdated
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     item.update(**{rest_name:current})
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 1904, in update
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     return super(Input, self).update(**kwargs)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 1069, in update
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     self.post(**kwargs)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 929, in post
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     return super(Entity, self).post(path_segment, owner=owner, app=app, sharing=sharing, **query)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\client.py", line 739, in post
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     **query)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 235, in wrapper
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     return request_fun(self, *args, **kwargs)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 61, in new_f
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     val = f(*args, **kwargs)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 648, in post
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     response = self.http.post(path, all_headers, **query)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 1079, in post
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     return self.request(url, message)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""   File "D:\Program Files\Splunk\etc\apps\rest_ta\bin\splunk_sdk-1.0.0-py2.7.egg\splunklib\binding.py", line 1099, in request
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py""     raise HTTPError(response)
06-05-2018 08:50:48.084 -0500 ERROR ExecProcessor - message from "python "D:\Program Files\Splunk\etc\apps\rest_ta\bin\rest.py"" HTTPError: HTTP 400 Bad Request -- The following required arguments are missing: activation_key.

It appears to be an activation_key issue but I have one and have supplied it. What am I missing?

Rcp

0 Karma
Highlighted

Re: Why is my REST Modular API input throwing an error

Ultra Champion

As per the version 1.5.3 release notes , that is addressed.

0 Karma