Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurelinux-sysinfo: package to deploy systemd service that writes system info to log #8696

Merged
merged 20 commits into from
Apr 4, 2024

Conversation

amritakohli
Copy link
Contributor

@amritakohli amritakohli commented Apr 3, 2024

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./SPECS/LICENSES-AND-NOTICES/data/licenses.json, ./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md, ./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Adds azurelinux-sysinfo package. Deploys a systemd service that gathers system information related to the device, operating system, cloud-init, boot time, resource utilization, installed packages, and SELinux mode. Collected information is written in JSON format to a log file on the user's system for easy access and analysis. The systemd service runs at boot time if installed during image creation.

Change Log
  • Added spec file.
  • Added files needed for the package.
  • Updated signatures.
Does this affect the toolchain?

NO

Test Methodology

Example output:
mariner_user@mariner-vm [ ~ ]$ sudo journalctl -u azurelinux-sysinfo
Apr 04 21:27:09 mariner-vm systemd[1]: Started Azure Linux Sysinfo Service.
Apr 04 21:27:09 mariner-vm python3[692]: Running azurelinux sysinfo collection...
Apr 04 21:27:09 mariner-vm python3[692]: Collecting asset id...
Apr 04 21:27:09 mariner-vm python3[692]: Collecting os info...
Apr 04 21:27:09 mariner-vm python3[692]: Collecting cloud-init info...
Apr 04 21:27:10 mariner-vm python3[692]: Collecting boot info...
Apr 04 21:27:10 mariner-vm python3[692]: Collecting disk and memory usage...
Apr 04 21:27:10 mariner-vm python3[692]: Collecting package info...
Apr 04 21:27:10 mariner-vm python3[692]: Collecting system info...
Apr 04 21:27:10 mariner-vm python3[692]: {'$schema': 'v1', 'source': 'azurelinux-sysinfo-service', 'asset_id': '71edd3a5-725e-42e7-a797-6f7994e4662f', 'os_info': {'kernel_version': '5.15.148.2-2.cm2', 'release_version': '2.0.20240301', 'release_version_id': '2.0'}, 'cloud_init_info': {'hostname': 'mariner-vm', 'longest_running_processes': [{'time': '41.90600s', 'process': '(modules-final/config-package_update_upgrade_install)'}, {'time': '00.50100s', 'process': '(init-network/config-users_groups)'}, {'time': '00.34500s', 'process': '(init-network/config-ssh)'}, {'time': '00.26800s', 'process': '(modules-final/config-scripts_user)'}, {'time': '00.06900s', 'process': '(init-local/search-NoCloud)'}]}, 'boot_info': {'boot_time': {'kernel_boot_time_secs': 1.289, 'initrd_boot_time_secs': 1.146, 'userspace_boot_time_secs': 4.972, 'total_boot_time_secs': 7.408}, 'longest_running_processes': [{'systemd-networkd-wait-online.service': 1.848}, {'cloud-init-local.service': 0.983}, {'initrd-switch-root.service': 0.832}]}, 'resource_utilization': {'disk_usage': {'disk_size_gib': '3.85', 'disk_usage_gib': '0.55'}, 'memory_usage': {'total_memory_gib': 3, 'available_memory_gib': 3}, 'cpu_usage': {'physical_cpu_count': 2, 'logical_cpu_count': 4, 'cpu_percent': 27.8}}, 'package_info': {'package_count': 236}, 'system_info': {'selinux_mode': 'Permissive'}}
Apr 04 21:27:10 mariner-vm python3[692]: Azure Linux sysinfo collection completed successfully.
Apr 04 21:27:10 mariner-vm systemd[1]: azurelinux-sysinfo.service: Deactivated successfully.

Known Issues
  • boot info only works in selinux permissive mode.
  • package works with 2.0 image, but not 3.0 image.

@amritakohli amritakohli marked this pull request as ready for review April 4, 2024 15:08
@amritakohli amritakohli requested a review from a team as a code owner April 4, 2024 15:08
@amritakohli
Copy link
Contributor Author

amritakohli commented Apr 4, 2024

Note: will update signatures and date at the end

@anphel31
Copy link
Member

anphel31 commented Apr 4, 2024

To fix the cgmanifest error you can add this new spec to the ignore list here: https://github.com/microsoft/azurelinux/blob/3.0-dev/.github/workflows/validate-cg-manifest.sh#L24

@amritakohli amritakohli merged commit e48376b into microsoft:3.0-dev Apr 4, 2024
13 checks passed
@amritakohli amritakohli deleted the amritakohli-azlsysinfo branch April 4, 2024 21:56
amritakohli added a commit that referenced this pull request Apr 16, 2024
amritakohli added a commit that referenced this pull request May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants