diff --git a/docsrc/examples/system_health/xcvr_sn_list_filtered.aql b/docsrc/examples/system_health/xcvr_sn_list_filtered.aql new file mode 100644 index 0000000..0ce93e9 --- /dev/null +++ b/docsrc/examples/system_health/xcvr_sn_list_filtered.aql @@ -0,0 +1,5 @@ +let data = `*:/Sysdb/hardware/archer/xcvr/status/all/*` +let xcvrStatus = data | map(_value | mapne(_value, _value | field("goVendorInfo") | field("vendorSn"))) +let xcvrStatus = xcvrStatus | map(_value | mapne(_value[0], _value)) + +xcvrStatus | map(_value | where(reMatch(_value, _regexInput))) | where(length(_value) > 0) diff --git a/docsrc/examples/system_health/xcvr_sn_list_filtered.json b/docsrc/examples/system_health/xcvr_sn_list_filtered.json new file mode 100644 index 0000000..9e98462 --- /dev/null +++ b/docsrc/examples/system_health/xcvr_sn_list_filtered.json @@ -0,0 +1,71 @@ +{ + "dashboards": [ + { + "key": "93b5abba-7807-453a-be77-56a1fde055fd", + "createdAt": [ + 977361740, + 1579 + ], + "createdBy": "cvpadmin", + "metaData": { + "schemaVersion": "3", + "legacyKey": "", + "legacyVersion": "", + "fromPackage": "" + }, + "name": "Filtered Transcevier Data", + "description": "", + "widgets": [ + { + "id": "0c08fed5-cd5a-44be-b083-ab950e8c93e8", + "name": "", + "position": { + "x": 0, + "y": 0 + }, + "dimensions": { + "width": 10, + "height": 14 + }, + "type": "aql-query-widget", + "inputs": { + "expression": "let data = `*:/Sysdb/hardware/archer/xcvr/status/all/*`\nlet xcvrStatus = data | map(_value | mapne(_value, _value | field(\"goVendorInfo\") | field(\"vendorSn\")))\nlet xcvrStatus = xcvrStatus | map(_value | mapne(_value[0], _value))\n\nlet filteredXcvrStat = newDict()\n\nfor deviceKey, deviceValue in xcvrStatus {\n filteredXcvrStat[deviceKey] = newDict()\n for interfaceKey, interfaceValue in deviceValue {\n if reMatch(interfaceValue, _regexInput){\n filteredXcvrStat[deviceKey][interfaceKey] = interfaceValue\n\n }\n }\n if length(filteredXcvrStat[deviceKey]) == 0 {\n dictRemove(filteredXcvrStat, deviceKey)\n }\n}\n\nfilteredXcvrStat\n", + "graphConfig": { + "columns": { + "key": { + "mapToHostname": true + } + } + }, + "visualization": "table" + }, + "location": "main", + "parent": "" + }, + { + "id": "85920a17-dd18-47b0-a315-ba350f6f0a6d", + "name": "", + "position": { + "x": 0, + "y": 0 + }, + "dimensions": { + "width": 6, + "height": 2 + }, + "type": "variable-widget", + "inputs": { + "defaultValue": "", + "inputName": "regexInput", + "inputType": "FreeForm", + "variableType": "String" + }, + "location": "inputs", + "parent": "" + } + ], + "lastUpdated": 1696513262320, + "lastUpdatedBy": "cvpadmin" + } + ] +} \ No newline at end of file diff --git a/docsrc/examples/system_health/xcvr_sn_list_filtered.png b/docsrc/examples/system_health/xcvr_sn_list_filtered.png new file mode 100644 index 0000000..6448d60 Binary files /dev/null and b/docsrc/examples/system_health/xcvr_sn_list_filtered.png differ diff --git a/docsrc/examples/system_health/xcvr_sn_list_filtered.rst b/docsrc/examples/system_health/xcvr_sn_list_filtered.rst new file mode 100644 index 0000000..984b515 --- /dev/null +++ b/docsrc/examples/system_health/xcvr_sn_list_filtered.rst @@ -0,0 +1,11 @@ +List the serial numbers for all transceivers +-------------------------------------------- + +.. literalinclude:: xcvr_sn_list_filtered.aql + :language: aql + +.. image:: xcvr_sn_list_filtered.png + :width: 600 + :alt: List the serial numbers for all transceivers that match the regex + +:download:`Download the Dashboard JSON here `