Compare commits
2 Commits
060c5cd2db
...
a61f2bdf30
| Author | SHA1 | Date | |
|---|---|---|---|
| a61f2bdf30 | |||
| 66b1cc036b |
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.4.1] - 2025-12-16
|
||||
### Added
|
||||
- **CLI**: Added `--verbose` / `-v` flag to switch between INFO (default) and DEBUG logging levels.
|
||||
- **CLI**: Added `-r` short flag for `--dry-run`.
|
||||
|
||||
## [0.4.0] - 2025-12-16
|
||||
### Added
|
||||
- **Monitoring**: Added `--discovery` argument for Zabbix Low-Level Discovery (LLD) of partitioned tables.
|
||||
@@ -19,10 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [0.3.0] - 2025-12-14
|
||||
### Changed
|
||||
- **Refactor**: Complete rewrite of `zabbix_partitioning.py` using Class-based structure (`ZabbixPartitioner`).
|
||||
- **Configuration**: Switched to YAML configuration file (`zabbix_partitioning.conf`).
|
||||
- **Safety**: Added checks to prevent partitioning of tables incompatible with Zabbix 7.0 schema (e.g., `auditlog` without `clock` in PK).
|
||||
- **Docker**: Introduced Docker container support (`Dockerfile`, `entrypoint.py`).
|
||||
- **Configuration**: Extended comments in the configuration file (`zabbix_partitioning.conf`). The config file is self-explanatory now.
|
||||
- **Docker**: Introduced Docker container support (`Dockerfile`, `entrypoint.py`). The script can be run in a stateless manner using Docker.
|
||||
|
||||
### Added
|
||||
- **Optimization**: Added `initial_partitioning_start` option (`db_min` vs `retention`) to speed up initialization on large DBs.
|
||||
- **Reliability**: Use `pymysql` with robust connection handling and SSL support.
|
||||
- **Optimization**: Added `initial_partitioning_start` option (`db_min` vs `retention`) to speed up initialization on large DBs.
|
||||
@@ -21,7 +21,7 @@ from typing import Optional, Dict, List, Any, Union, Tuple
|
||||
from contextlib import contextmanager
|
||||
|
||||
# Semantic Versioning
|
||||
VERSION = '0.4.0'
|
||||
VERSION = '0.4.1'
|
||||
|
||||
# Constants
|
||||
PART_PERIOD_REGEX = r'([0-9]+)(h|d|m|y)'
|
||||
@@ -543,9 +543,9 @@ class ZabbixPartitioner:
|
||||
if mode != 'init' and not self.dry_run:
|
||||
pass
|
||||
|
||||
def setup_logging(config_log_type: str):
|
||||
def setup_logging(config_log_type: str, verbose: bool = False):
|
||||
logger = logging.getLogger('zabbix_partitioning')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.setLevel(logging.DEBUG if verbose else logging.INFO)
|
||||
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
@@ -562,7 +562,8 @@ def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Zabbix Partitioning Manager')
|
||||
parser.add_argument('-c', '--config', default='/etc/zabbix/zabbix_partitioning.conf', help='Config file path')
|
||||
parser.add_argument('-i', '--init', action='store_true', help='Initialize partitions')
|
||||
parser.add_argument('--dry-run', action='store_true', help='Simulate queries')
|
||||
parser.add_argument('-r', '--dry-run', action='store_true', help='Simulate queries')
|
||||
parser.add_argument('-v', '--verbose', action='store_true', help='Enable debug logging')
|
||||
|
||||
# Monitoring args
|
||||
parser.add_argument('--discovery', action='store_true', help='Output Zabbix LLD JSON')
|
||||
@@ -604,12 +605,10 @@ def main():
|
||||
elif args.init: mode = 'init'
|
||||
|
||||
# Setup logging
|
||||
# If discovery or check, we mute info logs to stdout to keep output clean,
|
||||
# unless errors happen.
|
||||
if mode in ['discovery', 'check']:
|
||||
logging.basicConfig(level=logging.ERROR) # Only show critical errors
|
||||
else:
|
||||
setup_logging(config.get('logging', 'console'))
|
||||
setup_logging(config.get('logging', 'console'), verbose=args.verbose)
|
||||
|
||||
logger = logging.getLogger('zabbix_partitioning')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user