Skip to content

Commit 9586a76

Browse files
committed
large-db-test-adjust
1 parent 68be98a commit 9586a76

8 files changed

Lines changed: 574 additions & 0 deletions

aci-preupgrade-validation-script.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5205,6 +5205,74 @@ def isis_database_byte_check(tversion, **kwargs):
52055205
return Result(result=NA, msg=VER_NOT_AFFECTED)
52065206
return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)
52075207

5208+
@check_wrapper(check_title='Large APIC Database')
5209+
def large_apic_database_check(cversion, **kwargs):
5210+
title = 'Large APIC Database'
5211+
result = PASS
5212+
msg = ''
5213+
headers = ["APIC Id", "DME", "Class", "Counters"]
5214+
5215+
data = []
5216+
recommended_action = 'Contact Cisco TAC to investigate the large than usual DB size'
5217+
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#large-apic-database'
5218+
5219+
top_class_stats = kwargs.get("top_class_stats")
5220+
top_db_stats = kwargs.get("top_db_stats")
5221+
5222+
dme_svc_list = ['vmmmgr', 'policymgr', 'eventmgr', 'policydist']
5223+
apic_svr_dict = {}
5224+
apic_node_api = 'infraWiNode.json'
5225+
apic_node_mo = icurl('class', apic_node_api)
5226+
for apic in apic_node_mo:
5227+
if apic['infraWiNode']['attributes']['operSt'] == 'available':
5228+
apic_id = apic['infraWiNode']['attributes']['id']
5229+
apic_name = apic['infraWiNode']['attributes']['nodeName']
5230+
if apic_id not in apic_svr_dict:
5231+
apic_svr_dict[apic_id] = apic_name
5232+
5233+
if cversion.older_than("6.1(3a)"):
5234+
for dme in dme_svc_list:
5235+
for id in apic_svr_dict:
5236+
if len(apic_svr_dict) == 3 and int(id) != 2:
5237+
continue
5238+
apic_hostname = apic_svr_dict[id]
5239+
5240+
if not top_class_stats:
5241+
collect_stats_cmd = 'cat /debug/'+apic_hostname+'/'+dme+'/mitmocounters/mo | grep -v ALL | sort -rn -k3 | head -3'
5242+
collect_shard_stats = subprocess.Popen(collect_stats_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
5243+
top_class_stats = collect_shard_stats.communicate()[0].strip().decode("utf-8")
5244+
5245+
for svc_stats in top_class_stats.splitlines():
5246+
logging.debug("APIC Id: " + id + " + DME name: " + dme + " + MoCounter " + str(svc_stats))
5247+
if ":" in svc_stats:
5248+
class_name = svc_stats.split(":")[0].strip()
5249+
mo_count = svc_stats.split(":")[1].strip()
5250+
if int(mo_count) > 1000*1000*1.5:
5251+
data.append([id, dme, class_name, mo_count])
5252+
else:
5253+
headers = ["APIC Id", "DME", "Shard ", "Size"]
5254+
for id in apic_svr_dict:
5255+
if len(apic_svr_dict) == 3 and int(id) != 2:
5256+
continue
5257+
collect_stats_cmd = "acidiag dbsize --topshard --apic " + id + " -f json"
5258+
logging.debug(collect_stats_cmd)
5259+
5260+
if not top_db_stats:
5261+
collect_shard_stats = subprocess.Popen(collect_stats_cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
5262+
collect_shard_stats_data = collect_shard_stats.communicate()[0].strip()
5263+
top_db_stats = json.loads(collect_shard_stats_data)
5264+
5265+
for db_stats in top_db_stats['dbs']:
5266+
logging.debug(db_stats)
5267+
if int(db_stats['size_b'])>=1073741824 * 5:
5268+
apic_id = db_stats['apic']
5269+
dme = db_stats['dme']
5270+
shard = db_stats['shard_replica']
5271+
size = db_stats['size_h']
5272+
data.append([id, dme, shard, size])
5273+
if data:
5274+
result = FAIL_O
5275+
return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)
52085276

52095277
# ---- Script Execution ----
52105278

@@ -5289,6 +5357,7 @@ def get_checks(api_only, debug_function):
52895357
post_upgrade_cb_check,
52905358
validate_32_64_bit_image_check,
52915359
fabric_link_redundancy_check,
5360+
large_apic_database_check,
52925361

52935362
# Faults
52945363
apic_disk_space_faults_check,

docs/docs/validations.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Items | This Script
3535
[Post Upgrade CallBack Integrity][g15] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
3636
[6.0(2)+ requires 32 and 64 bit switch images][g16] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
3737
[Fabric Link Redundancy][g17] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
38+
[Large APIC Database][g18] | :white_check_mark: | :no_entry_sign: | :no_entry_sign:
3839

3940
[g1]: #compatibility-target-aci-version
4041
[g2]: #compatibility-cimc-version
@@ -53,6 +54,7 @@ Items | This Script
5354
[g15]: #post-upgrade-callback-integrity
5455
[g16]: #602-requires-32-and-64-bit-switch-images
5556
[g17]: #fabric-link-redundancy
57+
[g18]: #large-apic-database
5658

5759
### Fault Checks
5860
Items | Faults | This Script | APIC built-in | Pre-Upgrade Validator (App)
@@ -471,6 +473,18 @@ When upgrading the switches, traffic traversing a Leaf Switch that is connected
471473

472474
To prevent this scenario, ensure that every leaf is connected to at least two Spine Switches (or tier-1 Leaf Switches). This check will alert if any Leaf Switches are found to only be connected to a single Spine Switch (or tier-1 Leaf Switch).
473475

476+
### Large APIC Database
477+
478+
It is generally expected that individual APIC DB Shard sizes remain below 5G in steady state, even in high scale configurations. If a single shard goes above this size, it can lead to an elongated upgrade timing, or even an upgrade failure, and in most cases is indicative of an underlying condition.
479+
480+
The script performs 2 different checks depending on the version you are running.
481+
482+
If current version is below 6.1(3), the script checks all APICs' class's object count. If the count is found to be above 150*1000*1000 then it will flag the DME for further investigation.
483+
484+
If the current version is 6.1(3f) or above, the script will utilize the newly added `acidiag dbsize` command and check if any of the top large DB files have exceeded 5G.
485+
486+
When alerted to this specific warning, Contact TAC to collect a database dump of the DME and shards that are in question for further analysis.
487+
474488

475489
## Fault Check Details
476490

0 commit comments

Comments
 (0)