Major refactoring of the codebase, including restructuring of files and directories, renaming of modules and classes, and improvements to the overall organization and readability of the code. This refactoring aims to enhance maintainability, scalability, and clarity of the codebase while preserving existing functionality. The changes include:
- Restructuring of the project directory into client and server components - Renaming of modules and classes to better reflect their purpose and functionality - Moving common utilities and configurations to a shared location - Updating import statements to reflect the new structure - Adding new documentation files for better clarity on various aspects of the project - Removing deprecated or unused code to streamline the codebase - Ensuring that all existing functionality is preserved and that the codebase remains functional after the refactoring.
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
# Example Heartbeat Client Configuration
|
||||
# This file demonstrates all available configuration options for the heartbeat client (hbc)
|
||||
# and its plugin system.
|
||||
|
||||
# ==============================================================================
|
||||
# Server Configuration
|
||||
# ==============================================================================
|
||||
server: hbd.example.com # Heartbeat server hostname or IP
|
||||
port: 50003 # Server UDP port (default: 50003)
|
||||
interval: 30 # Heartbeat interval in seconds (default: 30)
|
||||
|
||||
# ==============================================================================
|
||||
# Plugin Configuration
|
||||
# ==============================================================================
|
||||
# Plugins are configured under the "plugins" section. Each plugin can be enabled/disabled
|
||||
# and configured with plugin-specific settings.
|
||||
|
||||
plugins:
|
||||
# --------------------------------------------------------------------------
|
||||
# OS Information Plugin (InfoPlugin - runs once at startup)
|
||||
# --------------------------------------------------------------------------
|
||||
os_info:
|
||||
enabled: true
|
||||
# No additional configuration needed
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# CPU Monitor Plugin (MonitorPlugin - periodic collection)
|
||||
# --------------------------------------------------------------------------
|
||||
cpu_monitor:
|
||||
enabled: true
|
||||
interval: 300 # Collection interval in seconds (default: 300 = 5 minutes)
|
||||
per_core: false # Collect per-core CPU statistics (default: false)
|
||||
# When per_core is true, will report CPU usage for each core separately
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Memory Monitor Plugin (MonitorPlugin)
|
||||
# --------------------------------------------------------------------------
|
||||
memory_monitor:
|
||||
enabled: true
|
||||
interval: 300 # Collection interval in seconds (default: 300 = 5 minutes)
|
||||
include_swap: true # Include swap memory statistics (default: true)
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Disk Monitor Plugin (MonitorPlugin)
|
||||
# --------------------------------------------------------------------------
|
||||
disk_monitor:
|
||||
enabled: true
|
||||
interval: 300 # Collection interval in seconds (default: 300 = 5 minutes)
|
||||
include_io: true # Include I/O statistics (default: true)
|
||||
# Optional: Monitor only specific partitions
|
||||
# partitions:
|
||||
# - /
|
||||
# - /home
|
||||
# - /var
|
||||
# Optional: Exclude specific filesystem types
|
||||
exclude_types:
|
||||
- tmpfs
|
||||
- devtmpfs
|
||||
- squashfs
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Network Monitor Plugin (MonitorPlugin)
|
||||
# --------------------------------------------------------------------------
|
||||
network_monitor:
|
||||
enabled: true
|
||||
interval: 300 # Collection interval in seconds (default: 300 = 5 minutes)
|
||||
include_connections: true # Include connection statistics (default: true)
|
||||
include_addresses: false # Include interface addresses (default: false)
|
||||
# Optional: Monitor only specific interfaces
|
||||
# interfaces:
|
||||
# - eth0
|
||||
# - wlan0
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Filesystem Info Plugin (InfoPlugin - runs once at startup)
|
||||
# --------------------------------------------------------------------------
|
||||
filesystem_info:
|
||||
enabled: true
|
||||
include_pseudo: false # Include pseudo/virtual filesystems (default: false)
|
||||
# When false (default), only reports physical mounted filesystems (ext4, zfs, xfs, etc.)
|
||||
# When true, also includes pseudo filesystems (proc, sysfs, tmpfs, devtmpfs, etc.)
|
||||
# Optional: Exclude additional specific filesystem types
|
||||
# exclude_types:
|
||||
# - squashfs
|
||||
# - iso9660
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# Nagios Runner Plugin (MonitorPlugin)
|
||||
# --------------------------------------------------------------------------
|
||||
nagios_runner:
|
||||
enabled: true
|
||||
interval: 300 # Collection interval in seconds (default: 300 = 5 minutes)
|
||||
timeout: 30 # Plugin execution timeout in seconds (default: 30)
|
||||
|
||||
# List of Nagios plugins to execute
|
||||
# Each command is executed as-is, so provide full paths and arguments
|
||||
commands:
|
||||
# System load monitoring
|
||||
- /usr/lib/nagios/plugins/check_load -w 5,4,3 -c 10,8,6
|
||||
|
||||
# Disk space monitoring
|
||||
- /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
|
||||
- /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /home
|
||||
|
||||
# Process monitoring
|
||||
- /usr/lib/nagios/plugins/check_procs -w 250 -c 400 -s RSZDT
|
||||
|
||||
# Swap usage
|
||||
- /usr/lib/nagios/plugins/check_swap -w 20% -c 10%
|
||||
|
||||
# Custom script example
|
||||
# - /usr/local/bin/check_my_app.sh
|
||||
|
||||
# ==============================================================================
|
||||
# Advanced Options
|
||||
# ==============================================================================
|
||||
# These options control client behavior
|
||||
|
||||
# Compression: Enable zlib compression for heartbeat messages (default: true)
|
||||
compress: true
|
||||
|
||||
# Hostname: Override the system hostname (default: auto-detect)
|
||||
# hostname: myhost.example.com
|
||||
|
||||
# Message: Custom message included in heartbeat (optional)
|
||||
# message: "Production web server"
|
||||
|
||||
# Logging
|
||||
log_level: INFO # Log level: DEBUG, INFO, WARNING, ERROR (default: INFO)
|
||||
# logfile: /var/log/hbc.log # Optional log file path
|
||||
|
||||
# ==============================================================================
|
||||
# Example Profiles
|
||||
# ==============================================================================
|
||||
# Below are example configuration profiles for different use cases
|
||||
|
||||
# Minimal Configuration (default settings):
|
||||
# -----------------------------------------
|
||||
# server: hbd.example.com
|
||||
# interval: 30
|
||||
|
||||
# Monitoring Server (comprehensive metrics):
|
||||
# ------------------------------------------
|
||||
# server: monitoring.example.com
|
||||
# interval: 30
|
||||
# plugins:
|
||||
# cpu_monitor:
|
||||
# enabled: true
|
||||
# interval: 15
|
||||
# per_core: true
|
||||
# memory_monitor:
|
||||
# enabled: true
|
||||
# interval: 15
|
||||
# disk_monitor:
|
||||
# enabled: true
|
||||
# interval: 60
|
||||
# network_monitor:
|
||||
# enabled: true
|
||||
# interval: 30
|
||||
# include_connections: true
|
||||
|
||||
# Nagios Integration (leverage existing plugins):
|
||||
# -----------------------------------------------
|
||||
# server: hbd.example.com
|
||||
# plugins:
|
||||
# nagios_runner:
|
||||
# enabled: true
|
||||
# interval: 300 # Check every 5 minutes
|
||||
# commands:
|
||||
# - /usr/lib/nagios/plugins/check_http -H localhost -p 80
|
||||
# - /usr/lib/nagios/plugins/check_mysql -H localhost -u monitor -p password
|
||||
# - /usr/lib/nagios/plugins/check_smtp -H mail.example.com
|
||||
|
||||
# ==============================================================================
|
||||
# Threshold Configuration (for Heartbeat Daemon)
|
||||
# ==============================================================================
|
||||
# NOTE: Thresholds are configured on the SERVER side (hbd), not the client (hbc).
|
||||
# This is just an example - see config_thresholds_example.yaml for comprehensive examples.
|
||||
#
|
||||
# Basic threshold example:
|
||||
# thresholds:
|
||||
# cpu_monitor:
|
||||
# cpu_percent:
|
||||
# warning: 80.0
|
||||
# critical: 90.0
|
||||
# memory_monitor:
|
||||
# percent:
|
||||
# warning: 85.0
|
||||
# critical: 95.0
|
||||
# disk_monitor:
|
||||
# partitions:
|
||||
# /:
|
||||
# percent:
|
||||
# warning: 80.0
|
||||
# critical: 90.0
|
||||
|
||||
Reference in New Issue
Block a user