Files
OIDsimulator/custom_snmp_script.py
2025-03-06 13:02:04 +00:00

23 lines
562 B
Python

#!/usr/bin/env python3
import os
import random
import time
# 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 within the specified range
value += random.randint(range_min, range_max)
# Output the value in the required format
print(f"{oid} = INTEGER: {value}")
# Wait for 4 minutes
time.sleep(240)