Update Docker Image Name + Add TODO List
This commit is contained in:
10
README.md
10
README.md
@@ -6,7 +6,7 @@ Note: currently only supports docker
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Build: `docker build -t dockermonrs .`
|
1. Build: `docker build -t system-exporter .`
|
||||||
2. Run: `cd example && docker-compose up -d`
|
2. Run: `cd example && docker-compose up -d`
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
@@ -14,4 +14,10 @@ Note: currently only supports docker
|
|||||||
* If you are on OS X and using Docker Desktop, you may have to enable the docker socket. You can do this by
|
* If you are on OS X and using Docker Desktop, you may have to enable the docker socket. You can do this by
|
||||||
going to Settings -> Advanced -> Allow the default Docker socket to be used.
|
going to Settings -> Advanced -> Allow the default Docker socket to be used.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- [ ] Add structured logging w/Slog
|
||||||
|
- [ ] Add Unit tests
|
||||||
|
- [ ] More strongly type the models
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
|
|
||||||
system-exporter:
|
system-exporter:
|
||||||
container_name: system-exporter
|
container_name: system-exporter
|
||||||
image: dockermonrs
|
image: system-exporter
|
||||||
command: /app/system-exporter --docker-server http://socat:2375
|
command: /app/system-exporter --docker-server http://socat:2375
|
||||||
ports:
|
ports:
|
||||||
- "45454:45454"
|
- "45454:45454"
|
||||||
|
|||||||
@@ -39,11 +39,15 @@ async fn get_metrics(
|
|||||||
let mut buffer = vec![];
|
let mut buffer = vec![];
|
||||||
let encoder = TextEncoder::new();
|
let encoder = TextEncoder::new();
|
||||||
let metric_families = metrics.registry.gather();
|
let metric_families = metrics.registry.gather();
|
||||||
|
|
||||||
encoder
|
encoder
|
||||||
.encode(&metric_families, &mut buffer)
|
.encode(&metric_families, &mut buffer)
|
||||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||||
let metrics_str = String::from_utf8(buffer).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
|
||||||
let mut response = Response::new(Body::from(metrics_str));
|
let mut response = Response::new(Body::from(
|
||||||
|
String::from_utf8(buffer).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?,
|
||||||
|
));
|
||||||
*response.status_mut() = StatusCode::OK;
|
*response.status_mut() = StatusCode::OK;
|
||||||
|
|
||||||
Ok(response)
|
Ok(response)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user