• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Home
  • Contact Us

iHash

News and How to's

  • Nationwide Annual Golf Membership Player's Pass + $50 Restaurant.com eGift Card for $49

    Nationwide Annual Golf Membership Player's Pass + $50 Restaurant.com eGift Card for $49
  • Radiant Cheval Mirror Jewelry Armoire Beige for $164

    Radiant Cheval Mirror Jewelry Armoire Beige for $164
  • Radiant Cheval Mirror Jewelry Armoire Silver for $164

    Radiant Cheval Mirror Jewelry Armoire Silver for $164
  • Radiant Cheval Mirror Jewelry Armoire White for $165

    Radiant Cheval Mirror Jewelry Armoire White for $165
  • Wireless Bluetooth 5.0 Earbuds, Sport Headphones Matte Design Earbuds with Battery Charging Case for $18

    Wireless Bluetooth 5.0 Earbuds, Sport Headphones Matte Design Earbuds with Battery Charging Case for $18
  • News
    • Rumor
    • Design
    • Concept
    • WWDC
    • Security
    • BigData
  • Apps
    • Free Apps
    • OS X
    • iOS
    • iTunes
      • Music
      • Movie
      • Books
  • How to
    • OS X
      • OS X Mavericks
      • OS X Yosemite
      • Where Download OS X 10.9 Mavericks
    • iOS
      • iOS 7
      • iOS 8
      • iPhone Firmware
      • iPad Firmware
      • iPod touch
      • AppleTV Firmware
      • Where Download iOS 7 Beta
      • Jailbreak News
      • iOS 8 Beta/GM Download Links (mega links) and How to Upgrade
      • iPhone Recovery Mode
      • iPhone DFU Mode
      • How to Upgrade iOS 6 to iOS 7
      • How To Downgrade From iOS 7 Beta to iOS 6
    • Other
      • Disable Apple Remote Control
      • Pair Apple Remote Control
      • Unpair Apple Remote Control
  • Special Offers
  • Contact us

3D Observability for Prometheus + Grafana + Octoprint

Dec 23, 2022 by iHash Leave a Comment


You may get lucky this holiday season with a new 3D printer, either as a gift or something you give yourself as a reward for all your hard work this year.

Household 3D printers have made tremendous strides in ease of use and affordability over the last decade. In this time, even use of budget 3D printers has matured from a long weekend of slow building and constant troubleshooting to essentially plug and play – transforming many garages and basements from humble storage rooms to makerspaces that would be the envy of any iron-themed superhero.

At the same time, I myself stumbled into an issue with my printer a few weeks ago where its  onboard fans were blowing on the device’s hotend and causing a thermal runaway error, even after rebuilding said hotend. This issue causes Octoprint to restart as well, losing my metrics in the process and making the root cause even more difficult to identify.

So, within the context of monitoring and observability, such a situation begs the question – how can we preserve our metrics, get great visualizations of what the printer is currently doing, receive alerts when and if something goes wrong, plus get your hands on neat statistics such as total prints completed, total print time, and number of failed prints?

The answer? Prometheus + Grafana + Octoprint = 3D Observability!

A quick summary of what each element does:

Octoprint: is used to control the 3D printer via a web interface, most commonly run on a Raspberry Pi, and attached to the printer control board via USB. It is currently the most widely used 3D printer host software backed by lots of great community plugins. The plugin we’re interested in here is the Prometheus Exporter plugin, which will allow us to expose the metrics we want, including current print progress and extruder temperature.

Prometheus: is used to scrape the metrics that we’re exposing from Octoprint and remote write them to Logz.io, where they can then be visualized and used for alerts in Grafana. We’ll run this in a docker container on the Raspberry Pi itself.

Grafana: is used for visualizing our metrics and sending alerts whenever certain thresholds are met, such as a current print changing status or hotend temperature increasing beyond safe levels.

Set up and Installation:

First thing first, you’ll need to set up Octoprint and attach it to your 3D printer. You’ll then want to grab a micro SD card and an Octoprint image to set that up – Octoprint provides great instructions on how to get that working.

Once your OctoPrint is properly set up, you’ll need to install the Prometheus Exporter Plugin from the plugin manager to expose your metrics. This is accomplished by going to settings > OctoPrint > PluginManager, then enabling “Prometheus Exporter Plugin”.

Once the exporter is installed, you should see the raw metrics at the address http://octo.local/plugin/prometheus_exporter/metrics if in fact you used the provided hostname from the OctoPrint tutorial.

We’ll also need to get an access key so Prometheus can access these metrics – we’ll do that in Octoprint by going to Settings > API > Access Application Keys, then Entering an Application Identifier and generating a code.

