Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
fddab11
Add unit tests for the collector module
devanshjainms Oct 15, 2025
1899fb2
Fix CommandCollector test to handle command execution failure correctly
devanshjainms Oct 15, 2025
513e4eb
Add check for NFS filesystems before collecting ANF and AFS storage data
devanshjainms Oct 15, 2025
278bfb1
Enhance configuration checks and reporting
devanshjainms Oct 15, 2025
fa5f404
Add checks for AFS and ANF storage usage in NFS mount information
devanshjainms Oct 15, 2025
dbadc17
Refactor network checks to use CONTEXT variables for resource group, …
devanshjainms Oct 15, 2025
f6b3153
Enhance filesystem collector to format LVM size units and update Azur…
devanshjainms Oct 15, 2025
f82e725
Refactor NFS and AFS checks to improve clarity and accuracy in storag…
devanshjainms Oct 15, 2025
502550e
Update severity level for Accelerated Networking check and enhance PP…
devanshjainms Oct 15, 2025
a4ddd02
Enhance AFS storage account processing and improve network interface …
devanshjainms Oct 16, 2025
b349d4b
Remove unnecessary output for network interface name in NIC count check
devanshjainms Oct 16, 2025
1b82e2b
Refine regex for Azure file endpoint matching to support private link…
devanshjainms Oct 16, 2025
bbb0c5c
Refactor AFS storage account extraction to simplify regex and improve…
devanshjainms Oct 16, 2025
12c4e8c
Remove commented-out network interface details and streamline OS type…
devanshjainms Oct 16, 2025
a4dcd91
Fix formatting in ANF IP address and AFS storage account name extract…
devanshjainms Oct 16, 2025
5d49af4
Enhance network interface reporting to distinguish between primary an…
devanshjainms Oct 16, 2025
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
16 changes: 14 additions & 2 deletions src/module_utils/filesystem_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,18 @@ def gather_lvm_groups_info(self, lvm_groups, vg_to_disk_names, azure_disk_data):
total_iops += perf_data.get("iops", 0)
total_mbps += perf_data.get("mbps", 0)

totalsize = vg_data.get("total_size", "")

lvm_groups_info.append(
{
"Name": vg_name,
"Disks": vg_data.get("disks", 0),
"LogicalVolumes": vg_data.get("logical_volumes", 0),
"TotalSize": vg_data.get("total_size", ""),
"TotalSize": (
totalsize.replace("g", "GiB").replace("t", "TiB")
if totalsize and isinstance(totalsize, str)
else totalsize
),
"TotalIOPS": total_iops,
"TotalMBPS": total_mbps,
}
Expand Down Expand Up @@ -704,14 +710,20 @@ def gather_lvm_volumes_info(self, lvm_volumes):

try:
for lv_name, lv_data in lvm_volumes.items():
size = lv_data.get("size", "")

lvm_volumes_info.append(
{
"Name": lv_name,
"VGName": lv_data.get("vg_name", ""),
"LVPath": lv_data.get("path", ""),
"DMPath": lv_data.get("dm_path", ""),
"Layout": lv_data.get("layout", ""),
"Size": lv_data.get("size", ""),
"Size": (
size.replace("g", "GiB").replace("t", "TiB")
if size and isinstance(size, str)
else size
),
"StripeSize": lv_data.get("stripe_size", ""),
"Stripes": lv_data.get("stripes", ""),
}
Expand Down
24 changes: 23 additions & 1 deletion src/playbook_00_configuration_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
| map(attribute='value')
| first }}"


- hosts: "{{ sap_sid | upper }}_SCS:
{{ sap_sid | upper }}_ERS:
{{ sap_sid | upper }}_DB:
Expand Down Expand Up @@ -98,6 +97,12 @@
checks_var: "common_sap_checks",
results_var: "common_sap_results"
}
- {
name: "Networking",
file_name: "network",
checks_var: "networking_checks",
results_var: "networking_results"
}
loop_control:
loop_var: check_type

Expand Down Expand Up @@ -264,6 +269,23 @@
groups[sap_sid | upper + '_PAS']|default([]) }}"
when: hostvars[item].common_sap_results is defined

- name: "Collect networking check results"
ansible.builtin.set_fact:
all_results: "{{ all_results + hostvars[item].networking_results
| default([]) }}"
execution_metadata: "{{ execution_metadata + [
{'host': item,
'check_type': 'networking',
'metadata': hostvars[item].networking_results_metadata
| default({})}] }}"
loop: "{{ groups[sap_sid | upper + '_SCS']|default([]) +
groups[sap_sid | upper + '_ERS']|default([]) +
groups[sap_sid | upper + '_DB']|default([]) +
groups[sap_sid | upper + '_APP']|default([]) +
groups[sap_sid | upper + '_WEB']|default([]) +
groups[sap_sid | upper + '_PAS']|default([]) }}"
when: hostvars[item].networking_results is defined

- name: "Collect DB (HANA) check results"
ansible.builtin.set_fact:
all_results: "{{ all_results + hostvars[item].db_hana_results
Expand Down
78 changes: 62 additions & 16 deletions src/roles/configuration_checks/tasks/disks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,54 @@
az disk show --name {{ item }} \
--subscription {{ compute_metadata.json.compute.subscriptionId }} \
--resource-group {{ compute_metadata.json.compute.resourceGroupName }} \
--query "{name:name, sku:sku.name, size:sizeGb, encryption:encryption.type, iops:diskIOPSReadWrite, mbps:diskMBpsReadWrite, size:diskSizeGB}" --output json
--query "{name:name, sku:sku.name, size:sizeGb, encryption:encryption.type, iops:diskIOPSReadWrite, mbps:diskMBpsReadWrite, size:diskSizeGB, tier:tier}" --output json

