|
| 1 | +# Alert service |
| 2 | + |
| 3 | +Sends alerts to an output topic when the temperature is under or over the threshold. |
| 4 | + |
| 5 | +It receives data from two topics (3d printer data and forecast) and triggers an alert (to output topic `alerts`) if the temperature is under or over the threshold. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +The default thresholds are as shown in the following table: |
| 10 | + |
| 11 | +| Variable | Default value (degrees C)| |
| 12 | +|----|----| |
| 13 | +| min_ambient_temperature | 45| |
| 14 | +| max_ambient_temperature | 55 | |
| 15 | +| min_bed_temperature | 105 | |
| 16 | +| max_bed_temperature | 115 | |
| 17 | +| min_hotend_temperature | 245 | |
| 18 | +| max_hotend_temperature | 255 | |
| 19 | + |
| 20 | +These thresholds are used to determine if the temperature, or forecast temperature, are under or over the threshold values. If so these alerts are published to the `alerts` topic. |
| 21 | + |
| 22 | +Note there are different alert types, with the message format for the `no-alert` type alert: |
| 23 | + |
| 24 | +``` json |
| 25 | +{ |
| 26 | + "status": "no-alert", |
| 27 | + "parameter_name": "hotend_temperature", |
| 28 | + "message": "'Hotend temperature' is within normal parameters", |
| 29 | + "alert_timestamp": 1701280033000000000, |
| 30 | + "alert_temperature": 246.04148121958596 |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +An example of the `under-now` alert message format: |
| 35 | + |
| 36 | +``` json |
| 37 | +{ |
| 38 | + "status": "under-now", |
| 39 | + "parameter_name": "bed_temperature", |
| 40 | + "alert_timestamp": 1701273328000000000, |
| 41 | + "alert_temperature": 104.0852349596566, |
| 42 | + "message": "'Bed temperature' is under the threshold (105ºC)" |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +Here's an `over-forecast` alert message format: |
| 47 | + |
| 48 | +``` json |
| 49 | +{ |
| 50 | + "status": "over-forecast", |
| 51 | + "parameter_name": "forecast_fluctuated_ambient_temperature", |
| 52 | + "alert_temperature": 55.014602460947586, |
| 53 | + "alert_timestamp": 1701278280000000000, |
| 54 | + "message": "'Ambient temperature' is forecasted to go over 55ºC in 1:36:29." |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +Here's the `under-forecast` alert message format: |
| 59 | + |
| 60 | +``` json |
| 61 | +{ |
| 62 | + "status": "under-forecast", |
| 63 | + "parameter_name": "forecast_fluctuated_ambient_temperature", |
| 64 | + "alert_temperature": 44.98135836928914, |
| 65 | + "alert_timestamp": 1701277320000000000, |
| 66 | + "message": "'Ambient temperature' is forecasted to fall below 45ºC in 1:20:28." |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +These alerts are subscribed to by the Printers dashboard service, and the alerts can be displayed in real time on the scrolling charts, as well as the scrolling alert display: |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +## Check the log messages |
| 75 | + |
| 76 | +It can be very useful to check the logs for a service. To do this from the pipeline view: |
| 77 | + |
| 78 | +1. Click on Alert Service in the pipeline view. |
| 79 | + |
| 80 | +2. Click the `Logs` tab. |
| 81 | + |
| 82 | +You can now view the log messages: |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | +## View the message format |
| 87 | + |
| 88 | +You can also view the actual messages being transferred through the service: |
| 89 | + |
| 90 | +1. Click the `Messages` tab. |
| 91 | + |
| 92 | +2. You can now select either the input or oputput topic as required from the topic drop down: |
| 93 | + |
| 94 | +  |
| 95 | + |
| 96 | +3. You can now explore the messages. Click on a message to display it: |
| 97 | + |
| 98 | +  |
| 99 | + |
| 100 | + Make sure you click the `Live` tab to continue viewing live messages. |
| 101 | + |
| 102 | +## 🏃♀️ Next step |
| 103 | + |
| 104 | +[Part 6 - InfluxDB raw data service :material-arrow-right-circle:{ align=right }](./influxdb-raw-data.md) |
0 commit comments