Hi Deepak,
The root OID for Juniper-SMI MIB is "1.3.6.1.4.1.2636", you can use any ids thats available after that. If Juniper needs additional OID, it would pick the next available sequential free id from the list in my opinion.
You can always check the assigned ID's from the SNMP explorer site hosted on the Juniper support site.
https://apps.juniper.net/mib-explorer/navigate?software=Junos%20OS&release=23.2R1&name=juniperMIB&oid=1.3.6.1.4.1.2636
If you look at all the children links you can find the ID's that are currently used for the OID values that are used by Juniper Devices.
For example refer to the link below which is the last ID i.e. starting with 11
https://apps.juniper.net/mib-explorer/navigate?software=Junos%20OS&release=23.2R1&name=jnxAgentCapability&oid=1.3.6.1.4.1.2636.11
Here is an example I used in the lab to designate a higher value OID when querying using a SNMP script on the SRX device. I have used 1000 in the example below.
scripts {
language python3;
snmp {
file test.py {
oid .1.3.6.1.4.1.2636.1000.61.1.9.1.1;
oid .1.3.6.1.4.1.2636.1000.61.1.9.1.2;
python-script-user lab;
}
}
}
root@srx> show snmp mib walk .1.3.6.1.4.1.2636.1000.61.1.9.1
juniperMIB.1000.61.1.9.1.1.1 = 211
juniperMIB.1000.61.1.9.1.1.2 = 429
root@srx> show snmp mib get .1.3.6.1.4.1.2636.1000.61.1.9.1.1.1
juniperMIB.1000.61.1.9.1.1.1 = 211
root@srx> show snmp mib get .1.3.6.1.4.1.2636.1000.61.1.9.1.1.2
juniperMIB.1000.61.1.9.1.1.2 = 429
Here is the SNMP script I used:
#!/usr/bin/python3
import jcs
def main():
snmp_action = jcs.get_snmp_action()
snmp_oid = jcs.get_snmp_oid()
jcs.syslog("8", "snmp_action = ", snmp_action, " snmp_oid = ", snmp_oid)
if snmp_action == 'get':
if snmp_oid == '.1.3.6.1.4.1.2636.1000.61.1.9.1.1.1':
jcs.emit_snmp_attributes(snmp_oid, "Integer32", "211")
elif snmp_oid == '.1.3.6.1.4.1.2636.1000.61.1.9.1.1.2':
jcs.emit_snmp_attributes(snmp_oid, "Integer32", "429")
elif snmp_action == 'get-next':
if snmp_oid == '.1.3.6.1.4.1.2636.1000.61.1.9.1.1':
jcs.emit_snmp_attributes(".1.3.6.1.4.1.2636.1000.61.1.9.1.1.1", "Integer32", "211")
elif snmp_oid == '.1.3.6.1.4.1.2636.1000.61.1.9.1.1.1':
jcs.emit_snmp_attributes(".1.3.6.1.4.1.2636.1000.61.1.9.1.1.2", "Integer32", "429")
if __name__ == '__main__':
main()
------------------------------
Pradeep Hattiangadi
------------------------------
Original Message:
Sent: 08-10-2023 02:52
From: djadhav
Subject: Question on SNMP on-box scripts
Hi.
Here is an example of the configuration needed to have my SNMP script sample.py be triggered by an incoming SNMP Request for unsupported OID 1.3.6.1.4.1.2636.13.61.1.9.1.1.
system {
scripts {
snmp {
file sample.py {
oid .1.3.6.1.4.1.2636.13.61.1.9.1.1;
}
}
}
}
How do I choose an OID that is guaranteed to not be used by Juniper in future releases, which will then cause my script to not be triggered by that same OID?
Thanks,
Deepak