SlideShare une entreprise Scribd logo
1  sur  37
Télécharger pour lire hors ligne
Presented by: Sebastian Spaink
Layer by Layer:
Printing your own external
input plugin for Telegraf
© 2021 InfluxData. All rights reserved. 2
• My Name: Sebastian Spaink
• Team: Data Acquisition
• Quarantine Craft: 3D printing
| Introduction
3D printed Gopher!
© 2021 InfluxData. All rights reserved. 3
• Share how AWESOME external plugins are in Telegraf!
• Give you the knowledge you need to make your own!
| Goal?
© 2021 InfluxData. All rights reserved. 4
1. What and Why of external plugins
2. Show basic example
3. Walkthrough practical example
4. How to start with a new language?
| Overview
© 2021 InfluxData. All rights reserved. 5
● Telegraf: The plugin-driven agent for collecting & reporting metrics
● Hundreds of internal plugins included!
| Overview of Telegraf and its plugins
© 2021 InfluxData. All rights reserved. 6
Definition: An external plugin is a program outside of Telegraf that
can communicate and be run by a Telegraf plugin called execd
● There is a execd plugin for: input, processor, output
● Communicates through STDOUT with supported data format
External Plugins:
https:/
/github.com/influxdata/telegraf/blob/master/EXTERNAL_PLUGINS.md
| What is an external plugin?
© 2021 InfluxData. All rights reserved. 7
• Benefits:
– Create a plugin that covers your unique use case
– Begin using it immediately
– Write it in any language, not limited to Go
| Why would you want to make one?
For example a external plugin written in Python:
• https:/
/github.com/jhpope/smc_ipmi
© 2021 InfluxData. All rights reserved. 8
| Keep it simple, a basic example
Straight from the README:
https:/
/github.com/influxdata/telegraf/tree/master/pl
ugins/inputs/execd#daemon-written-in-bash-using-st
din-signaling
A simple bash script that blocks, waiting for
input from STDIN, incrementing a counter.
Done. You have an external plugin!
© 2021 InfluxData. All rights reserved. 9
| Configure it with Telegraf
Telegraf Config
© 2021 InfluxData. All rights reserved. 10
PLACEHOLDER FOR OUTPUT
ANIMATION
© 2021 InfluxData. All rights reserved. 11
| Signals accepted by execd plugin
● "none" : Do not signal anything. (Recommended for service
inputs) The process must output metrics by itself.
● "STDIN" : Send a newline on STDIN. (Recommended for gather
inputs)
● “SIGHUP" : Send a HUP signal. Not available on Windows. (not
recommended)
● "SIGUSR1" : Send a USR1 signal. Not available on Windows.
● "SIGUSR2" : Send a USR2 signal. Not available on Windows.
© 2021 InfluxData. All rights reserved. 12
| Getting started with a practical example
● Octoprint: open source 3D printer controller application,
which provides a web interface for the connected printers
● Information you can get:
○ Printing state: paused or ready
○ Current temperature of nozzle/printing bed
● All you need is an API to make an input plugin!
© 2021 InfluxData. All rights reserved. 13
| Easy start to an external plugin, the Go Shim
● The Telegraf execd Go shim is a great way to start!
● A scaffolding created to make plugins as if they were in Telegraf
○ Provides same structures used in the internal project
○ Provides logic to interact with the execd plugin
© 2021 InfluxData. All rights reserved. 14
| Go Shim Versus Execd Plugin
● Go Shim: A utility tool to help start external plugins
● Execd Plugin: A Telegraf plugin to manage external plugins
Go Shim Execd Plugin Telegraf
© 2021 InfluxData. All rights reserved. 15
Get the main.go from the examples/cmd directory and
place it in your project.
Then you just need to edit the file to import the package
containing your plugin code, such as so:
| Quick step overview to use Go shim
Reference link:
https:/
/github.com/influxdata/telegraf/tree/master/plugins/common/shim
© 2021 InfluxData. All rights reserved. 16
| Gather the data
Screenshot #1 Screenshot #2
© 2021 InfluxData. All rights reserved. 17
| Custom configuration
● Optionally, you can create a separate config file for your
external plugin
● It is required this config is completely separate from the main
config and lives in another directory
© 2021 InfluxData. All rights reserved. 18
| Configuring the Octoprint plugin with Telegraf
1. Build the external plugin you’ve made to an executable binary
2. Then update the main Telegraf config such as below:
Note: The signal is set to “none” instead of “STDIN”
● The execd Go shim has a default polling interval of 1 second
○ can be adjusted by passing the flag poll_interval
© 2021 InfluxData. All rights reserved. 19
PLACEHOLDER FOR ANIMATION
© 2021 InfluxData. All rights reserved. 20
| Temperature data!
Nozzle
Build Plate
© 2021 InfluxData. All rights reserved. 21
| Extend Octoprint with plugins!
● Not Telegraf plugins, but different plugins!
● Display Layer Progress
○ https:/
/plugins.octoprint.org/plugins/DisplayLayerProgress/
● Filament Manager
○ https:/
/plugins.octoprint.org/plugins/filamentmanager/
© 2021 InfluxData. All rights reserved. 22
| Display Layer Progress
● This plugin displays the current layer being printed!
● Fun to know and helpful!
© 2021 InfluxData. All rights reserved. 23
| Display Layer Progress
● New API endpoint: /plugin/DisplayLayerProgress/values
© 2021 InfluxData. All rights reserved. 24
| Filament Manager
● To get the filament data we need a postgres database!
© 2021 InfluxData. All rights reserved. 25
| Filament Manager
© 2021 InfluxData. All rights reserved. 26
| Demo Time!
© 2021 InfluxData. All rights reserved. 27
PLACEHOLDER FOR ANIMATION
© 2021 InfluxData. All rights reserved. 28
| End result!
© 2021 InfluxData. All rights reserved. 29
| Overview Components
inputs.execd outputs.influxdb_v2
Octoprint external plugin
Telegraf
API
Display Layer
Progress API
Filament
Manager
Postgres DB
Octoprint
InfluxDB 2.0
© 2021 InfluxData. All rights reserved. 30
| Try it for yourself!
● Source Code: https:/
/github.com/sspaink/octoprint-telegraf-plugin
● Feel free to make a pull request with changes!
© 2021 InfluxData. All rights reserved. 31
| Creating your own plugin
● With the structure defined, the rest is just regular fun coding!
● Tip: Following the plugin guidelines are a great way to work!
○ when external, they are more “guidelines” then actual rules…
Guidelines:
● https:/
/github.com/influxdata/telegraf/blob/master/docs/INPUTS.md
● https:/
/github.com/influxdata/telegraf/blob/master/docs/PROCESSORS.md
● https:/
/github.com/influxdata/telegraf/blob/master/docs/OUTPUTS.md
© 2021 InfluxData. All rights reserved. 32
• No shim?!?! What to do!
• Let’s try to re-implement the octoprint plugin in Rust!
| What if I want to use a different language?
© 2021 InfluxData. All rights reserved. 33
| Let’s try to implement octoprint plugin in Rust!
Output in influxdb line protocol
Loop in one second intervals
Set configuration
Gather data
© 2021 InfluxData. All rights reserved. 34
| demo placeholder
© 2021 InfluxData. All rights reserved. 35
| What about outputs and processors?
Output Example: https:/
/github.com/morfien101/telegraf-output-kinesis
Processor Example: https:/
/github.com/a-bali/telegraf-geoip
© 2021 InfluxData. All rights reserved. 36
• Filter issues/pr’s by the label external plugin
• Suid input plugin: https:/
/github.com/influxdata/telegraf/pull/7597
• Libvirt input plugin: https:/
/github.com/influxdata/telegraf/issues/690
• Jira input plugin: https:/
/github.com/influxdata/telegraf/pull/4944
| Need ideas?
© 2021 InfluxData. All rights reserved. 37
Thank you for watching! I hope you learned something.
I look forward to seeing any external plugins you might make!
If you do make one, please share it by making a pull request to
update the EXTERNAL_PLUGINS.md doc in the Telegraf project!

