| 
									
										
										
										
											2017-03-11 18:05:03 +08:00
										 |  |  | graphite | 
					
						
							|  |  |  | ======== | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [Graphite][1] does three things: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | - Kick ass. | 
					
						
							|  |  |  | - Chew bubblegum. | 
					
						
							|  |  |  | - Make it easy to store and graph metrics. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-30 18:17:21 +08:00
										 |  |  |  | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | ## docker-compose.yml
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```yaml | 
					
						
							| 
									
										
										
										
											2021-11-11 15:37:05 +08:00
										 |  |  | version: "3.8" | 
					
						
							|  |  |  | services: | 
					
						
							|  |  |  |   graphite: | 
					
						
							|  |  |  |     image: vimagick/graphite | 
					
						
							|  |  |  |     ports: | 
					
						
							|  |  |  |       - "2003:2003/udp" | 
					
						
							|  |  |  |       - "2003:2003" | 
					
						
							|  |  |  |       - "2004:2004" | 
					
						
							|  |  |  |       - "2023:2023" | 
					
						
							|  |  |  |       - "2024:2024" | 
					
						
							|  |  |  |       - "7002:7002" | 
					
						
							|  |  |  |       - "8080:8080" | 
					
						
							|  |  |  |       - "9001:9001" | 
					
						
							|  |  |  |     volumes: | 
					
						
							|  |  |  |       - ./data/conf:/opt/graphite/conf | 
					
						
							|  |  |  |       - ./data/storage:/opt/graphite/storage | 
					
						
							|  |  |  |       - ./data/storage/log/webapp:/opt/graphite/storage/log/webapp | 
					
						
							|  |  |  |     restart: unless-stopped | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Up and Running
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | $ cd ~/fig/graphite | 
					
						
							| 
									
										
										
										
											2020-03-24 16:26:40 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | $ docker-compose run --rm graphite sh | 
					
						
							|  |  |  | >>> django-admin migrate --noinput --run-syncdb | 
					
						
							|  |  |  | >>> django-admin createsuperuser | 
					
						
							|  |  |  | >>> django-admin changepassword | 
					
						
							|  |  |  | >>> exit | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | $ docker-compose up -d | 
					
						
							| 
									
										
										
										
											2020-03-24 16:26:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-12 07:20:49 +08:00
										 |  |  | $ docker-compose exec graphite sh | 
					
						
							| 
									
										
										
										
											2017-05-15 09:54:23 +08:00
										 |  |  | >>> vi conf/storage-schemas.conf | 
					
						
							| 
									
										
										
										
											2020-03-24 16:26:40 +08:00
										 |  |  | >>> supervisorctl restart all | 
					
						
							| 
									
										
										
										
											2018-11-05 18:17:37 +08:00
										 |  |  | >>> supervisorctl status | 
					
						
							|  |  |  | carbon-aggregator   RUNNING   pid 9, uptime 0:00:13 | 
					
						
							|  |  |  | carbon-cache        RUNNING   pid 8, uptime 0:00:22 | 
					
						
							|  |  |  | graphite-webapp     RUNNING   pid 7, uptime 0:00:24 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | >>> exit | 
					
						
							| 
									
										
										
										
											2020-03-24 16:26:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | $ tree -F -L 4 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | ├── data/ | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | │   ├── conf/ | 
					
						
							| 
									
										
										
										
											2018-11-05 18:17:37 +08:00
										 |  |  | │   │   ├── aggregation-rules.conf | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | │   │   ├── carbon.conf | 
					
						
							| 
									
										
										
										
											2018-11-05 18:17:37 +08:00
										 |  |  | │   │   ├── rewrite-rules.conf | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | │   │   └── storage-schemas.conf | 
					
						
							|  |  |  | │   └── storage/ | 
					
						
							| 
									
										
										
										
											2020-03-25 15:35:26 +08:00
										 |  |  | │       ├── carbon-aggregator-a.pid | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | │       ├── carbon-cache-a.pid | 
					
						
							|  |  |  | │       ├── graphite.db | 
					
						
							|  |  |  | │       ├── log/ | 
					
						
							|  |  |  | │       │   └── webapp/ | 
					
						
							|  |  |  | │       └── whisper/ | 
					
						
							|  |  |  | │           └── carbon/ | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | └── docker-compose.yml | 
					
						
							| 
									
										
										
										
											2020-03-24 16:26:40 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:31:59 +08:00
										 |  |  | $ curl http://localhost:8080 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-03-25 15:35:26 +08:00
										 |  |  | > :warning: Stale pid files may prevent services from starting.
 | 
					
						
							|  |  |  | > Please delete these pid files manually before restarting or upgrading container.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-15 09:54:23 +08:00
										 |  |  | ## storage-schemas.conf
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```ini | 
					
						
							|  |  |  | [carbon] | 
					
						
							|  |  |  | pattern = ^carbon\. | 
					
						
							|  |  |  | retentions = 60:90d | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-24 15:30:34 +08:00
										 |  |  | [test_1day_for_1year] | 
					
						
							| 
									
										
										
										
											2017-05-15 09:54:23 +08:00
										 |  |  | pattern = ^test\. | 
					
						
							|  |  |  | retentions = 1d:1y | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [default_1min_for_1day] | 
					
						
							|  |  |  | pattern = .* | 
					
						
							|  |  |  | retentions = 60s:1d | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Resize Whisper
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | $ docker-compose exec graphite sh | 
					
						
							|  |  |  | >>> cd storage/whisper/test | 
					
						
							|  |  |  | >>> find . -type f -name '*.wsp' -exec whisper-resize.py --nobackup {} 1d:1y \; | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-11 18:05:03 +08:00
										 |  |  | [1]: http://graphiteapp.org/ |