<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Splunk Metric Catalog REST API not returning data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444476#M77367</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Im a beginner in Splunk. For an integration, Im trying to access the metric data available in Splunk using REST API.&lt;/P&gt;

&lt;P&gt;when I try the below mentioned URI im not getting any data returned (Just getting a link to the acl)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;https://&amp;lt;host&amp;gt;:&amp;lt;mPort&amp;gt;/services/catalog/metricstore/metrics
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Im authorizing as a user with &lt;STRONG&gt;list_metrics_catalog&lt;/STRONG&gt; capability. Please find the acl permissions for the specified REST URL in my instance below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app- system
can_change_perms-1
can_list-1
can_share_app-1
can_share_global-1
can_share_user-0
can_write-1
modifiable-1
owner - nobody
perms
read - *
write  - admin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using mstats , im able to view the metric data in SPlunk UI but I want to access it through REST API. &lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 22:27:54 GMT</pubDate>
    <dc:creator>nkarthick2511</dc:creator>
    <dc:date>2020-09-29T22:27:54Z</dc:date>
    <item>
      <title>Splunk Metric Catalog REST API not returning data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444476#M77367</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Im a beginner in Splunk. For an integration, Im trying to access the metric data available in Splunk using REST API.&lt;/P&gt;

&lt;P&gt;when I try the below mentioned URI im not getting any data returned (Just getting a link to the acl)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;https://&amp;lt;host&amp;gt;:&amp;lt;mPort&amp;gt;/services/catalog/metricstore/metrics
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Im authorizing as a user with &lt;STRONG&gt;list_metrics_catalog&lt;/STRONG&gt; capability. Please find the acl permissions for the specified REST URL in my instance below,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;app- system
can_change_perms-1
can_list-1
can_share_app-1
can_share_global-1
can_share_user-0
can_write-1
modifiable-1
owner - nobody
perms
read - *
write  - admin
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using mstats , im able to view the metric data in SPlunk UI but I want to access it through REST API. &lt;/P&gt;

&lt;P&gt;Please help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:27:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444476#M77367</guid>
      <dc:creator>nkarthick2511</dc:creator>
      <dc:date>2020-09-29T22:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Metric Catalog REST API not returning data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444477#M77368</link>
      <description>&lt;P&gt;Hi nkarthick2511!&lt;/P&gt;

&lt;P&gt;What index is the data in?&lt;/P&gt;

&lt;P&gt;Just be sure that the user making the rest call has access to the indexes where the data resides, or use a filter that looks for the proper indexes in the api call&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTREF/RESTmetrics#Default_indexes_for_Metrics_Catalog_endpoints"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTREF/RESTmetrics#Default_indexes_for_Metrics_Catalog_endpoints&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTREF/RESTprolog#Request_and_response_details"&gt;https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTREF/RESTprolog#Request_and_response_details&lt;/A&gt;&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;If no metric indexes are defined with&lt;BR /&gt;
the filter parameter, Metrics Catalog&lt;BR /&gt;
endpoints use the default indexes&lt;BR /&gt;
specified for the role of the user. To&lt;BR /&gt;
review or update the default indexes&lt;BR /&gt;
for specific roles, select Settings &amp;gt;&lt;BR /&gt;
Access controls &amp;gt; Roles, select a&lt;BR /&gt;
role, and review or update the Indexes&lt;BR /&gt;
searched by default field.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;FWIW, Here's how I have been playing with the API lately. &lt;/P&gt;

&lt;P&gt;First, I am working from my Splunk cli with curl and &lt;A href="https://stedolan.github.io/jq/"&gt;jq&lt;/A&gt; installed on Linux and am calling &lt;CODE&gt;splunkd&lt;/CODE&gt; on &lt;CODE&gt;localhost&lt;/CODE&gt;with my &lt;CODE&gt;admin&lt;/CODE&gt; account. If you curl with your admin account, do you see the metrics listed?&lt;/P&gt;

