{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Raspberry Pi Import Integration","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"raspberry-pi-import-integration","__idx":0},"children":["Raspberry Pi Import Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.raspberrypi.org/"},"children":["Raspberry Pi"]}," is a credit-card-sized single-board computer. Because it is low-cost and easy to equip with various types of sensors, using Raspberry Pi as a cloud data logger is one of its ideal use cases."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can import sensor data from Raspberry Pi into Treasure Data."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"install-raspbian","__idx":1},"children":["Install Raspbian"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.raspbian.org/"},"children":["Raspbian"]}," is a free operating system based on Debian, optimized for the Raspberry Pi. Install Raspbian on your Raspberry Pi by following the instructions in the blog post below:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.andrewmunsell.com/blog/getting-started-raspberry-pi-install-raspbian"},"children":["Getting Started with Raspberry Pi: Installing Raspbian"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"install-treasure-agent-fluentd","__idx":2},"children":["Install Treasure Agent (Fluentd)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Next, we’ll install Treasure Agent (Fluentd) on Raspbian. Raspbian bundles Ruby 1.9.3 by default, but we need the extra development packages."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ sudo aptitude install ruby-dev\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We’ll now install Treasure Agent (Fluentd) and the necessary plugins."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ sudo gem install fluentd\n$ sudo fluent-gem install fluent-plugin-td\n\nOr, you can use fluent-bit instead of fluentd. See the detail in the following doc.\nhttp://fluentbit.io/documentation/0.12/installation/raspberry_pi.html\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"configure-and-launch-treasure-agent","__idx":3},"children":["Configure and Launch Treasure Agent"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/users/sign_in"},"children":["Sign into your Treasure account"]},". You can get your account’s API key from the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/users/current"},"children":["users page"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prepare the fluent.conf file with the following information, including your API key."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"<match td.*.*>\n  type tdlog\n  apikey YOUR_API_KEY_HERE\n\n  auto_create_table\n  buffer_type file\n  buffer_path /home/pi/td\n</match>\nsource\n  type http\n  port 8888\n</source>\nsource\n  type forward\n</source>\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Finally, launch Treasure Agent (Fluentd) via your terminal."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ fluentd -c fluent.conf\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"upload-test","__idx":4},"children":["Upload Test"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To test the configuration, just post a JSON message to Treasure Agent via HTTP."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ curl -X POST -d 'json={\"sensor1\":3123.13,\"sensor2\":321.3}' \\\n  http://localhost:8888/td.testdb.raspberrypi\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you're using Python, you can use python logger library."," ","Now, access the databases page to confirm that your data has been uploaded to the cloud properly."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/databases"},"children":["Treasure Data: List of Databases"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can now issue queries against the imported data."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/query_forms/new"},"children":["Treasure Data: New Query"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example, these queries calculate the average sensor1 value and the sum of sensor2 values."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"SELECT AVG(sensor1) FROM raspberrypi;\nSELECT SUM(sensor2) FROM raspberrypi;\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"conclusion","__idx":5},"children":["Conclusion"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Raspberry Pi is an ideal platform for prototyping data logger hardware. By combining Raspberry Pi and Treasure Data, we can easily analyze the physical world in the cloud."]}]},"headings":[{"value":"Raspberry Pi Import Integration","id":"raspberry-pi-import-integration","depth":1},{"value":"Install Raspbian","id":"install-raspbian","depth":1},{"value":"Install Treasure Agent (Fluentd)","id":"install-treasure-agent-fluentd","depth":1},{"value":"Configure and Launch Treasure Agent","id":"configure-and-launch-treasure-agent","depth":1},{"value":"Upload Test","id":"upload-test","depth":1},{"value":"Conclusion","id":"conclusion","depth":1}],"frontmatter":{"seo":{"title":"Raspberry Pi Import Integration"}},"lastModified":"2026-06-01T09:09:59.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/raspberry-pi-import-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}