netfishers-onl / Netshot

Network Configuration and Compliance Management
http://www.netfishers.onl/netshot
240 stars 57 forks source link

JS Compliance script based on diagnostic results #271

Closed uchihaitachi2 closed 10 months ago

uchihaitachi2 commented 11 months ago

Hi,

I am trying to write a JS script for compliance. the script should analyze the result of a diagnostic command. the diagnostic command is called "show interface". I have created some JS scripts based on runningConfig, but this is the first time I want to use the result of a diag command.

how to use the result of the diagnostic command within the script? device.get.diagnostic('show interface') is correct ? if not, could you please provide the proper syntax?

Thanks!

momolemo commented 11 months ago

hi, As i know and i found nothing in the doc it is not possible in JS. I made all this type of check with the dedicated function in compliance found in the text section. When selected the text rule you can choose as field the result of a diagnostic and made some check on it.

If you found a way in JS let me know it can be usefull.

regards

SCadilhac commented 10 months ago

If your diagnostic is named NTP status, you should be able to retrieve the last result from the compliance script using device.get("NTP status").