Notifiche
Cancella tutti

Grafana and MK4  

Pagina 1 / 2
  RSS
ian.m32
(@ian-m32)
Eminent Member
Grafana and MK4

Hi,

I have MK 4 on order and looking forward to using Grafana with it as per the vid.

Does anyone have a guide on setting this up for the MK4 at all?  I can see some info around Octoprint.

Postato : 12/05/2023 1:30 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Grafana and MK4

Octoprint + Octoprint mqtt plugin + Home Assistant. And then you can create Grafana queries in Home Assistant.

Postato : 12/05/2023 2:22 pm
ian.m32
(@ian-m32)
Eminent Member
Topic starter answered:
RE: Grafana and MK4

Thanks.  Not to bothered about home assistant flashing lights at me when done 🙂

Was hoping for a link to a guide or something ideally.

Postato : 17/05/2023 12:36 pm
Walter Layher
(@walter-layher)
Prominent Member
RE: Grafana and MK4

I am sure that is only one possible way of doing it. But it is the one I know. I don't have any use for Grafana graphs for printer data/statistics. The info in OctoPrint is enough for my purposes and after the print is done I do not care about statistics. 🙂

Postato : 17/05/2023 12:48 pm
mvadu
(@mvadu)
Utenti
RE: Grafana and MK4
Posted by: @ian-m32

Thanks.  Not to bothered about home assistant flashing lights at me when done 🙂

Was hoping for a link to a guide or something ideally.

There is this open source prometheus exporter pulling metrics from buddy boards. You should be able to use this to get the metrics, and store them to either grafana cloud or to your own metrics backend. - https://github.com/pstrobl96/buddy-prometheus-exporter

Postato : 28/08/2023 3:50 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

another option is to use json-exporter as the additional target job in Prometheus - this may be more convenient in certain situations.

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 01/11/2023 9:30 am
pink_clown
(@pink_clown)
Estimable Member
RE:

When you look at this link, there is a simple and clear guide how to create your own local Grafana server, providing graphical output over time.

https://github.com/prusa3d/Prusa-Firmware-Buddy/blob/master/doc/metrics.md

It works perfectly.

Postato : 21/11/2023 7:36 pm
Zappes hanno apprezzato
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE:

Ah, this is very interesting, thanks for the link!
Some notes to compare those two.

prometheus + prometheus_exporter:
This is a passive way to fetch state from remote printer, called pull mode, where the interested client (prometheus_exporter) reads remote endpoint which is exposed by the printer.
Advantage is that multiple clients can read the printer metrics, and it is very easy to test new clients and new rules based on the existing setup, because it does not need to reconfigure the printer.
Drawback is that you get usually random time when metrics are fetched from the remote location, so sub-second resolution may be problematic.

gcode with sending metrics to remote server via syslog + influxdb:
This is a metrics in push mode, where client (the printer itself) sends metrics to the remote location (in that case custom listener in python) which is later pushed to influxdb.
This needs to tell the printer where to send metrics, and only one location is supported. In certain situations testing new metric processing requires printer reconfiguration.
Advantage is that metric sent contains timestamp and thus can very precisely in time define what was value of given metric.

Can you have both?
Yes, but it may be a bit an overkill. But this may be very convenient in specific situations.

Can you use one storage (influx instead of prometheus or prometheus instead of influx)?
Yes but each storage has its pros and cons and making a data migration or translation may be problematic. Also prometheus when fetching metric be use 'last value wins' option to optimize its memory usage.

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 21/11/2023 8:44 pm
Zappes hanno apprezzato
pink_clown
(@pink_clown)
Estimable Member
RE: Grafana and MK4

 

You can play as you like.

Postato : 22/11/2023 6:52 pm
Zappes hanno apprezzato
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE:

I checked metrics which can be exposed by the printers via syslog protocol and looks like they are more about internal printer performance.
On the other hand data exposed over web PAI in json format has some other interesting info.

So I guess the best option is to mix both 😀
If someone needs current metric names (not all of them are available in all printers), here is example command how to generate them from Prusa-Firmware-Buddy master branch:

# grep -r -E 'METRIC\((["a-z0-9_])+,.METRIC_VALUE_(CUSTOM|FLOAT|INTEGER)' | sed -E "s/.*METRIC\(\"([a-z0-9_]+)\",.METRIC_VALUE_(CUSTOM|FLOAT|INTEGER).*/M331 \\1 ;metric type \\2/"|sort|uniq