Contenu connexe

Tendances

Tendances (20)

InfluxDB + Telegraf Operator: Easy Kubernetes Monitoring
InfluxDB + Telegraf Operator: Easy Kubernetes MonitoringInfluxDB + Telegraf Operator: Easy Kubernetes Monitoring
InfluxDB + Telegraf Operator: Easy Kubernetes Monitoring
 
InfluxDB Cloud Product Update
InfluxDB Cloud Product Update InfluxDB Cloud Product Update
InfluxDB Cloud Product Update
 
Alan Pope, Sebastian Spaink [InfluxData] | Data Collection 101 | InfluxDays N...
Alan Pope, Sebastian Spaink [InfluxData] | Data Collection 101 | InfluxDays N...Alan Pope, Sebastian Spaink [InfluxData] | Data Collection 101 | InfluxDays N...
Alan Pope, Sebastian Spaink [InfluxData] | Data Collection 101 | InfluxDays N...
 
Jacob Marble [InfluxData] | Observability with InfluxDB IOx and OpenTelemetry...
Jacob Marble [InfluxData] | Observability with InfluxDB IOx and OpenTelemetry...Jacob Marble [InfluxData] | Observability with InfluxDB IOx and OpenTelemetry...
Jacob Marble [InfluxData] | Observability with InfluxDB IOx and OpenTelemetry...
 
