3 ms·
I once wrote a Python program that would generate Java classes for sending SNMP notifications. It would take a text file describing the messages and generate a
by dkersten 15y ago
I once wrote a Python program that would generate Java classes for sending SNMP notifications. It would take a text file describing the messages and generate a MIB file and Java code for each message from it. A message description looked something like this (don't quite remember exactly now):
oid "1.3.6.1.4.1.12345"
group "1"
message "MyNotification"
field string message_body
and it would generate a Java class called MyNotification which contained about 100 lines of code to handle sending and receiving of these notification messages, plus the MIB equivalent so that network management tools can understand the message.
Once the messages were defined, they rarely changed since customers would have to change their network management tool configuration, so it was mainly only used to add new notification types once the original set stabilized, but it saved a ton of time over having to hand craft each message type.