- name: Debug azure disks data collected
when: azure_disks_metadata_results is defined
ansible.builtin.debug:
var: azure_disks_metadata_results
verbosity: 1

- name: Check if any NFS filesystem is mounted
ansible.builtin.set_fact:
has_nfs_mounts: "{{ mount_info.stdout_lines | select('search', '\\snfs[34]?\\s') | list | length > 0 }}"

- name: Check for ANF usage in mount_info, looking for IP addresses
when: has_nfs_mounts | bool
ansible.builtin.set_fact:
anf_ip_addresses: "{{ mount_info.stdout_lines
| map('split', ' ')
| map('list')
| selectattr('1', 'defined')
| map(attribute='1')
| select('match', '^(\\d{1,3}\\.){3}\\d{1,3}:')
| map('regex_replace', '^((\\d{1,3}\\.){3}\\d{1,3}):.*', '\\1')
| list
| unique }}"
- name: Debug ANF IP addresses found
when: anf_ip_addresses is defined
ansible.builtin.debug:
var: anf_ip_addresses

- name: Check for AFS usage in mount_info, looking for storage account names
when: has_nfs_mounts | bool
ansible.builtin.set_fact:
afs_storage_accounts: "{{ mount_info.stdout_lines
| map('split', ' ')
| map(attribute='1')
| select('search', '\\.file\\.core\\.windows\\.net:/')
| map('regex_replace', '^.*:/([^/]+)/.*', '\\1')
| list
| unique }}"

- name: Debug AFS storage account names found
when: afs_storage_accounts is defined
ansible.builtin.debug:
var: afs_storage_accounts

- name: Collect ANF storage data if NFS is used
when:
- has_nfs_mounts | bool
- NFS_provider is defined
- "'ANF' in NFS_provider"
- ANF_account_rg is defined
Expand Down Expand Up @@ -155,29 +193,37 @@

- name: Collect AFS storage data if NFS is used
when:
- has_nfs_mounts | bool
- NFS_provider is defined
- "'AFS' in NFS_provider"
- afs_storage_accounts is defined
- afs_storage_accounts | length > 0
register: afs_storage_metadata_results
delegate_to: localhost
ansible.builtin.shell:
executable: /bin/bash
cmd: |
set -o pipefail
for sa in $(az storage account list \
--query "[?kind=='FileStorage'].{rg:resourceGroup,name:name,id:id}" \
-o tsv | awk '{print $1":"$2":"$3}'); do rg=$(echo $sa | cut -d: -f1); \
acc=$(echo $sa | cut -d: -f2); sid=$(echo $sa | cut -d: -f3); \
dns="$acc.file.core.windows.net"; for sh in $(az storage share-rm list --resource-group $rg --storage-account $acc \
--query "[?enabledProtocols=='NFS'].[name,accessTier,quotaGiB]" -o tsv); \
do name=$(echo $sh | awk '{print $1}'); tier=$(echo $sh | awk '{print $2}'); \
quota=$(echo $sh | awk '{print $3}'); \
peip=$(az network private-endpoint list \
--query "[?privateLinkServiceConnections[?privateLinkServiceId=='$sid']].customDnsConfigs[].ipAddresses[]" -o tsv); \
for ip in $peip; do thr=$((100 + ( (quota*4+99)/100 ) + ( (quota*6+99)/100 ) )); \
iops=$((quota+3000)); \
if [ $iops -gt 100000 ]; then iops=100000; fi; \
echo "{\"Type\":\"AFS\",\"Name\":\"$name\",\"Pool\":\"$acc\",\"ServiceLevel\":\"$tier\",\"ThroughputMibps\":$thr,\"ProtocolTypes\":\"NFS4.1\",\"NFSAddressDNS\":\"$dns:/$acc/$name\",\"NFSAddress\":\"$ip:/$acc/$name\",\"QoSType\":\"Manual\",\"IOPS\":$iops,\"Id\":\"$sid\"}"; \
done; done; done
for acc in {{ afs_storage_accounts | join(' ') }}; do
sa_info=$(az storage account show --name "$acc" --query "{rg:resourceGroup,name:name,id:id}" -o tsv)
rg=$(echo "$sa_info" | awk '{print $1}')
sid=$(echo "$sa_info" | awk '{print $3}')
dns="$acc.file.core.windows.net"
for sh in $(az storage share-rm list --resource-group "$rg" --storage-account "$acc" \
--query "[?enabledProtocols=='NFS'].[name,accessTier,quotaGiB]" -o tsv); do
name=$(echo "$sh" | awk '{print $1}')
tier=$(echo "$sh" | awk '{print $2}')
quota=$(echo "$sh" | awk '{print $3}')
peip=$(az network private-endpoint list \
--query "[?privateLinkServiceConnections[?privateLinkServiceId=='$sid']].customDnsConfigs[].ipAddresses[]" -o tsv)
for ip in $peip; do
thr=$((100 + ( (quota*4+99)/100 ) + ( (quota*6+99)/100 ) ))
iops=$((quota+3000))
if [ $iops -gt 100000 ]; then iops=100000; fi
echo "{\"Type\":\"AFS\",\"Name\":\"$name\",\"Pool\":\"$acc\",\"ServiceLevel\":\"$tier\",\"ThroughputMibps\":$thr,\"ProtocolTypes\":\"NFS4.1\",\"NFSAddressDNS\":\"$dns:/$acc/$name\",\"NFSAddress\":\"$ip:/$acc/$name\",\"QoSType\":\"Manual\",\"IOPS\":$iops,\"Id\":\"$sid\"}"
done
done
done

- name: Debug AFS storage data collected
when: afs_storage_metadata_results is defined
Expand Down
Loading
Loading