<?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 How to get Splunk to fetch JSON data from Enphase REST API? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286712#M54752</link>
    <description>&lt;P&gt;Hi All, I'm brand-new to Splunk, just found it...&lt;/P&gt;

&lt;P&gt;Enphase (&lt;A href="http://www.enphase.com"&gt;www.enphase.com&lt;/A&gt;) is a manufacturer of Solar PV Micro-Inverters and associated equipment.  They are one of the more IT friendly manufacturers, and have a REST based API available to query installed equipment/solar installations.  I've just got a new Enphase system installed, and I'd like to see if Splunk can query the data.&lt;/P&gt;

&lt;P&gt;The REST API is detailed here: &lt;A href="https://developer.enphase.com/docs"&gt;https://developer.enphase.com/docs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I've written a curl script to fetch the JSON data from my system, which works OK.&lt;/P&gt;

&lt;P&gt;But can I make Splunk do the HTTP GET request itself, and schedule that?&lt;/P&gt;

&lt;P&gt;Or do I have to get curl to do it, schedule a task, and get Splunk to read the file?&lt;/P&gt;

&lt;P&gt;Thanks for any advice!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Apr 2016 06:33:38 GMT</pubDate>
    <dc:creator>emdeex</dc:creator>
    <dc:date>2016-04-08T06:33:38Z</dc:date>
    <item>
      <title>How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286712#M54752</link>
      <description>&lt;P&gt;Hi All, I'm brand-new to Splunk, just found it...&lt;/P&gt;

&lt;P&gt;Enphase (&lt;A href="http://www.enphase.com"&gt;www.enphase.com&lt;/A&gt;) is a manufacturer of Solar PV Micro-Inverters and associated equipment.  They are one of the more IT friendly manufacturers, and have a REST based API available to query installed equipment/solar installations.  I've just got a new Enphase system installed, and I'd like to see if Splunk can query the data.&lt;/P&gt;

&lt;P&gt;The REST API is detailed here: &lt;A href="https://developer.enphase.com/docs"&gt;https://developer.enphase.com/docs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I've written a curl script to fetch the JSON data from my system, which works OK.&lt;/P&gt;

&lt;P&gt;But can I make Splunk do the HTTP GET request itself, and schedule that?&lt;/P&gt;

&lt;P&gt;Or do I have to get curl to do it, schedule a task, and get Splunk to read the file?&lt;/P&gt;

&lt;P&gt;Thanks for any advice!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2016 06:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286712#M54752</guid>
      <dc:creator>emdeex</dc:creator>
      <dc:date>2016-04-08T06:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286713#M54753</link>
      <description>&lt;P&gt;Hi there!&lt;/P&gt;

&lt;P&gt;Funny you should ask, as I just started playing on this use case -- Splunking data from my Enphase system.  The easiest way I know of to do what we want is to use the REST API Modular Input App -- see &lt;A href="https://splunkbase.splunk.com/app/1546/#/details" target="_blank"&gt;https://splunkbase.splunk.com/app/1546/#/details&lt;/A&gt; for details.&lt;/P&gt;

&lt;P&gt;This will add a new data input method (you can browse from Settings -&amp;gt; Data -&amp;gt; Data Inputs) that provides a nice, simple UI for building the query. No need for curl scripts and cron jobs &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  &lt;/P&gt;

&lt;P&gt;In my testing, I'm using the Enphase "stats" API call. Because Enphase wants time in epoch, you'll want to tweak the app's token.py ($SPLUNK_HOME/etc/apps/rest_ta/bin/token.py) to add a token for the current time (or some variant thereof, such as current time minus 5 minutes (the interval that Enphase supports for the stats command)) . In my case, I added the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; import calendar 
 def epochdate():
     # UTC format: timenow = datetime.datetime.utcnow()
     timenow = datetime.datetime.now()
     return calendar.timegm(timenow.timetuple())
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Using "calendar" is the cleanest way I've found so far to do the conversion.  I can then use the %epochdate% token in my config.&lt;/P&gt;

&lt;P&gt;I am eager to hear how you fare with this project!&lt;/P&gt;

&lt;P&gt;Happy Splunking!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:55:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286713#M54753</guid>
      <dc:creator>mnatkin_splunk</dc:creator>
      <dc:date>2020-09-29T10:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286714#M54754</link>
      <description>&lt;P&gt;It occurred to me that not everyone will be up on how to get going with API access for Enphase...&lt;/P&gt;

&lt;P&gt;For those of you who are interested in this integration, be advised that there are a few steps required in order to enable API access:&lt;/P&gt;