How to Monitor Your Gaming Computer with a Time Series Database
 How to Monitor Your Gaming Computer with a Time Series Database How to Monitor Your Gaming Computer with a Time Series Database
How to Monitor Your Gaming Computer with a Time Series Database
 
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021
Evan Kaplan [InfluxData] | InfluxDays Opening Remarks | InfluxDays EMEA 2021
 
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
Introduction to InfluxDB 2.0 & Your First Flux Query by Sonia Gupta, Develope...
 
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
How to Store and Visualize CAN Bus Telematic Data with InfluxDB Cloud and Gra...
 
How to Create a Modern IIoT Monitoring Solution On iOS Using Swift, MQTT and ...
How to Create a Modern IIoT Monitoring Solution On iOS Using Swift, MQTT and ...How to Create a Modern IIoT Monitoring Solution On iOS Using Swift, MQTT and ...
How to Create a Modern IIoT Monitoring Solution On iOS Using Swift, MQTT and ...
 
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays EMEA 2021
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays EMEA 2021Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays EMEA 2021
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays EMEA 2021
 
Dominik Obermaier and Anja Helmbrecht-Schaar [HiveMQ] | IIoT Monitoring with ...
Dominik Obermaier and Anja Helmbrecht-Schaar [HiveMQ] | IIoT Monitoring with ...Dominik Obermaier and Anja Helmbrecht-Schaar [HiveMQ] | IIoT Monitoring with ...
Dominik Obermaier and Anja Helmbrecht-Schaar [HiveMQ] | IIoT Monitoring with ...
 
Giacomo Tirabassi [InfluxData] | Istio at InfluxData | InfluxDays Virtual Exp...
Giacomo Tirabassi [InfluxData] | Istio at InfluxData | InfluxDays Virtual Exp...Giacomo Tirabassi [InfluxData] | Istio at InfluxData | InfluxDays Virtual Exp...
Giacomo Tirabassi [InfluxData] | Istio at InfluxData | InfluxDays Virtual Exp...
 
Brian Gilmore [InfluxData] | InfluxDB in an IoT Application Architecture | In...
Brian Gilmore [InfluxData] | InfluxDB in an IoT Application Architecture | In...Brian Gilmore [InfluxData] | InfluxDB in an IoT Application Architecture | In...
Brian Gilmore [InfluxData] | InfluxDB in an IoT Application Architecture | In...
 
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021
Michael Hall [InfluxData] | InfluxDB Community Update | InfluxDays EMEA 2021
 
