diff --git a/suzieq/config/device.yml b/suzieq/config/device.yml index 571a80dd6e..9ecde06dbf 100644 --- a/suzieq/config/device.yml +++ b/suzieq/config/device.yml @@ -110,8 +110,36 @@ apply: ]' junos-ex: - copy: junos-qfx - + - version: <= 14.2R8.4 + command: + - command: "show system information | display json | no-more" + normalize: 'system-information/*/[ + "hardware-model/[0]/data: model", + "os-name/[0]/data: os?|junos", + "os-version/[0]/data: version", + "vendor: vendor?|Juniper", + "serial-number/[0]/data: serialNumber", + ]' + - command: "show system uptime | display json" + normalize: 'system-uptime-information/*/[ + "system-booted-time/[0]/date-time/[0]/attributes: bootupTimestamp?|" + ]' + + - version: all + command: + - command: "show system information | display json | no-more" + normalize: 'system-information/*/[ + "hardware-model/[0]/data: model", + "os-name/[0]/data: os?|junos", + "os-version/[0]/data: version", + "vendor: vendor?|Juniper", + "serial-number/[0]/data: serialNumber", + ]' + - command: "show system uptime | display json" + normalize: 'multi-routing-engine-results/[0]/multi-routing-engine-item/[0]/system-uptime-information/*/[ + "system-booted-time/[0]/date-time/[0]/attributes: bootupTimestamp?|" + ]' + junos-mx: version: all command: diff --git a/suzieq/poller/worker/nodes/node.py b/suzieq/poller/worker/nodes/node.py index 112e17487d..cbb354dbb6 100644 --- a/suzieq/poller/worker/nodes/node.py +++ b/suzieq/poller/worker/nodes/node.py @@ -1966,19 +1966,21 @@ async def _parse_init_dev_data_devtype(self, output, cb_token) -> None: data = output[0]["data"] try: jdata = json.loads(data.replace('\n', '').strip()) - if self.devtype not in ["junos-mx", "junos-qfx10k", - "junos-evo"]: + + if jdata.get('multi-routing-engine-results'): jdata = (jdata['multi-routing-engine-results'][0] ['multi-routing-engine-item'][0]) timestr = (jdata['system-uptime-information'][0] ['system-booted-time'][0]['date-time'][0] ['attributes']) + except Exception: self.logger.warning( f'{self.address}:{self.port} Unable to parse junos boot ' f'time from {data}') timestr = '{"junos:seconds": "0"}' + self.bootupTimestamp = get_timestamp_from_junos_time( timestr, ms=False)