feat: add more
This commit is contained in:
5
src/node-exporter/.env.example
Normal file
5
src/node-exporter/.env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# Node Exporter version
|
||||
NODE_EXPORTER_VERSION="v1.8.2"
|
||||
|
||||
# Port to bind to on the host machine
|
||||
NODE_EXPORTER_PORT_OVERRIDE=9100
|
||||
81
src/node-exporter/README.md
Normal file
81
src/node-exporter/README.md
Normal file
@@ -0,0 +1,81 @@
|
||||
# Node Exporter
|
||||
|
||||
[English](./README.md) | [中文](./README.zh.md)
|
||||
|
||||
This service deploys Prometheus Node Exporter, which exposes hardware and OS metrics from *NIX kernels.
|
||||
|
||||
## Services
|
||||
|
||||
- `node-exporter`: Prometheus Node Exporter service
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable Name | Description | Default Value |
|
||||
| --------------------------- | --------------------- | ------------- |
|
||||
| NODE_EXPORTER_VERSION | Node Exporter version | `v1.8.2` |
|
||||
| NODE_EXPORTER_PORT_OVERRIDE | Host port mapping | `9100` |
|
||||
|
||||
Please modify the `.env` file as needed for your use case.
|
||||
|
||||
## Usage
|
||||
|
||||
### Start Node Exporter
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### Access Metrics
|
||||
|
||||
- Metrics endpoint: <http://localhost:9100/metrics>
|
||||
|
||||
### Configure Prometheus
|
||||
|
||||
Add this scrape config to your Prometheus configuration:
|
||||
|
||||
```yaml
|
||||
scrape_configs:
|
||||
- job_name: 'node'
|
||||
static_configs:
|
||||
- targets: ['localhost:9100']
|
||||
```
|
||||
|
||||
## Metrics Collected
|
||||
|
||||
Node Exporter collects a wide variety of system metrics:
|
||||
|
||||
- **CPU**: usage, frequency, temperature
|
||||
- **Memory**: usage, available, cached
|
||||
- **Disk**: I/O, space usage
|
||||
- **Network**: traffic, errors
|
||||
- **File system**: mount points, usage
|
||||
- **Load**: system load averages
|
||||
- **And many more**
|
||||
|
||||
## Network Mode
|
||||
|
||||
For more accurate metrics, you can run Node Exporter with host network mode. Uncomment in `docker-compose.yaml`:
|
||||
|
||||
```yaml
|
||||
network_mode: host
|
||||
```
|
||||
|
||||
Note: When using host network mode, port mapping is not needed.
|
||||
|
||||
## Notes
|
||||
|
||||
- Node Exporter should run on each host you want to monitor
|
||||
- The service needs access to host filesystem and processes
|
||||
- Metrics are exposed in Prometheus format
|
||||
- No authentication is provided by default
|
||||
|
||||
## Security
|
||||
|
||||
- Bind to localhost only if running Prometheus on the same host
|
||||
- Use firewall rules to restrict access to the metrics endpoint
|
||||
- Consider using a reverse proxy with authentication for production
|
||||
- Monitor access logs for suspicious activity
|
||||
|
||||
## License
|
||||
|
||||
Node Exporter is licensed under Apache License 2.0. See [Node Exporter GitHub](https://github.com/prometheus/node_exporter) for more information.
|
||||
36
src/node-exporter/docker-compose.yaml
Normal file
36
src/node-exporter/docker-compose.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
x-default: &default
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- &localtime /etc/localtime:/etc/localtime:ro
|
||||
- &timezone /etc/timezone:/etc/timezone:ro
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: 100m
|
||||
|
||||
services:
|
||||
node-exporter:
|
||||
<<: *default
|
||||
image: prom/node-exporter:${NODE_EXPORTER_VERSION:-v1.8.2}
|
||||
container_name: node-exporter
|
||||
ports:
|
||||
- "${NODE_EXPORTER_PORT_OVERRIDE:-9100}:9100"
|
||||
command:
|
||||
- '--path.rootfs=/host'
|
||||
- '--path.procfs=/host/proc'
|
||||
- '--path.sysfs=/host/sys'
|
||||
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
|
||||
volumes:
|
||||
- '/:/host:ro,rslave'
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '0.25'
|
||||
memory: 128M
|
||||
reservations:
|
||||
cpus: '0.1'
|
||||
memory: 64M
|
||||
# Run with host network for accurate metrics
|
||||
# network_mode: host
|
||||
|
||||
volumes: {}
|
||||
Reference in New Issue
Block a user