omdnotificationforwarder 2.7__tar.gz → 2.7.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 (40) hide show
  1. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/PKG-INFO +1 -1
  2. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/bin/notificationforwarder +1 -1
  3. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/pyproject.toml +1 -1
  4. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/baseclass.py +17 -1
  5. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/example/forwarder.py +3 -0
  6. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/.gitignore +0 -0
  7. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/README.md +0 -0
  8. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/email/formatter.py +0 -0
  9. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/email/forwarder.py +0 -0
  10. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/example/formatter.py +0 -0
  11. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/naemonlog/reporter.py +0 -0
  12. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/rabbitmq/formatter.py +0 -0
  13. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/rabbitmq/forwarder.py +0 -0
  14. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/syslog/formatter.py +0 -0
  15. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/syslog/forwarder.py +0 -0
  16. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/telegram/forwarder.py +0 -0
  17. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/src/notificationforwarder/webhook/forwarder.py +0 -0
  18. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/lib/python/notificationforwarder/split1/forwarder.py +0 -0
  19. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/lib/python/notificationforwarder/split2/formatter.py +0 -0
  20. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/lib/python/notificationforwarder/split2/forwarder.py +0 -0
  21. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/lib/python/notificationforwarder/split3/formatter.py +0 -0
  22. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/lib/python/notificationforwarder/split3/forwarder.py +0 -0
  23. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/alertmanager_servicenow/formatter.py +0 -0
  24. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/bayern/formatter.py +0 -0
  25. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/discard/formatter.py +0 -0
  26. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split1/formatter.py +0 -0
  27. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split2/forwarder.py +0 -0
  28. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split3/formatter.py +0 -0
  29. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split3/forwarder.py +0 -0
  30. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split4/formatter.py +0 -0
  31. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/split4/forwarder.py +0 -0
  32. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/pythonpath/local/lib/python/notificationforwarder/vong/formatter.py +0 -0
  33. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_alertmanager.py +0 -0
  34. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_classes.py +0 -0
  35. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_discard.py +0 -0
  36. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_formatter.py +0 -0
  37. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_package.py +0 -0
  38. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_paths.py +0 -0
  39. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_reporter.py +0 -0
  40. {omdnotificationforwarder-2.7 → omdnotificationforwarder-2.7.1}/tests/test_webhook.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: omdnotificationforwarder
3
- Version: 2.7
3
+ Version: 2.7.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
@@ -74,7 +74,7 @@ Example for an HTTP-based reporter:
74
74
  help='Increase the log level to DEBUG',
75
75
  default=False)
76
76
  parser.add_argument('--version', action='version',
77
- version=f'%(prog)s 2.7')
77
+ version=f'%(prog)s 2.7.1')
78
78
 
79
79
  args = parser.parse_args()
80
80
  if not hasattr(args, 'formatter'):
@@ -21,7 +21,7 @@ packages = ["src/notificationforwarder"]
21
21
 
22
22
  [project]
23
23
  name = "omdnotificationforwarder"
24
- version = "2.7"
24
+ version = "2.7.1"
25
25
  authors = [
26
26
  { name="Gerhard Lausser", email="lausser@yahoo.com" },
27
27
  ]
@@ -280,6 +280,18 @@ class NotificationForwarder(object):
280
280
  formatted_event.eventopts["formatter_summary"] = formatted_event.summary
281
281
  self.report_event(formatted_event)
282
282
 
283
+ def forward_multiple(self, raw_event):
284
+ # this method requires a formatter which implements a method split_events!
285
+ instance = self.new_formatter()
286
+ try:
287
+ raw_event_list = instance.split_events(raw_event)
288
+ instance = None
289
+ logger.debug(f"received a payload with {len(raw_event_list)} single events")
290
+ for raw_event in raw_event_list:
291
+ self.forward(raw_event)
292
+ except Exception as e:
293
+ logger.critical(f"error split_events failed for {raw_event}")
294
+
283
295
  def enrich_raw_event(self, raw_event):
284
296
  if not "omd_site" in raw_event:
285
297
  raw_event["omd_site"] = os.environ.get("OMD_SITE", "get https://omd.consol.de/docs/omd")
@@ -372,7 +384,7 @@ class NotificationForwarder(object):
372
384
  sql_select = "SELECT id, payload FROM "+self.table_name+" ORDER BY id LIMIT 10"
373
385
  sql_delete_id = "DELETE FROM "+self.table_name+" WHERE id = ?"
374
386
  with open(self.db_lock_file, "w") as lock_file:
375
- locked = acquire_lock_with_retry(lock_file)
387
+ locked = self.acquire_lock_with_retry(lock_file)
376
388
  if locked:
377
389
  try:
378
390
  outdated = int(time.time() - 60*self.max_spool_minutes)
@@ -449,6 +461,10 @@ class NotificationFormatter(metaclass=ABCMeta):
449
461
  def format_event(self):
450
462
  pass
451
463
 
464
+ @abstractmethod
465
+ def split_events(self):
466
+ pass
467
+
452
468
 
453
469
  class FormattedEvent(metaclass=ABCMeta):
454
470
  def __init__(self, eventopts):
@@ -39,3 +39,6 @@ class ExampleForwarder(NotificationForwarder):
39
39
  else:
40
40
  logger.critical("could not connect to the ticket system")
41
41
  return False
42
+
43
+ def probe(self):
44
+ return True