Open cpmarvin opened 8 years ago
Hi @cpmarvin, I don't think this is possible currently but I agree it would be great to support that @3fr61n any idea here ?
Thanks Damien
Hi @cpmarvin
Could you please add the xml output of show chassis routing engine on your scenario?
Regards
Hi @3fr61n
See below. Manage to get information by changing the xml parser from "key: ./slot" to "key: ."
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/14.2R3/junos">
<route-engine-information xmlns="http://xml.juniper.net/junos/14.2R3/junos-chassis">
<route-engine>
<status>OK</status>
<temperature junos:celsius="35">35 degrees C / 95 degrees F</temperature>
<cpu-temperature junos:celsius="47">47 degrees C / 116 degrees F</cpu-temperature>
<memory-dram-size>2048 MB</memory-dram-size>
<memory-installed-size>(2048 MB installed)</memory-installed-size>
<memory-buffer-utilization>34</memory-buffer-utilization>
<cpu-user>0</cpu-user>
<cpu-background>0</cpu-background>
<cpu-system>1</cpu-system>
<cpu-interrupt>0</cpu-interrupt>
<cpu-idle>99</cpu-idle>
<model>RE-MX80-48T</model>
<serial-number>XXX</serial-number>
<start-time junos:seconds="1469897123">2016-07-30 16:45:23 UTC</start-time>
<up-time junos:seconds="1750124">20 days, 6 hours, 8 minutes, 44 seconds</up-time>
<last-reboot-reason>Router rebooted after a normal shutdown.</last-reboot-reason>
<load-average-one>0.00</load-average-one>
<load-average-five>0.00</load-average-five>
<load-average-fifteen>0.00</load-average-fifteen>
</route-engine>
</route-engine-information>
<cli>
<banner></banner>
</cli>
</rpc-reply>
@cpmarvin I hope you don't mind I updated your comment to make the XML more readable.
Hi,
Just on this subject, its exactly the same issue if you point the parser at a branch SRX. So it seems with some differences in the XML layout depending on hardware we need some way of having different parsers. I had a bit of look through the code and agree with @dgarros , it looks tricky to do it.
For the record here is a sample of a branch SRX XML output
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.3X48/junos">
<route-engine-information xmlns="http://xml.juniper.net/junos/12.3X48/junos-chassis">
<route-engine>
<status>OK</status>
<temperature junos:celsius="44">44 degrees C / 111 degrees F</temperature>
<memory-system-total>2048</memory-system-total>
<memory-system-total-used>1044</memory-system-total-used>
<memory-system-total-util>51</memory-system-total-util>
<memory-control-plane>976</memory-control-plane>
<memory-control-plane-used>576</memory-control-plane-used>
<memory-control-plane-util>59</memory-control-plane-util>
<memory-data-plane>1072</memory-data-plane>
<memory-data-plane-used>472</memory-data-plane-used>
<memory-data-plane-util>44</memory-data-plane-util>
<cpu-user>10</cpu-user>
<cpu-background>0</cpu-background>
<cpu-system>9</cpu-system>
<cpu-interrupt>0</cpu-interrupt>
<cpu-idle>81</cpu-idle>
<model>RE-SRX220H2-POE</model>
<serial-number>ACKK8434</serial-number>
<start-time junos:seconds="1471939343">2016-08-23 18:02:23 EST</start-time>
<up-time junos:seconds="2818480">32 days, 14 hours, 54 minutes, 40 seconds</up-time>
<last-reboot-reason>0x1:power cycle/failure</last-reboot-reason>
<load-average-one>0.19</load-average-one>
<load-average-five>0.18</load-average-five>
<load-average-fifteen>0.17</load-average-fifteen>
</route-engine>
</route-engine-information>
<cli>
<banner></banner>
</cli>
</rpc-reply>
What about adding to the 'match' statement a additional entry a 'tag', so you can have something like.....
parser:
regex-command: show\s+chassis\s+routing-engine\s+\|\s+display\s+xml
matches:
-
type: multi-value
tag: SRX <-----
method: xpath
<---- ommited ---->
-
type: multi-value
tag: old_junos <-----
method: xpath
xpath: //route-engine
<---- ommited ---->
If 'tag' from the parser matches the one on the host, then data is extracted, if not... it's skipped
In this way the end-user can manage different 'versions' of the same command depending on the host to be consulted.
NOTE: I tried to avoid using the junos version info gathered on each iteration in order to choose the 'match' inside the parser because there are infinite combinations and exceptions.
Regards Efrain
Hello,
Let me understand, you want to use a parser (show chassis routing engine in this case), and the parser is beyond the hardware that you have, and you want to create a new parser that fits in your hardware?
If is that, it isnt that hard, just tell me the specifications that you want, and i could help you out.
(I dont know if im in the right point of the topic)
Regards.
@andrewarp as we can't have two parsers for the same command i would say +1 for the tag option.
Currently if you have a mix of single/dual RE devices you can only get information from 1 type.
regards.
@cpmarvin Question, in your scenario the command 'show chassis routing-engine 0 | display xml' works?
I mean, as a quick and temporal workaround you could build a parser for the command (with the slot), so you'll avoid using the 'default' one
Regards
@3fr61n Unfortunately doesn't.
> show chassis routing-engine 0 | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.2R2/junos">
<xnm:error xmlns="http://xml.juniper.net/xnm/1.1/xnm" xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm">
<message>
command is not valid on the **mx80-48t**
</message>
</xnm:error>
<cli>
<banner></banner>
</cli>
</rpc-reply>
> show chassis routing-engine ?
Possible completions:
<[Enter]> Execute this command
bios Show BIOS firmware version
| Pipe through a command
My current workaround is using the serial-number as the key. Looks strange but at least it works for both types.
Existing parser assumes the device has multiple REs. With VMX or other devices that cannot support dual RE this will not produce any data.
Is it possible to define the same command in different tags with different parsers ?