System Health Examples
Listing of devices affected by FN44
let fixed = `*:/Sysdb/hardware/entmib/fixedSystem`
let chassis = `*:/Sysdb/hardware/entmib/chassis/cardSlot/*/card`
let result = newDict()
for deviceKey, deviceValue in fixed{
let fx_temp = merge(deviceValue)
if dictHasKey(fx_temp , "firmwareRev") && fx_temp["firmwareRev"] != ""{
result[deviceKey] = newDict() | setFields("Aboot version", fx_temp["firmwareRev"])
}
}
for deviceKey, deviceValue in chassis {
let cx_tmp = chassis[deviceKey] | map(merge(_value))
for card in cx_tmp{
if dictHasKey(card, "firmwareRev") && card["firmwareRev"] != "" {
result[deviceKey] = newDict() | setFields("Aboot version", card["firmwareRev"])
}
}
}
let re = "Aboot-norcal\d+-(\d+)\.(\d+)\.(\d+).*"
for deviceKey, deviceValue in result{
let aboot = reFindCaptures(deviceValue["Aboot version"], re)
if length(aboot) > 0 {
if num(aboot[0][1]) == 4 {
if num(aboot[0][2]) == 0 && num(aboot[0][3]) < 7 {
result[deviceKey]["affected"] = "🔥 True"
}
if num(aboot[0][2]) == 1 && num(aboot[0][3]) < 1 {
result[deviceKey]["affected"] = "🔥 True"
}
}
if num(aboot[0][1]) == 6 {
if num(aboot[0][2]) == 0 && num(aboot[0][3]) < 9 {
result[deviceKey]["affected"] = "🔥 True"
}
if num(aboot[0][2]) == 1 && num(aboot[0][3]) < 7 {
result[deviceKey]["affected"] = "🔥 True"
} else {
result[deviceKey]["affected"] = "✅ False"
}
} else {
result[deviceKey]["affected"] = "✅ False"
}
} else {
result[deviceKey]["affected"] = "✅ False"
}
}
result
EoL Planning
let inventory = `analytics:/DatasetInfo/Devices`
let hardware = merge(`analytics:/lifecycles/hardware`)
let softwareLife = merge(`analytics:/lifecycles/software`)
let software = merge(`analytics:/lifecycles/devices/software`)
let skus = merge(`analytics:/BugAlerts/skus`)
let filteredSkus = newDict()
for key, val in skus {
if strContains(key, "DCS-") {
filteredSkus[key] = newDict()
let relNum = ""
if str(val["releaseDeprecated"]) != "[]" {
let deprecatedReleaseNum = strSplit(str(val["releaseDeprecated"]),",")[0]
let deprecatedReleaseNum = strReplace(deprecatedReleaseNum, "[","")
let deprecatedReleaseNum = strReplace(deprecatedReleaseNum, "]","")
let deprecatedReleaseNum = strReplace(deprecatedReleaseNum, "\"","")
let deprecatedReleaseNum = strSplit(deprecatedReleaseNum,".")
let relNum = deprecatedReleaseNum[0]+"."+str(num(deprecatedReleaseNum[1])-1)
}
filteredSkus[key]["releaseDeprecated"] = relNum
}
}
let inv = newDict()
for deviceUpdate, device in inventory {
for deviceSN, deviceData in device {
inv[deviceSN] = newDict()
inv[deviceSN]["Hostname"] = deviceData["hostname"]
inv[deviceSN]["ModelName"] = deviceData["modelName"]
inv[deviceSN]["Version"] = deviceData["eosVersion"]
inv[deviceSN]["TerminAttr"] = deviceData["terminAttrVersion"]
for hw, hwEol in hardware {
if deviceData["modelName"] == hw {
inv[deviceSN]["Hardware EndOfSale"] = hwEol["endOfSale"]
inv[deviceSN]["Hardware EndOfTACSupport"] = hwEol["endOfTACSupport"]
inv[deviceSN]["Hardware EndOfRMARequests"] = hwEol["endOfHardwareRMARequests"]
inv[deviceSN]["Hardware EndOfLife"] = hwEol["endOfLife"]
}
}
for switch, switchEol in software {
if switch == deviceSN {
inv[deviceSN]["Current Software EndOfLife"] = switchEol["endOfSupport"]
}
}
for skuKey, skuVal in filteredSkus {
if strContains(skuKey, deviceData["modelName"]) {
inv[deviceSN]["Last Supported Software Train"] = skuVal["releaseDeprecated"]
}
}
for sw, swEol in softwareLife {
if dictHasKey(inv[deviceSN],"Last Supported Software Train") && sw == inv[deviceSN]["Last Supported Software Train"] {
inv[deviceSN]["Last Supported Software Train EndOfLife"] = swEol["endOfSupport"]
}
}
}
}
inv
Listing of devices affected by FN72
let inventory = merge(`analytics:/DatasetInfo/Devices`)
let affected = newDict()
let id = 1
for dkey, dval in inventory{
let serial_slice = strCut(dkey,3,7)
let model = dval["modelName"]
let hostname = dval["hostname"]
if strContains(model, "7280SR3-48YC8"){
if strHasPrefix(dkey, "JPE"){
if num(serial_slice) < 2131{
affected[id] = newDict()
affected[id]["Hostname"] = hostname
affected[id]["Serial Number"] = dkey
affected[id]["Model"] = model
}
}
if strHasPrefix(dkey,"JAS"){
if num(serial_slice) < 2041{
affected[id] = newDict()
affected[id]["Hostname"] = hostname
affected[id]["Serial Number"] = dkey
affected[id]["Model"] = model
}
}
let id = id + 1
}
if strContains(model, "7280SR3K-48YC8"){
if strHasPrefix(dkey, "JPE"){
if num(serial_slice) < 2134{
affected[id] = newDict()
affected[id]["Hostname"] = hostname
affected[id]["Serial Number"] = dkey
affected[id]["Model"] = model
}
}
if strHasPrefix(dkey, "JAS"){
if num(serial_slice) < 2041{
affected[id] = newDict()
affected[id]["Hostname"] = hostname
affected[id]["Serial Number"] = dkey
affected[id]["Model"] = model
}
}
let id = id + 1
}
}
affected
Hardware Health Check
Power Supply Status per Device
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesSwitchLabel = merge(`analytics:/tags/labels/devices/switch_role/value/<_SWITCH_ROLE>/elements`)
let powerSupply = `*:/Sysdb/environment/archer/power/status/powerSupply/*`
let filteredPsuStats = powerSupply | where(dictHasKey(powerSupply, _key) == true) | recmap(2, (merge(_value)["state"]["Name"]))
if str(_POD_NAME) == "" && str(_SWITCH_ROLE) == "" {
let result = filteredPsuStats
} else {
if str(_SWITCH_ROLE) == "" {
let result = filteredPsuStats | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
if str(_POD_NAME) == "" {
let result = filteredPsuStats | where(dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
let result = filteredPsuStats | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
}
}
}
for deviceKey, deviceValue in result{
for powerSupplyKey, powerSupplyValue in deviceValue{
if powerSupplyValue=="ok"{
result[deviceKey][powerSupplyKey]="✔️"
} else{
result[deviceKey][powerSupplyKey]="❌"
}
}
}
result
Fan Status per Device
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesSwitchLabel = merge(`analytics:/tags/labels/devices/switch_role/value/<_SWITCH_ROLE>/elements`)
let fans = `*:/Sysdb/environment/archer/cooling/status/*`
let fansHwStatus = fans | where(dictHasKey(fans, _key) == true) | recmap(2, (merge(_value)["hwStatus"]["Name"]))
if str(_POD_NAME) == "" && str(_SWITCH_ROLE) == "" {
let result = fansHwStatus
} else {
if str(_SWITCH_ROLE) == "" {
let result = fansHwStatus | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
if str(_POD_NAME) == "" {
let result = fansHwStatus | where(dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
let result = fansHwStatus | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
}
}
}
for deviceKey, deviceValue in result{
for fansKey, fansValue in deviceValue{
if fansValue=="ok"{
result[deviceKey][fansKey]="✔️"
} else{
result[deviceKey][fansKey]="❌"
}
}
}
result
Temperature Sensors per Device
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesSwitchLabel = merge(`analytics:/tags/labels/devices/switch_role/value/<_SWITCH_ROLE>/elements`)
let temperature = `*:/Sysdb/environment/archer/temperature/status/cell/1/*`
let filteredTemperatureStats = temperature | where(dictHasKey(temperature, _key) == true) | recmap(2, (merge(_value)["alertRaised"]))
if str(_POD_NAME) == "" && str(_SWITCH_ROLE) == "" {
let result = filteredTemperatureStats
} else {
if str(_SWITCH_ROLE) == "" {
let result = filteredTemperatureStats | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
if str(_POD_NAME) == "" {
let result = filteredTemperatureStats | where(dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
let result = filteredTemperatureStats | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
}
}
}
for deviceKey, deviceValue in result{
for sensorKey, sensorValue in deviceValue{
if sensorValue==false{
result[deviceKey][sensorKey]="✔️"
} else{
result[deviceKey][sensorKey]="❌"
}
}
}
result
Important Pod Count
Number of Leaf Switches
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesInCPOD1 = merge(`analytics:/tags/labels/devices/pod_name/value/CPOD1/elements`)
if str(_POD_NAME) == "" {
let leafs = length(devicesInCPOD1) - 2
} else {
let leafs = length(devices) - 2
}
leafs
Number of VTEPs
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesInCPOD1 = merge(`analytics:/tags/labels/devices/pod_name/value/CPOD1/elements`)
if str(_POD_NAME) == "" {
let vteps = (length(devicesInCPOD1) - 2 ) / 2
} else {
if strContains(str(_POD_NAME), "SPOD") {
let vteps = ((length(devices) - 3) / 2)+1
} else {
let vteps = (length(devices) - 2) / 2
}
}
vteps
Total VLAN Count
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesInCPOD1 = merge(`analytics:/tags/labels/devices/pod_name/value/CPOD1/elements`)
if str(_POD_NAME) == "" {
let vlanConfig = `*:/Sysdb/bridging/config/vlanConfig` | where(dictHasKey(devicesInCPOD1, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value))
} else {
let vlanConfig = `*:/Sysdb/bridging/config/vlanConfig` | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value))
}
let numberVlan = newDict()
for deviceKey, deviceValue in vlanConfig {
for vlanKey, vlanValue in deviceValue{
numberVlan[vlanKey["value"]] = 1
}
}
length(numberVlan)
Max Size of the Floodlist
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesInCPOD1 = merge(`analytics:/tags/labels/devices/pod_name/value/CPOD1/elements`)
if str(_POD_NAME) == "" {
let vteps = (length(devicesCPOD1) -2) / 2
let vlanConfig = `*:/Sysdb/bridging/config/vlanConfig` | where(dictHasKey(devicesInCPOD1, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value))
} else {
if strContains(str(_POD_NAME), "SPOD") {
let vteps = ((length(devices) - 3) / 2)+1
let vlanConfig = `*:/Sysdb/bridging/config/vlanConfig` | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value))
} else {
let vteps = (length(devices) -2) / 2
let vlanConfig = `*:/Sysdb/bridging/config/vlanConfig` | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value))
}
}
let numberVlan = newDict()
for deviceKey, deviceValue in vlanConfig {
for vlanKey, vlanValue in deviceValue{
numberVlan[vlanKey["value"]] = 1
}
}
let vlans = length(numberVlan)
vteps*vlans
NTP Stats
let ntpData = `*:/NTP/status/system/variables` | map(merge(_value))
let output = newDict()
for devID,devData in ntpData{
output[devID] = newDict()
output[devID]["peer"]= devData["refid"]
output[devID]["Stratum"]=devData["stratum"]
output[devID]["OffSet"]=devData["offset"]
}
output
PowerSupply Output
let powerSupply = `analytics:/Devices/*/versioned-data/environment/power/aggregate/*/out/15m`[48h]
let result = newDict()
for key, value in _device{
if dictHasKey(powerSupply,key) {
for psk,psv in powerSupply[key]{
result[key+"-"+psk] = powerSupply[key][psk] | field("value") | field("avg")
}
}
}
result
System Health Check
CPU Utilization in the Fabric
let data =`analytics:/Devices/*/versioned-data/hardware/disk/\/mnt\/flash`
let data = data | map(merge(_value) | fields("usedPartitionPercent"))
let test = 0
let i60 = 0
let b6080 = 0
let s80 = 0
for device, deviceData in data {
if dictHasKey(deviceData, "usedPartitionPercent") {
let test = deviceData["usedPartitionPercent"]
if test < 60 {
let i60=i60+1
}
if test < 80 && test > 60 {
let b6080=b6080+1
}
if test > 80 {
let s80=s80+1
}
}
}
let usageDict = newDict()
usageDict["Disk < 60%"] = i60
usageDict["60% < Disk < 80%"] = b6080
usageDict["Disk > 80%"] = s80
usageDict
Memory Usage in the Fabric
let data =`analytics:/Devices/*/versioned-data/hardware/meminfo/memoryUsage`
let data = data | map(merge(_value) | fields("usedMemoryPercent"))
let test = 0
let i60 = 0
let b6070 = 0
let s70 = 0
for device, deviceData in data {
if dictHasKey(deviceData, "usedMemoryPercent") {
let test = deviceData["usedMemoryPercent"]
if test < 70 {
let i60=i60+1
}
if test < 80 && test > 70 {
let b6070=b6070+1
}
if test > 70 {
let s70=s70+1
}
}
}
let usageDict = newDict()
usageDict["Memory < 60%"] = i60
usageDict["60% < Memory < 70%"] = b6070
usageDict["Memory > 70%"] = s70
usageDict
/mnt/flash usage
let devices = merge(`analytics:/tags/labels/devices/pod_name/value/<_POD_NAME>/elements`)
let devicesSwitchLabel = merge(`analytics:/tags/labels/devices/switch_role/value/<_SWITCH_ROLE>/elements`)
let deviceDisks = `analytics:/Devices/*/versioned-data/hardware/disk/\/mnt\/flash`
if str(_POD_NAME) == "" && str(_SWITCH_ROLE) == "" {
let data = deviceDisks
} else {
if str(_SWITCH_ROLE) == "" {
let data = deviceDisks | where(strContains(str(devices), _key))
} else {
if str(_POD_NAME) == "" {
let data = deviceDisks | where(dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
} else {
let data = deviceDisks | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(devicesSwitchLabel, complexKey("{\"deviceID\": \""+_key+"\"}")))
}
}
}
data | map(merge(_value) | fields("usedPartitionPercent"))
TCAM Capacity
7280R2 Switches
# Get the devices that have the egw (EVPN gateway) tag
let devices = merge(`analytics:/tags/labels/devices/switch_role/value/egw/elements`)
# Get the L3 hardware capacity for all devices
let hwCapL3 =`*:/Sysdb/hardware/capacity/status/l3/entry`
# Get the devices that are part of a specific pod
let podDeviceList = merge(`analytics:/tags/labels/devices/pod_name/value/<_pod_name>/elements`)
# If the POD_NAME variable is not set (none) show the utilization for all pods
if str(_pod_name) == "" {
let filteredHwCapL3 = hwCapL3 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
} else {
let filteredHwCapL3 = hwCapL3 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(podDeviceList, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
}
for deviceKey, deviceValue in filteredHwCapL3{
filteredHwCapL3[deviceKey]["MAC"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LEM\", \"feature\": \"MAC\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LEM\", \"feature\": \"MAC\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["FEC Routing"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"FEC\", \"feature\": \"Routing\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"FEC\", \"feature\": \"Routing\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing1"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource1\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource1\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing2"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource2\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource2\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing3"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource3\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource3\"}")]["maxLimit"]*100
}
filteredHwCapL3 | map(_value | fields("MAC","FEC Routing", "Routing1", "Routing2", "Routing3"))
7050X3 Switches
# Get the devices that have the `hdl` (high-density leaf) tag
let devices = merge(`analytics:/tags/labels/devices/switch_role/value/hdl/elements`)
# Get the L3 hardware capacity for all devices
let hwCapL3 =`*:/Sysdb/hardware/capacity/status/l3/entry`
# Get the L2 hardware capacity for all devices
let hwCapL2 =`*:/Sysdb/hardware/capacity/status/l2/entry`
# Get the devices that are part of a specific pod
let podDeviceList = merge(`analytics:/tags/labels/devices/pod_name/value/<_pod_name>/elements`)
# If the POD_NAME variable is not set (none) show the utilization for all pods
if str(_pod_name) == "" {
let filteredHwCapL3 = hwCapL3 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
let filteredHwCapL2 = hwCapL2 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
} else {
let filteredHwCapL3 = hwCapL3 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(podDeviceList, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
let filteredHwCapL2 = hwCapL2 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(podDeviceList, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
}
# Build a new table with MAC, HOST, LPM and NextHop utilization
for deviceKey, deviceValue in filteredHwCapL3{
filteredHwCapL3[deviceKey]["Host Percent"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"Host\", \"feature\": \"\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"Host\", \"feature\": \"\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["LPM Percent"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LPM\", \"feature\": \"\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LPM\", \"feature\": \"\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["NextHop Percent"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"NextHop\", \"feature\": \"\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"NextHop\", \"feature\": \"\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["MAC Percent"] = filteredHwCapL2[deviceKey][complexKey("{\"chip\": \"Linecard0/0\", \"table\":\"MAC\", \"feature\": \"L2\"}")]["used"] / filteredHwCapL2[deviceKey][complexKey("{\"chip\": \"Linecard0/0\", \"table\":\"MAC\", \"feature\": \"L2\"}")]["maxLimit"]*100
}
filteredHwCapL3 | map(_value | fields("MAC Percent","Host Percent", "LPM Percent", "NextHop Percent"))
7020R Switches
# Get the devices that have the `ldl` (low-density leaf) tag
let devices = merge(`analytics:/tags/labels/devices/switch_role/value/ldl/elements`)
# Get the L3 hardware capacity for all devices
let hwCapL3 =`*:/Sysdb/hardware/capacity/status/l3/entry`
# Get the multicast hardware capacity for all devices
let hwCapMcast = `*:/Sysdb/hardware/capacity/status/mcast/entry`
# Get the devices that are part of a specific pod
let podDeviceList = merge(`analytics:/tags/labels/devices/pod_name/value/<_pod_name>/elements`)
let filteredHwCapL3 = hwCapL3 | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(podDeviceList, complexKey("{\"deviceID\": \""+_key+"\"}")))| map(merge(_value) )
let filteredHwCapMcast = hwCapMcast | where(dictHasKey(devices, complexKey("{\"deviceID\": \""+_key+"\"}")) && dictHasKey(podDeviceList, complexKey("{\"deviceID\": \""+_key+"\"}"))) | map(merge(_value) )
# Build a new table with MAC, MCDB, FEC Routing, Routing1, Routing2 and Routing3 utilization
for deviceKey, deviceValue in filteredHwCapL3{
filteredHwCapL3[deviceKey]["MAC"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LEM\", \"feature\": \"MAC\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"LEM\", \"feature\": \"MAC\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["FEC Routing"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"FEC\", \"feature\": \"Routing\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"\", \"table\":\"FEC\", \"feature\": \"Routing\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing1"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource1\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource1\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing2"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource2\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource2\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["Routing3"] = filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource3\"}")]["used"] / filteredHwCapL3[deviceKey][complexKey("{\"chip\": \"Jericho\", \"table\":\"Routing\", \"feature\": \"Resource3\"}")]["maxLimit"]*100
filteredHwCapL3[deviceKey]["MCDB"] = filteredHwCapMcast[deviceKey][complexKey("{\"chip\": \"Jericho0\", \"table\":\"MCDB\", \"feature\": \"\"}")]["used"] / filteredHwCapMcast[deviceKey][complexKey("{\"chip\": \"Jericho0\", \"table\":\"MCDB\", \"feature\": \"\"}")]["maxLimit"]*100
}
filteredHwCapL3 | map(_value | fields("MAC","MCDB","FEC Routing", "Routing1", "Routing2", "Routing3"))
Listing Devices that have a file in /var/core
> Useful to understand if there were any agent crashes on EOS
let devices = `analytics:/Devices/*/versioned-data/Device` | map(merge(_value)["hostname"])
let result = newDict()
let deviceDiskStats = `*:/Kernel/vfs/stat/\/var\/core` | map(merge(_value))
let deviceDiskStats = deviceDiskStats | where(dictHasKey(_value, "blocks") && dictHasKey(_value, "bfree") && _value["blocks"] != _value["bfree"])
for device, diskStat in deviceDiskStats {
result[devices[device]] = newDict() | setFields("value", true)
}
result
List the serial numbers for all transceivers
let xcvrStatus = `*:/Sysdb/hardware/archer/xcvr/status/all/*`
let filteredXcvrStat = xcvrStatus | map(_value | mapne(_value, _value | field("vendorInfo") | field("vendorSn")))
filteredXcvrStat | map(_value | mapne(_value, _value[0]))
List the transceiver serial numbers that match the input regex
let data = `*:/Sysdb/hardware/archer/xcvr/status/all/*`
let xcvrStatus = data | map(_value | mapne(_value, _value | field("vendorInfo") | field("vendorSn")))
let xcvrStatus = xcvrStatus | map(_value | mapne(_value[0], _value))
xcvrStatus | map(_value | where(reMatch(_value, _regexInput))) | where(length(_value) > 0)