&lt;P&gt;0) Make sure API access is allowed and you've documented both your API username and your system ID.&lt;BR /&gt;
 - Navigate to &lt;A href="https://enlighten.enphaseenergy.com"&gt;https://enlighten.enphaseenergy.com&lt;/A&gt;, log in, then access the "Settings" by clicking on the down arrow next to your name&lt;BR /&gt;
 - You'll see your API ID under "API Settings"&lt;BR /&gt;
 - Your system ID is most easily distinguised in the URL that is presented to you when you log in...  &lt;A href="https://enlighten.enphaseenergy.com/pv/systems/%7BSYSTEM_ID%7D/overview"&gt;https://enlighten.enphaseenergy.com/pv/systems/{SYSTEM_ID}/overview&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;1) Navigate to &lt;A href="https://developer.enphase.com/docs/quickstart.html"&gt;https://developer.enphase.com/docs/quickstart.html&lt;/A&gt; for a brief overview of the API integration and operation&lt;BR /&gt;
2) Open a Developer Account by registering at &lt;A href="https://developer.enphase.com/signup"&gt;https://developer.enphase.com/signup&lt;/A&gt;&lt;BR /&gt;
3) Define the "Application" on the Enphase site (in order to generate an App Key): &lt;A href="https://developer.enphase.com/admin/applications"&gt;https://developer.enphase.com/admin/applications&lt;/A&gt;&lt;BR /&gt;
 - You'll need to define the app tier you wish to use -- "Watt" is the free tier, allowing for up to 10k hits per month&lt;BR /&gt;
4) Activate the app by navigating to the link provided when you define the app &lt;BR /&gt;
5) Document the app key along with your API user ID&lt;BR /&gt;
6) Test from the CLI before defining the REST API input&lt;BR /&gt;
 - From the CLI of your Splunk instance, run a simple curl, such as: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -v "https://api.enphaseenergy.com/api/v2/systems/{SYSTEM_ID}/summary?key={MY_APP_KEY}&amp;amp;user_id={MY_USER_ID}"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should return an HTTP 1.1/200 response with JSON-formatted payload&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2016 17:51:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286714#M54754</guid>
      <dc:creator>mnatkin_splunk</dc:creator>
      <dc:date>2016-09-09T17:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286715#M54755</link>
      <description>&lt;P&gt;This might also assist: &lt;A href="https://splunkbase.splunk.com/app/2962"&gt;https://splunkbase.splunk.com/app/2962&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2016 17:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286715#M54755</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2016-09-12T17:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286716#M54756</link>
      <description>&lt;P&gt;Thanks for the help above...&lt;/P&gt;

&lt;P&gt;I had a hack with it today, and using the REST API Modular Input, got it to query the Envoy-S every 60 seconds.&lt;/P&gt;

&lt;P&gt;I found a good collection of JSON info on the Envoy-S device at the URL: &lt;A href="http://192.168.1.100/production.json"&gt;http://192.168.1.100/production.json&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;There's a lot of info in there... (voltages, power, energy, power factor) ...so far I've only got basic stuff displaying... but it looks promising... the Envoy-S has consumption and production monitoring (and battery storage if you have it)...&lt;/P&gt;

&lt;P&gt;I'd like to make a wall-mounted display of a similar dashboard eventually.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1223iC7A420C2705A021B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2016 05:54:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286716#M54756</guid>
      <dc:creator>emdeex</dc:creator>
      <dc:date>2016-11-26T05:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get Splunk to fetch JSON data from Enphase REST API?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286717#M54757</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;Not sure if you are still watching this post, but wondering if you might be able to share some of your inputs / props file details??&lt;/P&gt;

&lt;P&gt;I've managed to use what you have shared so far to get to the point where I can connect and get data into Splunk from my enhpase system, but it's not in a usable state atm and struggling to get it to that point.&lt;/P&gt;

&lt;P&gt;Appreciate anything you are willing to share.&lt;/P&gt;

&lt;P&gt;Main issues I'm having atm are:  &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;specifying the time range that I want to collect&lt;/LI&gt;
&lt;LI&gt;Splitting the response into time blocks&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 11 Feb 2019 03:11:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-get-Splunk-to-fetch-JSON-data-from-Enphase-REST-API/m-p/286717#M54757</guid>
      <dc:creator>kozanic_FF</dc:creator>
      <dc:date>2019-02-11T03:11:26Z</dc:date>
    </item>
  </channel>
</rss>

