add var for range of change

This commit is contained in:
Radek
2025-03-06 13:02:04 +00:00
parent ee830ec557
commit e419b16639

View File

@@ -3,15 +3,17 @@ import os
import random import random
import time 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') 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 # Initial value
value = 1385062 value = 1385062
while True: while True:
# Increment the value by a random amount between 0 and 6 # Increment the value by a random amount within the specified range
value += random.randint(0, 6) value += random.randint(range_min, range_max)
# Output the value in the required format # Output the value in the required format
print(f"{oid} = INTEGER: {value}") print(f"{oid} = INTEGER: {value}")