Next, we’ll need to set up Prometheus to scrape those metrics and send them along to Logz.io. We’ll start by creating the configuration that Prometheus is going to use to find these metrics and send them to Logz.io:

  1. Get your Logz.io bearer key by logging in, navigating to Metrics > Send your metrics > Remote Write for Prometheus
  2. Now ssh to your OctoPrint server (ssh [email protected])
  3. Create a new directory in /home/pi called “prometheus” (mkdir /home/pi/prometheus), and create “prometheus.yml” with the following (nano /home/pi/prometheus/prometheus.yml).
global:
  external_labels:
    p8s_logzio_name: <Your_Printer_Name>
remote_write:
  - url: https://listener.logz.io:8053
    bearer_token: <Your logz.io bearer token>
    remote_timeout: 30s
    queue_config:
      batch_send_deadline: 5s  #default = 5s
      max_shards: 10  #default = 1000
      min_shards: 1
      max_samples_per_send: 500 #default = 100
      capacity: 10000  #default = 500
scrape_configs:
  - job_name: 'octoprint'
    scrape_interval: 5s
    metrics_path: '/plugin/prometheus_exporter/metrics'
    params:
      apikey: ['<YOUR OCTOPRINT API KEY>'] # Get this from OctoPrint > Settings > Features > API
    static_configs:
      - targets: ['localhost']

Now we need to install Docker and run Prometheus to use this configuration. If you’re unfamiliar with Docker, it is a platform for running containerized applications. We’re using it here because once it’s set up, it’s simple to run Prometheus, configure it to restart automatically if your Raspberry Pi restarts, and update (just remove the container and run it again, since we’re using the latest image).

Docker provides good instructions for installing on Debian 10, so follow those to get Docker up and running. I would recommend setting up the repository, then installing Docker from here.

Once Docker is installed, you can run Prometheus and mount in the configuration file we made earlier to start shipping our metrics.

To run Prometheus in Docker using the configuration we made above, run:

sudo docker run –restart=always -d -v /home/pi/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml –network=host –name=prometheus prom/prometheus

What do all of these flags mean?

  • –restart=always is telling Docker to restart this container if the Pi restarts
  • -d run as daemon (background process)
  • -v /home/pi/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml Mounts the Prometheus configuration into the container
  • –network=host for the sake of simplicity, we’ll run the container on the host network of the Pi
  • –name=prometheus just giving the container an appropriate name

Almost there! Now we have OctoPrint controlling the printer, the Prometheus Exporter Plugin exposing our metrics, and Prometheus remote writing our metrics to Logz.io. Now we just need to visualize our metrics and set up any alerts we want.

On Logz.io, Navigate to the Metrics product to create a new dashboard with your metrics, or you can import this one I created:

Now you should have a visualization of your printer’s metrics. If you want to create alerts, you can do so from the “Alerting”  section You’ll also need to create a new Contact Point so the system knows where to send the alerts. I want to receive a text message whenever a print is finished, which I accomplished by choosing Email as the contact point and using my cellular provider’s SMS gateway – <phone_number>@tmomail.net in my case with T-Mobile. Other carriers have their own SMS gateway, so you’ll need to check for your specific carrier if you want to go this route.

For the actual alert, here is what I used. There are many other alerts you could make, but this is a good starting point.

Once that’s done, you’re all set to add your own panels, create new alerts for items such as temperature differences or printer state changes, or even start shipping metrics for other elements that you want to monitor! To help get started, here is a long list of available exporters that you can use to expose metrics for various applications here. 

Happy printing and happy holidays from all of us at Logz.io!



Source link

Share this:

  • Facebook
  • Twitter
  • Pinterest
  • LinkedIn

Filed Under: News Tagged With: Grafana, Observability, Octoprint, Prometheus

Special Offers

  • Nationwide Annual Golf Membership Player's Pass + $50 Restaurant.com eGift Card for $49

    Nationwide Annual Golf Membership Player's Pass + $50 Restaurant.com eGift Card for $49
  • Radiant Cheval Mirror Jewelry Armoire Beige for $164

    Radiant Cheval Mirror Jewelry Armoire Beige for $164
  • Radiant Cheval Mirror Jewelry Armoire Silver for $164

    Radiant Cheval Mirror Jewelry Armoire Silver for $164
  • Radiant Cheval Mirror Jewelry Armoire White for $165

    Radiant Cheval Mirror Jewelry Armoire White for $165
  • Wireless Bluetooth 5.0 Earbuds, Sport Headphones Matte Design Earbuds with Battery Charging Case for $18

    Wireless Bluetooth 5.0 Earbuds, Sport Headphones Matte Design Earbuds with Battery Charging Case for $18

Reader Interactions

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

  • Facebook
  • GitHub
  • Instagram
  • Pinterest
  • Twitter
  • YouTube

More to See

New Android Banking Trojan Targeting Brazilian Financial Institutions

Feb 4, 2023 By iHash

