Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions suzieq/config/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions suzieq/poller/worker/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down