M331 active_extruder ;metric type INTEGER
M331 adj_z ;metric type FLOAT
M331 bed_curr ;metric type CUSTOM
M331 bedlet_curr ;metric type CUSTOM
M331 bedlet_pwm ;metric type CUSTOM
M331 bedlet_reg ;metric type CUSTOM
M331 bedlet_state ;metric type CUSTOM
M331 bedlet_target ;metric type CUSTOM
M331 bedlet_temp ;metric type CUSTOM
M331 bed_mcu_temp ;metric type FLOAT
M331 bed_pwm ;metric type INTEGER
M331 bed_state ;metric type INTEGER
M331 buddy_t ;metric type INTEGER
M331 cpu_usage ;metric type FLOAT
M331 cpu_usage ;metric type INTEGER
M331 crash_length ;metric type CUSTOM
M331 crash ;metric type CUSTOM
M331 crash_stat ;metric type CUSTOM
M331 cur_mmu_imp ;metric type FLOAT
M331 curr_inp ;metric type FLOAT
M331 curr_inp_raw ;metric type INTEGER
M331 curr_nozz ;metric type FLOAT
M331 curr_nozz_raw ;metric type INTEGER
M331 dwarf_board_temp ;metric type INTEGER
M331 dwarf_fast_refresh_delay ;metric type INTEGER
M331 dwarf_heat_curr ;metric type CUSTOM
M331 dwarf_mcu_temp ;metric type INTEGER
M331 dwarf_parked_raw ;metric type CUSTOM
M331 dwarf_picked_raw ;metric type CUSTOM
M331 dwarfs_board_temp ;metric type CUSTOM
M331 dwarfs_mcu_temp ;metric type CUSTOM
M331 esp_in ;metric type CUSTOM
M331 esp_out ;metric type CUSTOM
M331 eth_in ;metric type CUSTOM
M331 eth_out ;metric type CUSTOM
M331 excite_freq ;metric type FLOAT
M331 fan_hbr_speed ;metric type INTEGER
M331 fan ;metric type CUSTOM
M331 fan_speed ;metric type INTEGER
M331 freq_gain ;metric type CUSTOM
M331 fsensor ;metric type CUSTOM
M331 fsensor_raw ;metric type CUSTOM
M331 g425_cen ;metric type CUSTOM
M331 g425_off ;metric type CUSTOM
M331 g425_rxy ;metric type CUSTOM
M331 g425_rz ;metric type CUSTOM
M331 g425_xy_dev ;metric type FLOAT
M331 g425_xy ;metric type CUSTOM
M331 g425_z ;metric type CUSTOM
M331 gui_loop_dur ;metric type INTEGER
M331 hbr_fan_act ;metric type INTEGER
M331 heap_free ;metric type INTEGER
M331 heap ;metric type CUSTOM
M331 heap ;metric type INTEGER
M331 heap_total ;metric type INTEGER
M331 heater_enabled ;metric type INTEGER
M331 heating_model_discrepancy ;metric type INTEGER
M331 home_diff ;metric type CUSTOM
M331 ipos_x ;metric type INTEGER
M331 ipos_y ;metric type INTEGER
M331 ipos_z ;metric type INTEGER
M331 is_printing ;metric type INTEGER
M331 loadcell_age ;metric type INTEGER
M331 loadcell_hp ;metric type FLOAT
M331 loadcell_hysteresis ;metric type FLOAT
M331 loadcell ;metric type CUSTOM
M331 loadcell_scale ;metric type FLOAT
M331 loadcell_threshold_cont ;metric type FLOAT
M331 loadcell_threshold ;metric type FLOAT
M331 loadcell_value ;metric type FLOAT
M331 loadcell_xy ;metric type FLOAT
M331 media_prefetched ;metric type INTEGER
M331 nozzle_pwm ;metric type INTEGER
M331 oc_inp ;metric type INTEGER
M331 oc_nozz ;metric type INTEGER
M331 points_dropped ;metric type INTEGER
M331 pos_x ;metric type FLOAT
M331 pos_y ;metric type FLOAT
M331 pos_z ;metric type FLOAT
M331 print_fan_act ;metric type INTEGER
M331 probe_analysis ;metric type CUSTOM
M331 probe_window ;metric type CUSTOM
M331 probe_z_diff ;metric type CUSTOM
M331 probe_z ;metric type CUSTOM
M331 puppy_adrif ;metric type CUSTOM
M331 puppy_aoff ;metric type CUSTOM
M331 puppy_drift ;metric type CUSTOM
M331 puppy_off ;metric type CUSTOM
M331 puppy_t ;metric type CUSTOM
M331 runtime ;metric type CUSTOM
M331 side_fsensor ;metric type CUSTOM
M331 side_fsensor_raw ;metric type CUSTOM
M331 stack ;metric type CUSTOM
M331 sync_rt ;metric type CUSTOM
M331 temp_bed ;metric type FLOAT
M331 temp_brd ;metric type FLOAT
M331 temp_chamber ;metric type FLOAT
M331 temp_hbr ;metric type CUSTOM
M331 temp_mcu ;metric type INTEGER
M331 temp_noz ;metric type CUSTOM
M331 temp_sandwich ;metric type FLOAT
M331 temp_splitter ;metric type FLOAT
M331 tk_accel ;metric type CUSTOM
M331 tmc_read ;metric type CUSTOM
M331 tmc_sg_e ;metric type INTEGER
M331 tmc_sg_x ;metric type INTEGER
M331 tmc_sg_y ;metric type INTEGER
M331 tmc_sg_z ;metric type INTEGER
M331 tmc_write ;metric type CUSTOM
M331 ttemp_bed ;metric type INTEGER
M331 ttemp_noz ;metric type CUSTOM
M331 usbh_err_cnt ;metric type INTEGER
M331 val_xyz ;metric type INTEGER
M331 volt_bed ;metric type FLOAT
M331 volt_bed_raw ;metric type INTEGER
M331 volt_nozz ;metric type FLOAT
M331 volt_nozz_raw ;metric type INTEGER

 