Radiant Cheval Mirror Jewelry Armoire Beige for $164

Feb 5, 2023 By iHash

Tags

* Apple Cisco computer security cyber attacks cyber crime cyber news cybersecurity Cyber Security cyber security news cyber security news today cyber security updates cyber threats cyber updates data breach data breaches google hacker hacker news Hackers hacking hacking news how to hack incident response information security iOS 7 iOS 8 iPhone Malware microsoft network security ransomware ransomware malware risk management Secure security security breaches security vulnerabilities software vulnerability the hacker news Threat update video Vulnerabilities web applications

Latest

Nationwide Annual Golf Membership Player's Pass + $50 Restaurant.com eGift Card for $49

Expires February 02, 2123 07:00 PST Buy now and get 75% off Nationwide Annual Golf Membership KEY FEATURES Warmer weather is here and it’s time to get outside! It does not matter if you are a Master’s champion or a casual weekend golfer; everyone will enjoy the savings at your favorite courses with the Player’s […]

Radiant Cheval Mirror Jewelry Armoire Silver for $164

Expires February 02, 2123 00:49 PST Buy now and get 30% off KEY FEATURES Our full length free standing armoire with mirror border is a chic makeup vanity and space saving jewelry organizer in one. Stylish and efficient, this contemporary design is constructed of MDF eco-friendly wood, with a sleek finish enhanced by inner LED […]

Comet Announces Convergence 2023, the Leading Conference to Explore the New Frontiers of Machine Learning

Comet, provider of a leading MLOps platform for machine learning (ML) teams from startup to enterprise, announced its second annual Convergence conference. The event, which is free to the ML community, will take place virtually March 7-8, 2023. Convergence 2023 comes at a time when machine learning solutions are increasingly employed by companies across industries to […]

Altec Lansing HydraShock Everything Proof Wireless Bluetooth Speaker, IP67, IMW1500-SJR, Red (Certified Refurbished) for $119

Expires January 27, 2123 20:54 PST Buy now and get 0% off PRODUCT SPECS Condition: Certified Refurbished – Brown/White Box Warranty Term: 90 DaysWarranty Provider: Distributor Altec Lansing HydraShock Everything Proof Wireless Bluetooth Speaker, IP67, IMW1500-SJR, Red (Certified Refurbished) From backyard BBQ’s to summer pool parties, the HydraShock delivers massive bass and bold design together […]

Introducing approximate nearest neighbor search in Elasticsearch 8.0

Elastic Stack 7.17.9 released | Elastic Blog

Elastic Stack 7.17.9 released English简体中文한국어日本語FrançaisDeutschEspañolPortuguês Version 7.17.9 of the Elastic Stack was released today. We recommend you upgrade to this latest version. We recommend 7.17.9 over the previous patch versions in 7.17.x. The 7.17.9 patch release contains a fix for a potential security vulnerability. Please see our security advisory for more details. For details of […]

Apple reports first quarter results

Apple periodically provides information for investors on its corporate website, apple.com, and its investor relations website, investor.apple.com. This includes press releases and other information about financial performance, reports filed or furnished with the SEC, information on corporate governance, and details related to its annual meeting of shareholders. This press release contains forward-looking statements, within the meaning of […]

Jailbreak

Pangu Releases Updated Jailbreak of iOS 9 Pangu9 v1.2.0

Pangu has updated its jailbreak utility for iOS 9.0 to 9.0.2 with a fix for the manage storage bug and the latest version of Cydia. Change log V1.2.0 (2015-10-27) 1. Bundle latest Cydia with new Patcyh which fixed failure to open url scheme in MobileSafari 2. Fixed the bug that “preferences -> Storage&iCloud Usage -> […]

Apple Blocks Pangu Jailbreak Exploits With Release of iOS 9.1

Apple has blocked exploits used by the Pangu Jailbreak with the release of iOS 9.1. Pangu was able to jailbreak iOS 9.0 to 9.0.2; however, in Apple’s document on the security content of iOS 9.1, PanguTeam is credited with discovering two vulnerabilities that have been patched.

Pangu Releases Updated Jailbreak of iOS 9 Pangu9 v1.1.0

  Pangu has released an update to its jailbreak utility for iOS 9 that improves its reliability and success rate.   Change log V1.1.0 (2015-10-21) 1. Improve the success rate and reliability of jailbreak program for 64bit devices 2. Optimize backup process and improve jailbreak speed, and fix an issue that leads to fail to […]

Activator 1.9.6 Released With Support for iOS 9, 3D Touch

  Ryan Petrich has released Activator 1.9.6, an update to the centralized gesture, button, and shortcut manager, that brings support for iOS 9 and 3D Touch.

Copyright iHash.eu © 2023
We use cookies on this website. By using this site, you agree that we may store and access cookies on your device. Accept Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT