[j-nsp] Publish API data over SNMP

Phil Shafer phil at juniper.net
Thu Mar 8 15:43:32 EST 2018


Saku Ytti writes:
>As a user I'd be comfortable at stability which matches display
>XML/JSON stability, and I think that level of stability would be
>implied.

Unfortunately not, since MIBs use numeric identifier for fields,
so if a developer inserts "leaf foxtrot" between "leaf echo" and
"leaf geronimo" (where it really belongs) then the MIB ordering has
changed and the numbers and all off.  The MIB generator would need
the numbers from the previous release to generate useful numbers.

>All this relies on my assumption that JNPR is machine generating
>JSON/XML stuff automatically for new commands, and 100% coverage is
>guaranteed. If this is true, same way this CLI-MIB could be machine
>generated.

The XML content is generated by the component, so the "show route"
is forwarded to RPD, who emits the XML response.  MGD forwards that
to the API client or to the CLI, who turns it into text.  The JSON
generation (and the "format='text'") is done as a "filter" (in the
unix sense of the word) to the output stream coming back to the API
client.

>In practice I rarely use MIBs, and if CLI would offer 'show
>class-of-service fabric statistic | display oid', that would be good
>enough for me. So not even having MIB wouldn't bother me. My only use
>case for MIBs is when I try to find what OID to poll, actual tooling
>does not load MIBs.

Well, if this is a "one off", we have two potential solutions.  First
is the utility MIB, which holds simple name/value pairs, with the name
being the key.  An intermittent event script can record a value into
the utility mib and an SNMP client can retrieve it.  More info is at:

    https://www.juniper.net/documentation/en_US/junos/topics/task/operational/snmp-best-practices-utility-mib-using.html

The other path is "snmp scripts" where one can associate an OID
with a script that is run to generate data for that OID.  More info
is at:

    https://www.juniper.net/documentation/en_US/junos/topics/concept/junos-script-automation-snmp-script-overview.html

>> The second issue (which is mostly my lack of snmp depth) is how
>> to ensure the results of multiple queries are given data from the
>> same RPC results.  Looking at "show chassis environment" results
>> should give consistent output.
>
>I'm not sure I understand the problem or question.

My concern was with ensuring that a PDU containing requests for the
value of "foxtrot" and "geronimo" get these values from the same
RPC output, instead of issuing the RPC twice, which makes more work
and my give inconsistent results.  Sorry if my previous explanation
(and perhaps this one as well ;^) wasn't clear.

Thanks,
 Phil


More information about the juniper-nsp mailing list