2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-13 09:21:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								This directory contains scripts to manage a local instance of [InfluxDB OSS ](https://docs.influxdata.com/influxdb/v1.6/ ) and [Grafana ](https://grafana.com/docs/v5.2/ )
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Setup
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Start the local metric services:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`$ ./start.sh`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-13 09:21:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Metrics are enabled on a per-shell basis which means you must `source`  the
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								following scripts in each shell in which you start an application you wish to
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								collect metrics from.  For example, if running a Solana validator you must run
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`source ./enable.sh`  before starting the node: 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`$ source ./enable.sh`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Once metrics have been started and you have an application running you can view the metrics at:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-13 09:21:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								http://localhost:3000/dashboards
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-06-13 09:21:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								To test that things are working correctly you can send a test airdrop data point and then check the
							 
						 
					
						
							
								
									
										
										
										
											2019-05-22 00:08:18 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								metrics dashboard:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`$ ./test.sh`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								Stop metric services:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								`$ ./stop.sh`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### InfluxDB CLI
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								You may find it useful to install the InfluxDB client for
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								adhoc metrics collection/viewing
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  Linux - `sudo apt-get install influxdb-client`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  macOS - `brew install influxdb`  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-22 00:08:18 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								Simple example of pulling all airdrop measurements out of the `testnet`  database:
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2019-06-13 09:21:06 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ influx -database testnet -username read -password read -execute 'SELECT * FROM "drone-airdrop"'
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								Reference: https://docs.influxdata.com/influxdb/v1.5/query_language/
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Monitoring
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								To monitor activity, run one of:
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-05-22 00:08:18 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```sh
							 
						 
					
						
							
								
									
										
										
										
											2019-05-06 16:44:06 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$ docker logs -f influxdb
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ docker logs -f grafana
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Reference
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  https://hub.docker.com/_/influxdata-influxdb 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								*  https://hub.docker.com/r/grafana/grafana