Skip to content

Commit

Permalink
fix: make debug mode more configurable [run-int-tests]
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Kheifets <[email protected]>
  • Loading branch information
ikheifets-splunk committed Sep 10, 2024
1 parent 081412f commit afef8ef
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Common labels
- name: MAX_OID_TO_PROCESS
value: {{ .Values.poller.maxOidToProcess | default "70" | quote }}
- name: PYSNMP_DEBUG
value: {{ .Values.pysnmpDebug | default "false" | quote }}
value: {{ .Values.pysnmpDebug | default "" | quote }}
- name: PROFILES_RELOAD_DELAY
value: {{ .Values.worker.profilesReloadDelay | default "60" | quote }}
- name: MIB_SOURCES
Expand Down
2 changes: 1 addition & 1 deletion charts/splunk-connect-for-snmp/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"type": "array"
},
"pysnmpDebug": {
"type": "boolean"
"type": "string"
},
"UI": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion docker_compose/docker-compose-worker-poller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
- PROFILES_RELOAD_DELAY=${PROFILES_RELOAD_DELAY:-60}
- WORKER_CONCURRENCY=${WORKER_POLLER_CONCURRENCY:-2}
- PREFETCH_COUNT=${PREFETCH_POLLER_COUNT:-1}
- PYSNMP_DEBUG=${PYSNMP_DEBUG:-false}
- PYSNMP_DEBUG=${PYSNMP_DEBUG}
image: ${SC4SNMP_IMAGE}:${SC4SNMP_TAG:-latest}
networks:
- my_network
Expand Down
2 changes: 1 addition & 1 deletion docker_compose/docker-compose-worker-sender.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
- PROFILES_RELOAD_DELAY=${PROFILES_RELOAD_DELAY:-60}
- WORKER_CONCURRENCY=${WORKER_SENDER_CONCURRENCY:-2}
- PREFETCH_COUNT=${PREFETCH_SENDER_COUNT:-1}
- PYSNMP_DEBUG=${PYSNMP_DEBUG:-false}
- PYSNMP_DEBUG=${PYSNMP_DEBUG}
depends_on:
- redis
- mongo
Expand Down
2 changes: 1 addition & 1 deletion docker_compose/docker-compose-worker-trap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
- RESOLVE_TRAP_ADDRESS=${RESOLVE_TRAP_ADDRESS:-false}
- MAX_DNS_CACHE_SIZE_TRAPS=${MAX_DNS_CACHE_SIZE_TRAPS:-500}
- TTL_DNS_CACHE_TRAPS=${TTL_DNS_CACHE_TRAPS:-1800}
- PYSNMP_DEBUG=${PYSNMP_DEBUG:-false}
- PYSNMP_DEBUG=${PYSNMP_DEBUG}
depends_on:
- redis
- mongo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
- name: MAX_OID_TO_PROCESS
value: "70"
- name: PYSNMP_DEBUG
value: "false"
value: ""
- name: PROFILES_RELOAD_DELAY
value: "60"
- name: MIB_SOURCES
Expand Down
13 changes: 11 additions & 2 deletions splunk_connect_for_snmp/snmp/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
PROFILES_RELOAD_DELAY = int(os.getenv("PROFILES_RELOAD_DELAY", "60"))
UDP_CONNECTION_TIMEOUT = int(os.getenv("UDP_CONNECTION_TIMEOUT", 3))
MAX_OID_TO_PROCESS = int(os.getenv("MAX_OID_TO_PROCESS", 70))
PYSNMP_DEBUG = human_bool(os.getenv("PYSNMP_DEBUG", False))
PYSNMP_DEBUG = os.getenv("PYSNMP_DEBUG", "")

DEFAULT_STANDARD_MIBS = [
"HOST-RESOURCES-MIB",
Expand All @@ -78,7 +78,16 @@

if PYSNMP_DEBUG:
from pysnmp import debug
debug.setLogger(debug.Debug('all', options={'loggerName': logger}))

debug_flags = list(debug.flagMap.keys())
enabled_debug_flags = [
debug_flag.strip()
for debug_flag in PYSNMP_DEBUG.split(",")
if debug_flag.strip() in debug_flags
]

if enabled_debug_flags:
debug.setLogger(debug.Debug(*enabled_debug_flags, loggerName=logger))


def return_address_and_port(target):
Expand Down

0 comments on commit afef8ef

Please sign in to comment.