Step 1: Download the approriate MIBs from Juniper at this link.
Step 2: grep through the MIB .txt files for the string that you’re looking for, e.g. grep -i prefixes *.txt. This will give you some clues like:
mib-jnx-bgpmib2.txt: jnxBgpM2PrefixInPrefixes
mib-jnx-bgpmib2.txt: jnxBgpM2PrefixInPrefixesAccepted
mib-jnx-bgpmib2.txt: jnxBgpM2PrefixInPrefixesRejected
mib-jnx-bgpmib2.txt: jnxBgpM2PrefixOutPrefixes
Step 3: On your Juniper, walk through the SNMP object names until you found what you’re looking for:
admin@router> show snmp mib walk jnxBgpM2
[…]
jnxBgpM2PrefixOutPrefixes.0.1.1 = 10
jnxBgpM2PrefixOutPrefixes.1.1.1 = 10
jnxBgpM2PrefixOutPrefixes.2.2.1 = 1
(jnxBgpM2PrefixCountersTable instead of jnxBgpM2 works too and saves you some time – check e.g. http://www.oidview.com/mibs/2636/BGP4-V2-MIB-JUNIPER.html)
Step 4: Now, if you want to monitor two of these objects, for example 0.1.1 and 2.2.1 with e.g. MRTG, you cannot simply specify
Target[router_prefixout]: jnxBgpM2PrefixOutPrefixes.0.1.1&jnxBgpM2PrefixOutPrefixes.2.2.1:yourcommunity@router-ip-address:::::2
because that just won’t work. Don’t ask me why, I’m an SNMP n00b and I couldn’t care less about SNMP. :-) Instead you will need the object identifier, which for BGP you could find here: http://www.oidview.com/mibs/2636/BGP4-V2-MIB-JUNIPER.html respectively here at oidview.com for all Juniper MIBs: http://www.oidview.com/mibs/2636/md-2636-1.html. In that document you would search for object name jnxBgpM2PrefixOutPrefixes and you would find that 1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10 is the corresponding object identifier. So, your final config will look like this:
Target[router_prefixout]: 1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10.0.1.1&1.3.6.1.4.1.2636.5.1.1.2.6.2.1.10.2.2.1:yourcommunity@router-ip-address:::::2