Docs: Add CHANGELOG and bump version to 0.4.0
This commit is contained in:
28
partitioning/CHANGELOG.md
Normal file
28
partitioning/CHANGELOG.md
Normal file
@@ -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.
|
||||||
10
partitioning/script/zabbix_partitioning.py
Normal file → Executable file
10
partitioning/script/zabbix_partitioning.py
Normal file → Executable file
@@ -21,7 +21,7 @@ from typing import Optional, Dict, List, Any, Union, Tuple
|
|||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
# Semantic Versioning
|
# Semantic Versioning
|
||||||
VERSION = '0.3.0'
|
VERSION = '0.4.0'
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
PART_PERIOD_REGEX = r'([0-9]+)(h|d|m|y)'
|
PART_PERIOD_REGEX = r'([0-9]+)(h|d|m|y)'
|
||||||
@@ -521,11 +521,6 @@ class ZabbixPartitioner:
|
|||||||
self.check_compatibility()
|
self.check_compatibility()
|
||||||
premake = self.config.get('premake', 10)
|
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():
|
for period, tables in partitions_conf.items():
|
||||||
if not tables:
|
if not tables:
|
||||||
continue
|
continue
|
||||||
@@ -567,12 +562,12 @@ def parse_args():
|
|||||||
parser = argparse.ArgumentParser(description='Zabbix Partitioning Manager')
|
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('-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('-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')
|
parser.add_argument('--dry-run', action='store_true', help='Simulate queries')
|
||||||
|
|
||||||
# Monitoring args
|
# Monitoring args
|
||||||
parser.add_argument('--discovery', action='store_true', help='Output Zabbix LLD JSON')
|
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('--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()
|
return parser.parse_args()
|
||||||
|
|
||||||
@@ -607,7 +602,6 @@ def main():
|
|||||||
mode = 'check'
|
mode = 'check'
|
||||||
target = args.check_days
|
target = args.check_days
|
||||||
elif args.init: mode = 'init'
|
elif args.init: mode = 'init'
|
||||||
elif args.delete: mode = 'delete'
|
|
||||||
|
|
||||||
# Setup logging
|
# Setup logging
|
||||||
# If discovery or check, we mute info logs to stdout to keep output clean,
|
# If discovery or check, we mute info logs to stdout to keep output clean,
|
||||||
|
|||||||
Reference in New Issue
Block a user