Marina Svicevic, Milos Pavkovic, Mladen Maric, Vijeta Hingorani [Socialgist] ...
Marina Svicevic, Milos Pavkovic, Mladen Maric, Vijeta Hingorani [Socialgist] ...Marina Svicevic, Milos Pavkovic, Mladen Maric, Vijeta Hingorani [Socialgist] ...
Marina Svicevic, Milos Pavkovic, Mladen Maric, Vijeta Hingorani [Socialgist] ...
 
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
Paul Dix [InfluxData] | InfluxDays Opening Keynote | InfluxDays Virtual Exper...
 
Ana-Maria Calin [InfluxData] | Migrating from OSS to InfluxDB Cloud | InfluxD...
Ana-Maria Calin [InfluxData] | Migrating from OSS to InfluxDB Cloud | InfluxD...Ana-Maria Calin [InfluxData] | Migrating from OSS to InfluxDB Cloud | InfluxD...
Ana-Maria Calin [InfluxData] | Migrating from OSS to InfluxDB Cloud | InfluxD...
 
Nicolas Steinmetz [CérénIT] | Sustain Your Observability from Bare Metal TICK...
Nicolas Steinmetz [CérénIT] | Sustain Your Observability from Bare Metal TICK...Nicolas Steinmetz [CérénIT] | Sustain Your Observability from Bare Metal TICK...
Nicolas Steinmetz [CérénIT] | Sustain Your Observability from Bare Metal TICK...
 
InfluxData Architecture for IoT | Noah Crowley | InfluxData
InfluxData Architecture for IoT | Noah Crowley | InfluxDataInfluxData Architecture for IoT | Noah Crowley | InfluxData
InfluxData Architecture for IoT | Noah Crowley | InfluxData
 
Tim Hall [InfluxData] | InfluxDays Keynote: InfluxDB Roadmap | InfluxDays NA ...
Tim Hall [InfluxData] | InfluxDays Keynote: InfluxDB Roadmap | InfluxDays NA ...Tim Hall [InfluxData] | InfluxDays Keynote: InfluxDB Roadmap | InfluxDays NA ...
Tim Hall [InfluxData] | InfluxDays Keynote: InfluxDB Roadmap | InfluxDays NA ...
 

Similaire à Sebastian Spaink [InfluxData] | Layer by Layer: Printing Your Own External Input Plugin for Telegraf | InfluxDays EMEA 2021

Encode x ICH: Intro to Building on the IC in Motoko
Encode x ICH: Intro to Building on the IC in MotokoEncode x ICH: Intro to Building on the IC in Motoko
Encode x ICH: Intro to Building on the IC in Motoko
KlaraOrban
 
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
Edge AI and Vision Alliance
 

Similaire à Sebastian Spaink [InfluxData] | Layer by Layer: Printing Your Own External Input Plugin for Telegraf | InfluxDays EMEA 2021 (20)

Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021Getting Started: Intro to Telegraf - July 2021
Getting Started: Intro to Telegraf - July 2021
 
How to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin EcosystemHow to Use Telegraf and Its Plugin Ecosystem
How to Use Telegraf and Its Plugin Ecosystem
 
Anais Dotis-Georgiou & Steven Soroka [InfluxData] | Machine Learning with Tel...
Anais Dotis-Georgiou & Steven Soroka [InfluxData] | Machine Learning with Tel...Anais Dotis-Georgiou & Steven Soroka [InfluxData] | Machine Learning with Tel...
Anais Dotis-Georgiou & Steven Soroka [InfluxData] | Machine Learning with Tel...
 
Amora: A mobile remote assistant
Amora: A mobile remote assistantAmora: A mobile remote assistant
Amora: A mobile remote assistant
 
OSMC 2019 | The Telegraf Toolbelt: It Can Do That, Really? by David McKay
OSMC 2019 | The Telegraf Toolbelt: It Can Do That, Really? by David McKayOSMC 2019 | The Telegraf Toolbelt: It Can Do That, Really? by David McKay
OSMC 2019 | The Telegraf Toolbelt: It Can Do That, Really? by David McKay
 
