omdnotificationforwarder 3.0__tar.gz → 4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/.gitignore +2 -0
  2. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/PKG-INFO +57 -2
  3. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/README.md +56 -1
  4. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/bin/notificationforwarder +1 -1
  5. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/pyproject.toml +1 -1
  6. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/baseclass.py +160 -203
  7. omdnotificationforwarder-4.1/src/notificationforwarder/component_loader.py +117 -0
  8. omdnotificationforwarder-4.1/src/notificationforwarder/runtime_config.py +110 -0
  9. omdnotificationforwarder-4.1/src/notificationforwarder/runtime_flow.py +48 -0
  10. omdnotificationforwarder-4.1/src/notificationforwarder/spool.py +83 -0
  11. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/text/logger.py +23 -0
  12. omdnotificationforwarder-4.1/tests/test_delivery_resilience.py +150 -0
  13. omdnotificationforwarder-4.1/tests/test_runtime_foundation.py +142 -0
  14. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/email/formatter.py +0 -0
  15. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/email/forwarder.py +0 -0
  16. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/example/formatter.py +0 -0
  17. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/example/forwarder.py +0 -0
  18. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/json/__init__.py +0 -0
  19. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/json/logger.py +0 -0
  20. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/naemonlog/reporter.py +0 -0
  21. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/rabbitmq/formatter.py +0 -0
  22. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/rabbitmq/forwarder.py +0 -0
  23. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/syslog/formatter.py +0 -0
  24. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/syslog/forwarder.py +0 -0
  25. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/telegram/forwarder.py +0 -0
  26. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/text/__init__.py +0 -0
  27. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/src/notificationforwarder/webhook/forwarder.py +0 -0
  28. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/lib/python/notificationforwarder/split1/forwarder.py +0 -0
  29. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/lib/python/notificationforwarder/split2/formatter.py +0 -0
  30. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/lib/python/notificationforwarder/split2/forwarder.py +0 -0
  31. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/lib/python/notificationforwarder/split3/formatter.py +0 -0
  32. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/lib/python/notificationforwarder/split3/forwarder.py +0 -0
  33. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/alertmanager_servicenow/formatter.py +0 -0
  34. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/bayern/formatter.py +0 -0
  35. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/datadup/formatter.py +0 -0
  36. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/datapost/formatter.py +0 -0
  37. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/discard/formatter.py +0 -0
  38. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split1/formatter.py +0 -0
  39. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split2/forwarder.py +0 -0
  40. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split3/formatter.py +0 -0
  41. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split3/forwarder.py +0 -0
  42. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split4/formatter.py +0 -0
  43. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/split4/forwarder.py +0 -0
  44. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/ticketsystem/forwarder.py +0 -0
  45. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/ticketsystem/reporter.py +0 -0
  46. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/pythonpath/local/lib/python/notificationforwarder/vong/formatter.py +0 -0
  47. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_alertmanager.py +0 -0
  48. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_classes.py +0 -0
  49. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_discard.py +0 -0
  50. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_formatter.py +0 -0
  51. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_logger.py +0 -0
  52. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_package.py +0 -0
  53. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_paths.py +0 -0
  54. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_reporter.py +0 -0
  55. {omdnotificationforwarder-3.0 → omdnotificationforwarder-4.1}/tests/test_webhook.py +0 -0
@@ -4,3 +4,5 @@ dist
4
4
  sdist
5
5
  *.egg
6
6
  examples/
7
+ .opencode/
8
+ notificationforwarder/tests/var/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omdnotificationforwarder
3
- Version: 3.0
3
+ Version: 4.1
4
4
  Summary: A framework for notification scripts for OMD
5
5
  Project-URL: Homepage, https://github.com/lausser/noteventificationforhandlerwarder
6
6
  Project-URL: Bug Tracker, https://github.com/lausser/noteventificationforhandlerwarder/issues
@@ -349,6 +349,62 @@ class MyloggerLogger(NotificationLogger):
349
349
  pass