So 'M331 <metric_name>' is a custom gcode you can put into your custom Start G-code section. 

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 26/11/2023 8:23 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

forgot string type (and time to edit post passed, thus another post):

M331 buddy_bom ;metric type STRING
M331 buddy_revision ;metric type STRING
M331 filament ;metric type STRING
M331 fw_version ;metric type STRING
M331 gcode ;metric type STRING
M331 mmu_comm ;metric type STRING
M331 print_filename ;metric type STRING

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 26/11/2023 8:31 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE:

or better everything with lowercase/uppercase/other, and even EVENT metrics (but not sure if those are parsed by metric collector in docker-compose, test for yourself):

grep -r -E 'METRIC\((.*)"([^"]+)"(.*)METRIC_VALUE_([A-Z_]+)' \
| sed -E 's/(.*):.*METRIC\((.*)"([^"]+)"(.*)METRIC_VALUE_([A-Z_]+).*/M331 \3 ;metric type \5 - \1 /' \
| sed 's/Prusa-Firmware-Buddy\///g' \
| sort | uniq

 

result: metrics_all

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 26/11/2023 9:32 pm
pink_clown
(@pink_clown)
Estimable Member
RE: Grafana and MK4

@_kaszpir_

but be aware, not all them have to be activated, most of them are inactive by default, you have to activate them by M33 <metric_ID>.

The above list is a mixture of MK4 and XL metrics, e.g. the bedlet_ metrics are valid for XL as the XL bed consist of 16 bedlets.

Postato : 29/11/2023 6:11 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

Yes, I am fully aware that they need to be activated by custom gcode and also it mixes metrics from different printers.

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 29/11/2023 6:22 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

If someone is interested I've added script to github, generates csv which is searchable online https://github.com/nvtkaszpir/3d-print/blob/main/prusa3d-metrics-list/metrics.csv

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 02/12/2023 8:15 pm
SolitaireMakes e pink_clown hanno apprezzato
pink_clown
(@pink_clown)
Estimable Member
RE: Grafana and MK4

I have upgraded to 5.1  and the old buddy grafana stopped to work. Seems there where some changes done in the metrics (format change?)  sent by the MK4, so the old Grafana configuration does not accept them. I need to look at the differences.

Postato : 06/12/2023 6:59 pm
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

There may be metrics rename, you could use my script to modify it slightly and check out specific commit (now it is master or main, can't remember), generate files and compare them with git diff

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 07/12/2023 7:23 am
pink_clown
(@pink_clown)
Estimable Member
RE: Grafana and MK4

The metrics names are the same, there is something different in their parameters. Being retired  I could not find a time to do a deeper dig 😀.

Postato : 11/12/2023 7:21 am
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Grafana and MK4

Tehy could have changed for example range of the values they get, such as percent from 0-100 to 0 to 1 and being a float. Haven't checked it, though.

See my GitHub and printables.com for some 3d stuff that you may like.

Postato : 11/12/2023 8:29 am
pink_clown
(@pink_clown)
Estimable Member
RE: Grafana and MK4

Issue resolved

Using grafana on separate PC, i did not have up to date the Prus-Firmware-Buddy folder, so the docker, could not build the new influxdb structure.

They changed the registration time to milliseconds around November.

Postato : 30/01/2024 1:16 pm
Pagina 1 / 2
Condividi: