From e419b16639bbba064f717d68c4d2579c7dc86227 Mon Sep 17 00:00:00 2001 From: Radek Date: Thu, 6 Mar 2025 13:02:04 +0000 Subject: [PATCH] add var for range of change --- custom_snmp_script.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/custom_snmp_script.py b/custom_snmp_script.py index 6fd0612..c11aa70 100644 --- a/custom_snmp_script.py +++ b/custom_snmp_script.py @@ -3,15 +3,17 @@ import os import random import time -# Read the OID from the environment variable +# Read the OID and range from environment variables oid = os.getenv('CUSTOM_OID', '.1.3.6.1.4.1.38446.1.2.4.1.9.1') +range_min = int(os.getenv('RANGE_MIN', 0)) +range_max = int(os.getenv('RANGE_MAX', 6)) # Initial value value = 1385062 while True: - # Increment the value by a random amount between 0 and 6 - value += random.randint(0, 6) + # Increment the value by a random amount within the specified range + value += random.randint(range_min, range_max) # Output the value in the required format print(f"{oid} = INTEGER: {value}")