...
This commit is contained in:
@@ -57,3 +57,4 @@ UserParameter=python.exception.handler.active,python3 -c "import sys; sys.path.i
|
||||
|
||||
# Alternative check: Prüfe ob Handler-Modul existiert
|
||||
UserParameter=python.exception.handler.available,[ -f /usr/lib/python3.12/zabbix_exception_handler.py ] && echo "1" || echo "0"
|
||||
|
||||
|
||||
@@ -8,16 +8,13 @@ This demonstrates how to use the Zabbix exception monitoring in your Python appl
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Add the Zabbix module path
|
||||
sys.path.insert(0, '/usr/lib/python3.12')
|
||||
# Optional: Add the Zabbix module path
|
||||
# sys.path.insert(0, '/usr/lib/python3.12')
|
||||
|
||||
# Method 1: Import the main handler (auto-initializes)
|
||||
import zabbix_exception_handler
|
||||
from zabbix_monitor import zabbix_monitor
|
||||
|
||||
# Method 2: Alternative simple import (also auto-initializes)
|
||||
# import zabbix_monitor
|
||||
|
||||
# Method 3: Manual initialization (if you want more control)
|
||||
# Method 2: Manual initialization (if you want more control)
|
||||
# from zabbix_exception_handler import ZabbixPythonExceptionHandler
|
||||
# ZabbixPythonExceptionHandler.init()
|
||||
|
||||
@@ -66,7 +66,7 @@ zabbix_export:
|
||||
}
|
||||
triggers:
|
||||
- uuid: 9df96b18c230490a9a0a9e2307226352
|
||||
expression: 'length(last(/Python Exceptions Monitoring/python.exception.latest)) > 15'
|
||||
expression: 'length(last(/Python Exceptions Monitoring/python.exception.latest)) > 15 and change(/Python Exceptions Monitoring/python.exception.latest) <> 0'
|
||||
name: 'Python Exception Detected'
|
||||
event_name: 'New Python Exception Logged'
|
||||
priority: HIGH
|
||||
@@ -106,6 +106,7 @@ zabbix_export:
|
||||
value: application
|
||||
- tag: component
|
||||
value: python
|
||||
recovery_mode: NONE
|
||||
- uuid: 8df96b18c230490a9a0a9e2307226343
|
||||
name: 'Python Exception Log Size'
|
||||
type: ZABBIX_PASSIVE
|
||||
|
||||
Reference in New Issue
Block a user