From 0452982fe54f32637ec34daa816841a5c8a1cc63 Mon Sep 17 00:00:00 2001 From: Maksym Buz Date: Tue, 16 Dec 2025 15:57:05 +0100 Subject: [PATCH] Docs: Add CHANGELOG and bump version to 0.4.0 --- partitioning/CHANGELOG.md | 28 ++++++++++++++++++++++ partitioning/script/zabbix_partitioning.py | 10 ++------ 2 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 partitioning/CHANGELOG.md mode change 100644 => 100755 partitioning/script/zabbix_partitioning.py diff --git a/partitioning/CHANGELOG.md b/partitioning/CHANGELOG.md new file mode 100644 index 0000000..eee1cd5 --- /dev/null +++ b/partitioning/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +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.0] - 2025-12-16 +### Added +- **Monitoring**: Added `--discovery` argument for Zabbix Low-Level Discovery (LLD) of partitioned tables. +- **Monitoring**: Added `--check-days` argument to calculate days remaining until partition buffer exhaustion. +- **CLI**: Added `--version` / `-V` flag to display script version. +- **Docker**: Added `RUN_MODE=discovery` and `RUN_MODE=check` support to `entrypoint.py`. +- **Templates**: Added Zabbix 7.0 compatible template `zabbix_partitioning_template.yaml`. + +### Removed +- **CLI**: Removed unimplemented `--delete` / `-d` argument. + +## [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`). + +### 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. diff --git a/partitioning/script/zabbix_partitioning.py b/partitioning/script/zabbix_partitioning.py old mode 100644 new mode 100755 index 86405e8..46306cd --- a/partitioning/script/zabbix_partitioning.py +++ b/partitioning/script/zabbix_partitioning.py @@ -21,7 +21,7 @@ from typing import Optional, Dict, List, Any, Union, Tuple from contextlib import contextmanager # Semantic Versioning -VERSION = '0.3.0' +VERSION = '0.4.0' # Constants PART_PERIOD_REGEX = r'([0-9]+)(h|d|m|y)' @@ -521,11 +521,6 @@ class ZabbixPartitioner: self.check_compatibility() premake = self.config.get('premake', 10) - if mode == 'delete': - self.logger.warning("Delete Mode: Removing ALL partitioning from configured tables is not fully implemented in refactor yet.") - # Implement if needed, usually just ALTER TABLE REMOVE PARTITIONING - return - for period, tables in partitions_conf.items(): if not tables: continue @@ -567,12 +562,12 @@ 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('-d', '--delete', action='store_true', help='Remove partitions (Not implemented)') parser.add_argument('--dry-run', action='store_true', help='Simulate queries') # Monitoring args parser.add_argument('--discovery', action='store_true', help='Output Zabbix LLD JSON') parser.add_argument('--check-days', type=str, help='Check days of future partitions left for table', metavar='TABLE') + parser.add_argument('-V', '--version', action='version', version=f'%(prog)s {VERSION}', help='Show version and exit') return parser.parse_args() @@ -607,7 +602,6 @@ def main(): mode = 'check' target = args.check_days elif args.init: mode = 'init' - elif args.delete: mode = 'delete' # Setup logging # If discovery or check, we mute info logs to stdout to keep output clean,