350
350
  ```
351
351
 
352
+ ## Runtime Architecture
353
+
354
+ The runtime keeps the historical CLI and plugin model, but the core flow is now split into clearer responsibilities instead of concentrating everything in one large class.
355
+
356
+ - `baseclass.new(...)`: compatibility entrypoint that creates a configured forwarder instance.
357
+ - `runtime_config.py`: normalizes runtime options, default values, log naming, and spool-related paths.
358
+ - `component_loader.py`: resolves and loads forwarders, formatters, reporters, and loggers using the established naming rules.
359
+ - `runtime_flow.py`: enriches raw events and applies the common forwarding/reporting result flow.
360
+ - `spool.py`: owns sqlite spool persistence, replay batches, and flush-lock retry behavior.
361
+
362
+ ### Forwarding Flow
363
+
364
+ The runtime flow is:
365
+
366
+ 1. Normalize runtime configuration and initialize logging.
367
+ 2. Load the forwarder implementation.
368
+ 3. Enrich the raw event with OMD/site metadata.
369
+ 4. Load the formatter and build a `FormattedEvent`.
370
+ 5. Attempt delivery.
371
+ 6. If delivery fails, spool the raw event for retry unless it is a heartbeat.
372
+ 7. If a reporter is configured, attach forwarding context and call the reporter.
373
+
374
+ ### Extension Contracts
375
+
376
+ Custom extensions still follow the existing filesystem and naming conventions:
377
+
378
+ - Forwarder: `notificationforwarder/<name>/forwarder.py` with class `<Name>Forwarder`
379
+ - Formatter: `notificationforwarder/<name>/formatter.py` with class `<Name>Formatter`
380
+ - Reporter: `notificationforwarder/<name>/reporter.py` with class `<Name>Reporter`
381
+ - Logger: `notificationforwarder/<name>/logger.py` with class `<Name>Logger`
382
+
383
+ If you pass a dotted class path instead of a simple name, the runtime uses it as an explicit module/class reference. Otherwise it derives the class name by capitalizing the plugin name and appending the expected suffix.
384
+
385
+ ### Runtime Guarantees
386
+
387
+ - Text logging remains the default and fallback logger.
388
+ - Unknown logger implementations fall back to the text logger and emit a warning.
389
+ - Failed deliveries are spooled in sqlite when possible.
390
+ - Spooled events are retried on later executions before the new event is sent, as long as they have not expired.
391
+ - Expired spool entries are dropped during flush and logged as outdated events.
392
+ - Concurrent flush attempts for the same forwarder are suppressed with a lock file.
393
+
394
+ ## Contributor Verification
395
+
396
+ When changing runtime code, run the relevant tests at minimum:
397
+
398
+ ```bash
399
+ pytest tests/test_runtime_foundation.py tests/test_delivery_resilience.py tests/test_classes.py
400
+ ```
401
+
402
+ For broader confidence, run the full suite:
403
+
404
+ ```bash
405
+ pytest
406
+ ```
407
+
352
408
  ## Reporters
353
409
 
354
410
  Like *forwarder* and *formatter*, a *reporter* is an instance of a *NotificationReporter* class defined in a file named *reporter.py*. There is one class coming with notificationforwarder, the *NaemonlogReporter*. It's purpose it to write a message to the Naemon logfile. When notificationforwarder is run as a standalone script (and not triggered as a notificationhandler by Naemon), the *NaemonlogReporter* can nevertheless leave a line in the Naemon log.
@@ -376,4 +432,3 @@ define command{
376
432
  }
377
433
  ```
378
434
 
379
-
@@ -329,6 +329,62 @@ class MyloggerLogger(NotificationLogger):
329
329
  pass
