| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | # Node Mixin
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-09 20:32:22 -07:00
										 |  |  | _This is a work in progress. We aim for it to become a good role model for alerts | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | and dashboards eventually, but it is not quite there yet._ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The Node Mixin is a set of configurable, reusable, and extensible alerts and | 
					
						
							| 
									
										
										
										
											2019-10-09 20:32:22 -07:00
										 |  |  | dashboards based on the metrics exported by the Node Exporter. The mixin creates | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | recording and alerting rules for Prometheus and suitable dashboard descriptions | 
					
						
							|  |  |  | for Grafana. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-13 04:37:05 -07:00
										 |  |  | To use them, you need to have `jsonnet` (v0.16+) and `jb` installed. If you | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | have a working Go development environment, it's easiest to run the following: | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | go install github.com/google/go-jsonnet/cmd/jsonnet@latest | 
					
						
							|  |  |  | go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest | 
					
						
							|  |  |  | go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Next, install the dependencies by running the following command in this | 
					
						
							|  |  |  | directory: | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | jb install | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You can then build the Prometheus rules files `node_alerts.yaml` and | 
					
						
							|  |  |  | `node_rules.yaml`: | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | make node_alerts.yaml node_rules.yaml | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You can also build a directory `dashboard_out` with the JSON dashboard files | 
					
						
							|  |  |  | for Grafana: | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | make dashboards_out | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-08 01:55:43 -07:00
										 |  |  | Note that some of the generated dashboards require recording rules specified in | 
					
						
							|  |  |  | the previously generated `node_rules.yaml`. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-06 11:30:40 -07:00
										 |  |  | For more advanced uses of mixins, see | 
					
						
							| 
									
										
										
										
											2022-06-27 20:50:06 -07:00
										 |  |  | <https://github.com/monitoring-mixins/docs>. |