&lt;P&gt;I'll curl with silent &lt;CODE&gt;-s&lt;/CODE&gt; and insecure &lt;CODE&gt;-k&lt;/CODE&gt; with my splunk credentials &lt;CODE&gt;-u admin:password&lt;/CODE&gt; and output as json &lt;CODE&gt;?"output_mode=json"&lt;/CODE&gt;, then stuff it through jq to just get the &lt;CODE&gt;metric_name&lt;/CODE&gt; from the json payload. See &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTUM/RESTusing#Encoding_schemes"&gt;API docs&lt;/A&gt; for more &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -sk -u admin:helloworld &lt;A href="https://localhost:8089/services/catalog/metricstore/metrics?&amp;quot;output_mode=json&amp;quot;" target="test_blank"&gt;https://localhost:8089/services/catalog/metricstore/metrics?"output_mode=json"&lt;/A&gt;; | jq .entry[].name
"kube.cluster.cpu.limit"
"kube.cluster.cpu.request"
"kube.cluster.cpu.usage_rate"
"kube.cluster.memory.limit"
"kube.cluster.memory.request"
"kube.cluster.memory.usage"
"kube.container.cpu.limit"
"kube.container.cpu.request"
"kube.container.cpu.usage"
"kube.container.cpu.usage_rate"
"kube.container.disk.io_read_bytes"
"kube.container.disk.io_read_bytes_rate"
"kube.container.disk.io_write_bytes"
"kube.container.disk.io_write_bytes_rate"
"kube.container.filesystem.available"
"kube.container.filesystem.limit"
"kube.container.filesystem.usage"
"kube.container.memory.cache"
"kube.container.memory.limit"
"kube.container.memory.major_page_faults"
"kube.container.memory.major_page_faults_rate"
"kube.container.memory.page_faults"
"kube.container.memory.page_faults_rate"
"kube.container.memory.request"
"kube.container.memory.rss"
"kube.container.memory.usage"
"kube.container.memory.working_set"
"kube.container.restart_count"
"kube.container.uptime"
"kube.namespace.cpu.limit"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I find this preferable to messing with xml but check the &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.2.1/RESTUM/RESTusing#Encoding_schemes"&gt;API Reference&lt;/A&gt; because not all endpoints support all encoding, as this command will require you to have to parse the returned xml for the entity.title tags, although I am sure there are ways out there to handle that, like I did they json with jq:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...truncated for brevity
    &amp;lt;title&amp;gt;kube.cluster.cpu.request&amp;lt;/title&amp;gt;
    &amp;lt;id&amp;gt;https://localhost:8089/services/catalog/metricstore/metrics/kube.cluster.cpu.request&amp;lt;/id&amp;gt;
    &amp;lt;updated&amp;gt;1970-01-01T00:00:00+00:00&amp;lt;/updated&amp;gt;
    &amp;lt;link href="/services/catalog/metricstore/metrics/kube.cluster.cpu.request" rel="alternate"/&amp;gt;
    &amp;lt;author&amp;gt;
      &amp;lt;name&amp;gt;system&amp;lt;/name&amp;gt;
    &amp;lt;/author&amp;gt;
    &amp;lt;link href="/services/catalog/metricstore/metrics/kube.cluster.cpu.request" rel="list"/&amp;gt;
    &amp;lt;content type="text/xml"&amp;gt;
      &amp;lt;s:dict&amp;gt;
        &amp;lt;s:key name="eai:acl"&amp;gt;
          &amp;lt;s:dict&amp;gt;
            &amp;lt;s:key name="app"&amp;gt;&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="can_list"&amp;gt;1&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="can_write"&amp;gt;1&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="modifiable"&amp;gt;0&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="owner"&amp;gt;system&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="perms"&amp;gt;
              &amp;lt;s:dict&amp;gt;
                &amp;lt;s:key name="read"&amp;gt;
                  &amp;lt;s:list&amp;gt;
                    &amp;lt;s:item&amp;gt;admin&amp;lt;/s:item&amp;gt;
                    &amp;lt;s:item&amp;gt;power&amp;lt;/s:item&amp;gt;
                    &amp;lt;s:item&amp;gt;splunk-system-role&amp;lt;/s:item&amp;gt;
                    &amp;lt;s:item&amp;gt;user&amp;lt;/s:item&amp;gt;
                  &amp;lt;/s:list&amp;gt;
                &amp;lt;/s:key&amp;gt;
                &amp;lt;s:key name="write"&amp;gt;
                  &amp;lt;s:list/&amp;gt;
                &amp;lt;/s:key&amp;gt;
              &amp;lt;/s:dict&amp;gt;
            &amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="removable"&amp;gt;0&amp;lt;/s:key&amp;gt;
            &amp;lt;s:key name="sharing"&amp;gt;system&amp;lt;/s:key&amp;gt;
          &amp;lt;/s:dict&amp;gt;
        &amp;lt;/s:key&amp;gt;
      &amp;lt;/s:dict&amp;gt;
    &amp;lt;/content&amp;gt;
...truncated for brevity
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hopefully this is useful. Let me know how if you figure it out!&lt;/P&gt;</description>
      <pubDate>Sun, 23 Dec 2018 18:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444477#M77368</guid>
      <dc:creator>mattymo</dc:creator>
      <dc:date>2018-12-23T18:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Metric Catalog REST API not returning data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444478#M77369</link>
      <description>&lt;P&gt;Thanks for the response.&lt;BR /&gt;
 Im trying to develop a java script script to access the splunk metrics and load it into ServiceNow for analysis. For that as a first step im using a HTTP tool like POSTMAN and trying to get the results.&lt;/P&gt;

&lt;P&gt;Is there anything I need to change in the URL if im not using CURL. &lt;/P&gt;

&lt;P&gt;I want to see the results decide the parameters need to be passed and then jump on to script development.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Dec 2018 17:20:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Splunk-Metric-Catalog-REST-API-not-returning-data/m-p/444478#M77369</guid>
      <dc:creator>nkarthick2511</dc:creator>
      <dc:date>2018-12-24T17:20:23Z</dc:date>
    </item>
  </channel>
</rss>

