# Prometheus

**🟡 Monitoring Service**

## 📋 Service Overview

| Property | Value |
|----------|-------|
| **Service Name** | prometheus |
| **Host** | homelab-vm (192.168.0.210) |
| **Port** | 9090 |
| **URL** | `http://192.168.0.210:9090` |
| **Docker Image** | `prom/prometheus` |
| **Compose File** | `hosts/vms/homelab-vm/monitoring.yaml` |
| **Targets** | 14 active (all hosts via node_exporter + SNMP) |

## 🎯 Purpose

Prometheus is an open-source systems monitoring and alerting toolkit.

## 🚀 Quick Start

### Prerequisites
- Docker and Docker Compose installed
- Basic understanding of REDACTED_APP_PASSWORD
- Access to the host system (setillo)

### Deployment
```bash
# Navigate to service directory
cd setillo/prometheus

# Start the service
docker-compose up -d

# Check service status
docker-compose ps

# View logs
docker-compose logs -f prometheus
```

## 🔧 Configuration

### Docker Compose Configuration
```yaml
command:
- --storage.tsdb.retention.time=60d
- --config.file=/etc/prometheus/prometheus.yml
container_name: Prometheus
cpu_shares: 768
healthcheck:
  test: wget --no-verbose --tries=1 --spider http://localhost:9090/ || exit 1
hostname: prometheus-docker
image: prom/prometheus
mem_limit: 1g
networks:
- prometheus-net
ports:
- 12090:9090
restart: on-failure:5
security_opt:
- no-new-privileges=true
user: 1027:100
volumes:
- /volume1/docker/prometheus/prometheus:/prometheus:rw
- /volume1/docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro

```

### Environment Variables
No environment variables configured.

### Port Mappings
| Host Port | Container Port | Protocol | Purpose |
|-----------|----------------|----------|----------|
| 12090 | 9090 | TCP | Prometheus metrics |


### Volume Mappings
| Host Path | Container Path | Type | Purpose |
|-----------|----------------|------|----------|
| `/volume1/docker/prometheus/prometheus` | `/prometheus` | bind | Data storage |
| `/volume1/docker/prometheus/prometheus.yml` | `/etc/prometheus/prometheus.yml` | bind | Configuration files |


## 🌐 Access Information

Service ports: 12090:9090

## 🔒 Security Considerations

- ✅ Security options configured
- ✅ Non-root user configured

## 📊 Resource Requirements

No resource limits configured

### Recommended Resources
- **Minimum RAM**: 512MB
- **Recommended RAM**: 1GB+
- **CPU**: 1 core minimum
- **Storage**: Varies by usage

### Resource Monitoring
Monitor resource usage with:
```bash
docker stats
```

## 🔍 Health Monitoring

✅ Health check configured
**Test Command**: `wget --no-verbose --tries=1 --spider http://localhost:9090/ || exit 1`

### Manual Health Checks
```bash
# Check container health
docker inspect --format='{{.State.Health.Status}}' CONTAINER_NAME

# View health check logs
docker inspect --format='{{range .State.Health.Log}}{{.Output}}{{end}}' CONTAINER_NAME
```

## 🚨 Troubleshooting

### Common Issues
**Service won't start**
- Check Docker logs: `docker-compose logs service-name`
- Verify port availability: `netstat -tulpn | grep PORT`
- Check file permissions on mounted volumes

**Can't access web interface**
- Verify service is running: `docker-compose ps`
- Check firewall settings
- Confirm correct port mapping

**Performance issues**
- Monitor resource usage: `docker stats`
- Check available disk space: `df -h`
- Review service logs for errors

**Metrics not collecting**
- Check target endpoints are accessible
- Verify configuration syntax
- Check network connectivity

### Useful Commands
```bash
# Check service status
docker-compose ps

# View real-time logs
docker-compose logs -f prometheus

# Restart service
docker-compose restart prometheus

# Update service
docker-compose pull prometheus
docker-compose up -d prometheus

# Access service shell
docker-compose exec prometheus /bin/bash
# or
docker-compose exec prometheus /bin/sh
```

## 📚 Additional Resources

- **Official Documentation**: Check the official docs for prometheus
- **Docker Hub**: [prom/prometheus](https://hub.docker.com/r/prom/prometheus)
- **Community Forums**: Search for community discussions and solutions
- **GitHub Issues**: Check the project's GitHub for known issues

## 🔗 Related Services

Services REDACTED_APP_PASSWORD prometheus:
- Grafana
- Prometheus
- Uptime Kuma
- Node Exporter

---

*This documentation is auto-generated from the Docker Compose configuration. For the most up-to-date information, refer to the official documentation and the actual compose file.*

**Last Updated**: 2025-11-17  
**Configuration Source**: `setillo/prometheus/compose.yaml`
