feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues: ## Discovery System Fixes - Fixed console commands not being discovered on first run - Implemented fallback discovery for empty caches - Added context-aware caching with separate cache keys - Fixed object serialization preventing __PHP_Incomplete_Class ## Cache System Improvements - Smart caching that only caches meaningful results - Separate caches for different execution contexts (console, web, test) - Proper array serialization/deserialization for cache compatibility - Cache hit logging for debugging and monitoring ## Object Serialization Fixes - Fixed DiscoveredAttribute serialization with proper string conversion - Sanitized additional data to prevent object reference issues - Added fallback for corrupted cache entries ## Performance & Reliability - All 69 console commands properly discovered and cached - 534 total discovery items successfully cached and restored - No more __PHP_Incomplete_Class cache corruption - Improved error handling and graceful fallbacks ## Testing & Quality - Fixed code style issues across discovery components - Enhanced logging for better debugging capabilities - Improved cache validation and error recovery Ready for production deployment with stable discovery system. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
---
|
||||
# Health Checks Configuration
|
||||
|
||||
- name: Create health check scripts
|
||||
template:
|
||||
src: health-check.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/health-check-{{ item.name }}.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
loop: "{{ service_checks }}"
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- scripts
|
||||
|
||||
- name: Create application health check script
|
||||
template:
|
||||
src: app-health-check.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/app-health-check.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- application
|
||||
|
||||
- name: Create framework-specific health checks
|
||||
template:
|
||||
src: framework-health-check.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/framework-health-check.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- framework
|
||||
|
||||
- name: Create comprehensive health check runner
|
||||
template:
|
||||
src: run-health-checks.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/run-health-checks.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- runner
|
||||
|
||||
- name: Create health check systemd service
|
||||
template:
|
||||
src: health-check.service.j2
|
||||
dest: /etc/systemd/system/health-check.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: reload systemd
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- systemd
|
||||
|
||||
- name: Create health check systemd timer
|
||||
template:
|
||||
src: health-check.timer.j2
|
||||
dest: /etc/systemd/system/health-check.timer
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
notify: reload systemd
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- systemd
|
||||
|
||||
- name: Enable and start health check timer
|
||||
systemd:
|
||||
name: health-check.timer
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- systemd
|
||||
|
||||
- name: Create health check status endpoint
|
||||
template:
|
||||
src: health-status.php.j2
|
||||
dest: /var/www/html/health
|
||||
owner: "{{ nginx_user | default('www-data') }}"
|
||||
group: "{{ nginx_group | default('www-data') }}"
|
||||
mode: '0644'
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- web
|
||||
|
||||
- name: Schedule individual health checks
|
||||
cron:
|
||||
name: "Health check - {{ item.name }}"
|
||||
minute: "*/{{ item.interval }}"
|
||||
job: "{{ monitoring_scripts_dir }}/health-check-{{ item.name }}.sh"
|
||||
user: "{{ monitoring_user }}"
|
||||
loop: "{{ service_checks }}"
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
- cron
|
||||
67
deployment/infrastructure/roles/monitoring/tasks/main.yml
Normal file
67
deployment/infrastructure/roles/monitoring/tasks/main.yml
Normal file
@@ -0,0 +1,67 @@
|
||||
---
|
||||
# Monitoring Role - Main Tasks
|
||||
|
||||
- name: Include OS-specific variables
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
tags:
|
||||
- monitoring
|
||||
- config
|
||||
|
||||
- name: Setup monitoring infrastructure
|
||||
include_tasks: setup-monitoring.yml
|
||||
tags:
|
||||
- monitoring
|
||||
- setup
|
||||
|
||||
- name: Install and configure Node Exporter
|
||||
include_tasks: node-exporter.yml
|
||||
when: node_exporter_enabled | bool
|
||||
tags:
|
||||
- monitoring
|
||||
- node-exporter
|
||||
|
||||
- name: Setup health checks
|
||||
include_tasks: health-checks.yml
|
||||
when: health_checks_enabled | bool
|
||||
tags:
|
||||
- monitoring
|
||||
- health-checks
|
||||
|
||||
- name: Configure system monitoring
|
||||
include_tasks: system-monitoring.yml
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
|
||||
- name: Setup application monitoring
|
||||
include_tasks: app-monitoring.yml
|
||||
tags:
|
||||
- monitoring
|
||||
- application
|
||||
|
||||
- name: Configure Docker monitoring
|
||||
include_tasks: docker-monitoring.yml
|
||||
when: docker_monitoring_enabled | bool
|
||||
tags:
|
||||
- monitoring
|
||||
- docker
|
||||
|
||||
- name: Setup log monitoring
|
||||
include_tasks: log-monitoring.yml
|
||||
when: log_monitoring_enabled | bool
|
||||
tags:
|
||||
- monitoring
|
||||
- logs
|
||||
|
||||
- name: Configure alerting
|
||||
include_tasks: alerting.yml
|
||||
when: alerting_enabled | bool
|
||||
tags:
|
||||
- monitoring
|
||||
- alerting
|
||||
|
||||
- name: Setup monitoring cleanup
|
||||
include_tasks: cleanup.yml
|
||||
tags:
|
||||
- monitoring
|
||||
- cleanup
|
||||
@@ -0,0 +1,79 @@
|
||||
---
|
||||
# Monitoring Infrastructure Setup
|
||||
|
||||
- name: Create monitoring user
|
||||
user:
|
||||
name: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
system: true
|
||||
shell: /bin/bash
|
||||
home: "{{ monitoring_home }}"
|
||||
create_home: true
|
||||
tags:
|
||||
- monitoring
|
||||
- users
|
||||
|
||||
- name: Create monitoring group
|
||||
group:
|
||||
name: "{{ monitoring_group }}"
|
||||
system: true
|
||||
tags:
|
||||
- monitoring
|
||||
- users
|
||||
|
||||
- name: Create monitoring directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
loop:
|
||||
- "{{ monitoring_home }}"
|
||||
- "{{ monitoring_scripts_dir }}"
|
||||
- "{{ monitoring_logs_dir }}"
|
||||
- "{{ monitoring_config_dir }}"
|
||||
- /etc/systemd/system
|
||||
tags:
|
||||
- monitoring
|
||||
- directories
|
||||
|
||||
- name: Install monitoring dependencies
|
||||
package:
|
||||
name:
|
||||
- curl
|
||||
- wget
|
||||
- jq
|
||||
- bc
|
||||
- mailutils
|
||||
- logrotate
|
||||
state: present
|
||||
tags:
|
||||
- monitoring
|
||||
- packages
|
||||
|
||||
- name: Create monitoring configuration file
|
||||
template:
|
||||
src: monitoring.conf.j2
|
||||
dest: "{{ monitoring_config_dir }}/monitoring.conf"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0644'
|
||||
tags:
|
||||
- monitoring
|
||||
- config
|
||||
|
||||
- name: Create monitoring utility scripts
|
||||
template:
|
||||
src: "{{ item }}.sh.j2"
|
||||
dest: "{{ monitoring_scripts_dir }}/{{ item }}.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
loop:
|
||||
- monitoring-utils
|
||||
- send-alert
|
||||
- check-thresholds
|
||||
tags:
|
||||
- monitoring
|
||||
- scripts
|
||||
@@ -0,0 +1,108 @@
|
||||
---
|
||||
# System Resource Monitoring
|
||||
|
||||
- name: Create system monitoring script
|
||||
template:
|
||||
src: system-monitor.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/system-monitor.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- scripts
|
||||
|
||||
- name: Create resource usage checker
|
||||
template:
|
||||
src: check-resources.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/check-resources.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- resources
|
||||
|
||||
- name: Create disk usage monitoring script
|
||||
template:
|
||||
src: check-disk-usage.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/check-disk-usage.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- disk
|
||||
|
||||
- name: Create memory monitoring script
|
||||
template:
|
||||
src: check-memory.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/check-memory.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- memory
|
||||
|
||||
- name: Create CPU monitoring script
|
||||
template:
|
||||
src: check-cpu.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/check-cpu.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- cpu
|
||||
|
||||
- name: Create load average monitoring script
|
||||
template:
|
||||
src: check-load.sh.j2
|
||||
dest: "{{ monitoring_scripts_dir }}/check-load.sh"
|
||||
owner: "{{ monitoring_user }}"
|
||||
group: "{{ monitoring_group }}"
|
||||
mode: '0755'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- load
|
||||
|
||||
- name: Schedule system resource monitoring
|
||||
cron:
|
||||
name: "System resource monitoring"
|
||||
minute: "*/5"
|
||||
job: "{{ monitoring_scripts_dir }}/system-monitor.sh"
|
||||
user: "{{ monitoring_user }}"
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- cron
|
||||
|
||||
- name: Schedule resource usage alerts
|
||||
cron:
|
||||
name: "Resource usage alerts"
|
||||
minute: "*/10"
|
||||
job: "{{ monitoring_scripts_dir }}/check-resources.sh"
|
||||
user: "{{ monitoring_user }}"
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- alerts
|
||||
|
||||
- name: Create system monitoring log rotation
|
||||
template:
|
||||
src: system-monitoring-logrotate.j2
|
||||
dest: /etc/logrotate.d/system-monitoring
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
tags:
|
||||
- monitoring
|
||||
- system
|
||||
- logrotate
|
||||
Reference in New Issue
Block a user