330
330
  ```
331
331
 
332
+ ## Runtime Architecture
333
+
334
+ The runtime keeps the historical CLI and plugin model, but the core flow is now split into clearer responsibilities instead of concentrating everything in one large class.
335
+
336
+ - `baseclass.new(...)`: compatibility entrypoint that creates a configured forwarder instance.
337
+ - `runtime_config.py`: normalizes runtime options, default values, log naming, and spool-related paths.
338
+ - `component_loader.py`: resolves and loads forwarders, formatters, reporters, and loggers using the established naming rules.
339
+ - `runtime_flow.py`: enriches raw events and applies the common forwarding/reporting result flow.
340
+ - `spool.py`: owns sqlite spool persistence, replay batches, and flush-lock retry behavior.
341
+
342
+ ### Forwarding Flow
343
+
344
+ The runtime flow is:
345
+
346
+ 1. Normalize runtime configuration and initialize logging.
347
+ 2. Load the forwarder implementation.
348
+ 3. Enrich the raw event with OMD/site metadata.
349
+ 4. Load the formatter and build a `FormattedEvent`.
350
+ 5. Attempt delivery.
351
+ 6. If delivery fails, spool the raw event for retry unless it is a heartbeat.
352
+ 7. If a reporter is configured, attach forwarding context and call the reporter.
353
+
354
+ ### Extension Contracts
355
+
356
+ Custom extensions still follow the existing filesystem and naming conventions:
357
+
358
+ - Forwarder: `notificationforwarder/<name>/forwarder.py` with class `<Name>Forwarder`
359
+ - Formatter: `notificationforwarder/<name>/formatter.py` with class `<Name>Formatter`
360
+ - Reporter: `notificationforwarder/<name>/reporter.py` with class `<Name>Reporter`
361
+ - Logger: `notificationforwarder/<name>/logger.py` with class `<Name>Logger`
362
+
363
+ If you pass a dotted class path instead of a simple name, the runtime uses it as an explicit module/class reference. Otherwise it derives the class name by capitalizing the plugin name and appending the expected suffix.
364
+
365
+ ### Runtime Guarantees
366
+
367
+ - Text logging remains the default and fallback logger.
368
+ - Unknown logger implementations fall back to the text logger and emit a warning.
369
+ - Failed deliveries are spooled in sqlite when possible.
370
+ - Spooled events are retried on later executions before the new event is sent, as long as they have not expired.
371
+ - Expired spool entries are dropped during flush and logged as outdated events.
372
+ - Concurrent flush attempts for the same forwarder are suppressed with a lock file.
373
+
374
+ ## Contributor Verification
375
+
376
+ When changing runtime code, run the relevant tests at minimum:
377
+
378
+ ```bash
379
+ pytest tests/test_runtime_foundation.py tests/test_delivery_resilience.py tests/test_classes.py
380
+ ```
381
+
382
+ For broader confidence, run the full suite:
383
+
384
+ ```bash
385
+ pytest
386
+ ```
387
+
332
388
  ## Reporters
333
389
 
334
390
  Like *forwarder* and *formatter*, a *reporter* is an instance of a *NotificationReporter* class defined in a file named *reporter.py*. There is one class coming with notificationforwarder, the *NaemonlogReporter*. It's purpose it to write a message to the Naemon logfile. When notificationforwarder is run as a standalone script (and not triggered as a notificationhandler by Naemon), the *NaemonlogReporter* can nevertheless leave a line in the Naemon log.
@@ -356,4 +412,3 @@ define command{
356
412
  }
357
413
  ```
358
414
 
359
-
@@ -78,7 +78,7 @@ Example for an HTTP-based reporter:
78
78
  help='Logger type: text (default) or json, or custom logger module',
79
79
  default='text')
80
80
  parser.add_argument('--version', action='version',
81
- version=f'%(prog)s 3.0')
81
+ version=f'%(prog)s 4.1')
82
82
 
83
83
  args = parser.parse_args()
84
84
  if not hasattr(args, 'formatter'):
@@ -21,7 +21,7 @@ packages = ["src/notificationforwarder"]
21
21
 
22
22
  [project]
23
23
  name = "omdnotificationforwarder"
24
- version = "3.0"
24
+ version = "4.1"
25
25
  authors = [
26
26
  { name="Gerhard Lausser", email="lausser@yahoo.com" },
27
27
  ]