Ryan Betts [InfluxData] | Influxdays Keynote: Engineering Update | InfluxDays...
Ryan Betts [InfluxData] | Influxdays Keynote: Engineering Update | InfluxDays...Ryan Betts [InfluxData] | Influxdays Keynote: Engineering Update | InfluxDays...
Ryan Betts [InfluxData] | Influxdays Keynote: Engineering Update | InfluxDays...
 
Introduction to Vijeo Citect
Introduction to Vijeo CitectIntroduction to Vijeo Citect
Introduction to Vijeo Citect
 
Encode x ICH: Intro to Building on the IC in Motoko
Encode x ICH: Intro to Building on the IC in MotokoEncode x ICH: Intro to Building on the IC in Motoko
Encode x ICH: Intro to Building on the IC in Motoko
 
InfluxDB Live Product Training
InfluxDB Live Product TrainingInfluxDB Live Product Training
InfluxDB Live Product Training
 
Dektec
DektecDektec
Dektec
 
Simplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual CloudSimplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual Cloud
 
Node-RED Installer, Standalone Installer using Electron
Node-RED Installer, Standalone Installer using ElectronNode-RED Installer, Standalone Installer using Electron
Node-RED Installer, Standalone Installer using Electron
 
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
“TensorFlow Lite for Microcontrollers (TFLM): Recent Developments,” a Present...
 
Cloud Conf 2015 - Develop and Deploy IOT Applications
Cloud Conf 2015 - Develop and Deploy IOT ApplicationsCloud Conf 2015 - Develop and Deploy IOT Applications
Cloud Conf 2015 - Develop and Deploy IOT Applications
 
Amora
AmoraAmora
Amora
 
GUI Programming using Tkinter-converted.pptx
GUI Programming using Tkinter-converted.pptxGUI Programming using Tkinter-converted.pptx
GUI Programming using Tkinter-converted.pptx
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016
 
How OpenShift SDN helps to automate
How OpenShift SDN helps to automateHow OpenShift SDN helps to automate
How OpenShift SDN helps to automate
 
Write your own telegraf plugin
Write your own telegraf pluginWrite your own telegraf plugin
Write your own telegraf plugin
 
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
Inject the Web into your GStreamer pipeline with WPE using a GStreamer/WebKit...
 

Plus de InfluxData

How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 

Plus de InfluxData (20)

Announcing InfluxDB Clustered
Announcing InfluxDB ClusteredAnnouncing InfluxDB Clustered
Announcing InfluxDB Clustered
 
Best Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow EcosystemBest Practices for Leveraging the Apache Arrow Ecosystem
Best Practices for Leveraging the Apache Arrow Ecosystem
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
 
Power Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDBPower Your Predictive Analytics with InfluxDB
Power Your Predictive Analytics with InfluxDB
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
 
Build an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING StackBuild an Edge-to-Cloud Solution with the MING Stack
Build an Edge-to-Cloud Solution with the MING Stack
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using RustMeet the Founders: An Open Discussion About Rewriting Using Rust
Meet the Founders: An Open Discussion About Rewriting Using Rust
 
Introducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud DedicatedIntroducing InfluxDB Cloud Dedicated
Introducing InfluxDB Cloud Dedicated
 
Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB Gain Better Observability with OpenTelemetry and InfluxDB
Gain Better Observability with OpenTelemetry and InfluxDB
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...How Delft University's Engineering Students Make Their EV Formula-Style Race ...
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
 
Introducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage EngineIntroducing InfluxDB’s New Time Series Database Storage Engine
Introducing InfluxDB’s New Time Series Database Storage Engine
 
Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena Start Automating InfluxDB Deployments at the Edge with balena
Start Automating InfluxDB Deployments at the Edge with balena
 
Understanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage EngineUnderstanding InfluxDB’s New Storage Engine
Understanding InfluxDB’s New Storage Engine
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDBStreamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Sebastian Spaink [InfluxData] | Layer by Layer: Printing Your Own External Input Plugin for Telegraf | InfluxDays EMEA 2021

  • 1. Presented by: Sebastian Spaink Layer by Layer: Printing your own external input plugin for Telegraf
  • 2. © 2021 InfluxData. All rights reserved. 2 • My Name: Sebastian Spaink • Team: Data Acquisition • Quarantine Craft: 3D printing | Introduction 3D printed Gopher!
  • 3. © 2021 InfluxData. All rights reserved. 3 • Share how AWESOME external plugins are in Telegraf! • Give you the knowledge you need to make your own! | Goal?
  • 4. © 2021 InfluxData. All rights reserved. 4 1. What and Why of external plugins 2. Show basic example 3. Walkthrough practical example 4. How to start with a new language? | Overview
  • 5. © 2021 InfluxData. All rights reserved. 5 ● Telegraf: The plugin-driven agent for collecting & reporting metrics ● Hundreds of internal plugins included! | Overview of Telegraf and its plugins
  • 6. © 2021 InfluxData. All rights reserved. 6 Definition: An external plugin is a program outside of Telegraf that can communicate and be run by a Telegraf plugin called execd ● There is a execd plugin for: input, processor, output ● Communicates through STDOUT with supported data format External Plugins: https:/ /github.com/influxdata/telegraf/blob/master/EXTERNAL_PLUGINS.md | What is an external plugin?
  • 7. © 2021 InfluxData. All rights reserved. 7 • Benefits: – Create a plugin that covers your unique use case – Begin using it immediately – Write it in any language, not limited to Go | Why would you want to make one? For example a external plugin written in Python: • https:/ /github.com/jhpope/smc_ipmi
  • 8. © 2021 InfluxData. All rights reserved. 8 | Keep it simple, a basic example Straight from the README: https:/ /github.com/influxdata/telegraf/tree/master/pl ugins/inputs/execd#daemon-written-in-bash-using-st din-signaling A simple bash script that blocks, waiting for input from STDIN, incrementing a counter. Done. You have an external plugin!
  • 9. © 2021 InfluxData. All rights reserved. 9 | Configure it with Telegraf Telegraf Config
  • 10. © 2021 InfluxData. All rights reserved. 10 PLACEHOLDER FOR OUTPUT ANIMATION
  • 11. © 2021 InfluxData. All rights reserved. 11 | Signals accepted by execd plugin ● "none" : Do not signal anything. (Recommended for service inputs) The process must output metrics by itself. ● "STDIN" : Send a newline on STDIN. (Recommended for gather inputs) ● “SIGHUP" : Send a HUP signal. Not available on Windows. (not recommended) ● "SIGUSR1" : Send a USR1 signal. Not available on Windows. ● "SIGUSR2" : Send a USR2 signal. Not available on Windows.
  • 12. © 2021 InfluxData. All rights reserved. 12 | Getting started with a practical example ● Octoprint: open source 3D printer controller application, which provides a web interface for the connected printers ● Information you can get: ○ Printing state: paused or ready ○ Current temperature of nozzle/printing bed ● All you need is an API to make an input plugin!
  • 13. © 2021 InfluxData. All rights reserved. 13 | Easy start to an external plugin, the Go Shim ● The Telegraf execd Go shim is a great way to start! ● A scaffolding created to make plugins as if they were in Telegraf ○ Provides same structures used in the internal project ○ Provides logic to interact with the execd plugin
  • 14. © 2021 InfluxData. All rights reserved. 14 | Go Shim Versus Execd Plugin ● Go Shim: A utility tool to help start external plugins ● Execd Plugin: A Telegraf plugin to manage external plugins Go Shim Execd Plugin Telegraf
  • 15. © 2021 InfluxData. All rights reserved. 15 Get the main.go from the examples/cmd directory and place it in your project. Then you just need to edit the file to import the package containing your plugin code, such as so: | Quick step overview to use Go shim Reference link: https:/ /github.com/influxdata/telegraf/tree/master/plugins/common/shim
  • 16. © 2021 InfluxData. All rights reserved. 16 | Gather the data Screenshot #1 Screenshot #2
  • 17. © 2021 InfluxData. All rights reserved. 17 | Custom configuration ● Optionally, you can create a separate config file for your external plugin ● It is required this config is completely separate from the main config and lives in another directory
  • 18. © 2021 InfluxData. All rights reserved. 18 | Configuring the Octoprint plugin with Telegraf 1. Build the external plugin you’ve made to an executable binary 2. Then update the main Telegraf config such as below: Note: The signal is set to “none” instead of “STDIN” ● The execd Go shim has a default polling interval of 1 second ○ can be adjusted by passing the flag poll_interval
  • 19. © 2021 InfluxData. All rights reserved. 19 PLACEHOLDER FOR ANIMATION
  • 20. © 2021 InfluxData. All rights reserved. 20 | Temperature data! Nozzle Build Plate
  • 21. © 2021 InfluxData. All rights reserved. 21 | Extend Octoprint with plugins! ● Not Telegraf plugins, but different plugins! ● Display Layer Progress ○ https:/ /plugins.octoprint.org/plugins/DisplayLayerProgress/ ● Filament Manager ○ https:/ /plugins.octoprint.org/plugins/filamentmanager/
  • 22. © 2021 InfluxData. All rights reserved. 22 | Display Layer Progress ● This plugin displays the current layer being printed! ● Fun to know and helpful!
  • 23. © 2021 InfluxData. All rights reserved. 23 | Display Layer Progress ● New API endpoint: /plugin/DisplayLayerProgress/values
  • 24. © 2021 InfluxData. All rights reserved. 24 | Filament Manager ● To get the filament data we need a postgres database!
  • 25. © 2021 InfluxData. All rights reserved. 25 | Filament Manager
  • 26. © 2021 InfluxData. All rights reserved. 26 | Demo Time!
  • 27. © 2021 InfluxData. All rights reserved. 27 PLACEHOLDER FOR ANIMATION
  • 28. © 2021 InfluxData. All rights reserved. 28 | End result!
  • 29. © 2021 InfluxData. All rights reserved. 29 | Overview Components inputs.execd outputs.influxdb_v2 Octoprint external plugin Telegraf API Display Layer Progress API Filament Manager Postgres DB Octoprint InfluxDB 2.0
  • 30. © 2021 InfluxData. All rights reserved. 30 | Try it for yourself! ● Source Code: https:/ /github.com/sspaink/octoprint-telegraf-plugin ● Feel free to make a pull request with changes!
  • 31. © 2021 InfluxData. All rights reserved. 31 | Creating your own plugin ● With the structure defined, the rest is just regular fun coding! ● Tip: Following the plugin guidelines are a great way to work! ○ when external, they are more “guidelines” then actual rules… Guidelines: ● https:/ /github.com/influxdata/telegraf/blob/master/docs/INPUTS.md ● https:/ /github.com/influxdata/telegraf/blob/master/docs/PROCESSORS.md ● https:/ /github.com/influxdata/telegraf/blob/master/docs/OUTPUTS.md
  • 32. © 2021 InfluxData. All rights reserved. 32 • No shim?!?! What to do! • Let’s try to re-implement the octoprint plugin in Rust! | What if I want to use a different language?
  • 33. © 2021 InfluxData. All rights reserved. 33 | Let’s try to implement octoprint plugin in Rust! Output in influxdb line protocol Loop in one second intervals Set configuration Gather data
  • 34. © 2021 InfluxData. All rights reserved. 34 | demo placeholder
  • 35. © 2021 InfluxData. All rights reserved. 35 | What about outputs and processors? Output Example: https:/ /github.com/morfien101/telegraf-output-kinesis Processor Example: https:/ /github.com/a-bali/telegraf-geoip
  • 36. © 2021 InfluxData. All rights reserved. 36 • Filter issues/pr’s by the label external plugin • Suid input plugin: https:/ /github.com/influxdata/telegraf/pull/7597 • Libvirt input plugin: https:/ /github.com/influxdata/telegraf/issues/690 • Jira input plugin: https:/ /github.com/influxdata/telegraf/pull/4944 | Need ideas?
  • 37. © 2021 InfluxData. All rights reserved. 37 Thank you for watching! I hope you learned something. I look forward to seeing any external plugins you might make! If you do make one, please share it by making a pull request to update the EXTERNAL_PLUGINS.md doc in the Telegraf project!