# Infrastructure Inventory Centralized inventory and discovery system for all infrastructure components in Sankofa Phoenix. ## Overview The infrastructure inventory system provides: - Auto-discovery of infrastructure components - Centralized inventory database - Asset tracking and lifecycle management - Configuration drift detection - Change history and audit trails ## Components ### Discovery (`discovery/`) Auto-discovery scripts for: - Proxmox clusters and nodes - Network devices (switches, routers) - Omada controllers and access points - Storage systems - Other infrastructure components ### Database (`database/`) Inventory database schema and management: - PostgreSQL schema for inventory - Migration scripts - Query utilities - Backup/restore procedures ## Discovery ### Auto-Discovery ```bash # Discover all infrastructure ./discovery/discover-all.sh --site us-east-1 # Discover Proxmox infrastructure ./discovery/discover-proxmox.sh --site us-east-1 # Discover network infrastructure ./discovery/discover-network.sh --site us-east-1 # Discover Omada infrastructure ./discovery/discover-omada.sh --controller omada.sankofa.nexus ``` ### Scheduled Discovery Discovery can be scheduled via cron or Kubernetes CronJob: ```yaml apiVersion: batch/v1 kind: CronJob metadata: name: infrastructure-discovery spec: schedule: "0 */6 * * *" # Every 6 hours jobTemplate: spec: template: spec: containers: - name: discovery image: infrastructure-discovery:latest command: ["./discovery/discover-all.sh"] ``` ## Database Schema ### Tables - **sites**: Physical sites/locations - **nodes**: Compute nodes (Proxmox, Kubernetes) - **vms**: Virtual machines - **network_devices**: Switches, routers, access points - **storage_pools**: Storage systems - **networks**: Network segments and VLANs - **inventory_history**: Change history ### Schema Location See `database/schema.sql` for complete database schema. ## Usage ### Query Inventory ```bash # List all sites ./database/query.sh "SELECT * FROM sites" # List nodes for a site ./database/query.sh "SELECT * FROM nodes WHERE site_id = 'us-east-1'" # Get VM inventory ./database/query.sh "SELECT * FROM vms WHERE site_id = 'us-east-1'" ``` ### Update Inventory ```bash # Update node information ./database/update-node.sh \ --node pve1 \ --site us-east-1 \ --status online \ --cpu 32 \ --memory 128GB ``` ### Configuration Drift Detection ```bash # Detect configuration drift ./discovery/detect-drift.sh --site us-east-1 # Compare with expected configuration ./discovery/compare-config.sh \ --site us-east-1 \ --expected expected-config.yaml ``` ## Integration ### API Integration The inventory system provides a REST API for integration: ```bash # Get site inventory curl https://api.sankofa.nexus/inventory/sites/us-east-1 # Get node details curl https://api.sankofa.nexus/inventory/nodes/pve1 # Update inventory curl -X POST https://api.sankofa.nexus/inventory/nodes \ -H "Content-Type: application/json" \ -d '{"name": "pve1", "site": "us-east-1", ...}' ``` ### Portal Integration The inventory is accessible via the Portal UI: - Infrastructure explorer - Asset management - Configuration comparison - Change history ## Configuration ### Discovery Configuration ```yaml discovery: sites: - id: us-east-1 proxmox: endpoints: - https://pve1.sankofa.nexus:8006 - https://pve2.sankofa.nexus:8006 network: snmp_community: public devices: - 10.1.0.1 # switch-01 - 10.1.0.254 # router-01 omada: controller: omada.sankofa.nexus site_id: us-east-1 ``` ### Database Configuration ```yaml database: host: postgres.inventory.svc.cluster.local port: 5432 database: infrastructure username: inventory password: ${DB_PASSWORD} ssl_mode: require ``` ## Backup and Recovery ### Backup Inventory ```bash # Backup inventory database ./database/backup.sh --output inventory-backup-$(date +%Y%m%d).sql ``` ### Restore Inventory ```bash # Restore inventory database ./database/restore.sh --backup inventory-backup-20240101.sql ``` ## Reporting ### Generate Reports ```bash # Generate inventory report ./database/report.sh --site us-east-1 --format html # Generate asset report ./database/asset-report.sh --format csv ``` ## Related Documentation - [Proxmox Management](../proxmox/README.md) - [Omada Management](../omada/README.md) - [Network Management](../network/README.md) - [Infrastructure Management](../README.md)