Skip to content

Conversation

@alexandraBara
Copy link
Collaborator

How to run:

node-scraper run-plugins DmesgPlugin
node-scraper run-plugins DmesgPlugin --data ./scraper_logs_<>/dmesg_plugin/dmesg_collector/dmesg.log --collection False

This will analyze the dmesg.log specified by user and disable a new collection.

@alexandraBara alexandraBara added the bug Something isn't working label Jan 7, 2026
Comment on lines 124 to 157
collect_log_path = str(tmp_path / "collect_logs")
result = run_cli_command(
["--log-path", collect_log_path, "run-plugins", "DmesgPlugin"], check=False
)

output = result.stdout + result.stderr
assert result.returncode in [0, 1, 2]

dmesg_data_file = None
collect_path = Path(collect_log_path)

for log_dir in collect_path.glob("*"):
dmesg_plugin_dir = log_dir / "dmesg_plugin" / "dmesg_collector"
if dmesg_plugin_dir.exists():
for dmesg_file in dmesg_plugin_dir.glob("dmesg*.log"):
dmesg_data_file = str(dmesg_file)
break

if not dmesg_data_file:
sample_dmesg_dir = tmp_path / "sample_data"
sample_dmesg_dir.mkdir(parents=True, exist_ok=True)
dmesg_data_file = str(sample_dmesg_dir / "dmesg.log")

sample_content = """[ 0.000000] Linux version 5.15.0-generic (buildd@lcy02-amd64-001)
[ 0.001000] Command line: BOOT_IMAGE=/boot/vmlinuz root=UUID=test ro quiet splash
[ 1.234567] pci 0000:00:01.0: BAR 0: failed to assign [mem size 0x01000000]
[ 2.345678] WARNING: CPU: 0 PID: 1 at drivers/test/test.c:123 test_function+0x123/0x456
[ 3.456789] AMD-Vi: Event logged [IO_PAGE_FAULT device=00:14.0 domain=0x0000]
[ 4.567890] normal system message
[ 5.678901] ACPI Error: Method parse/execution failed
[ 10.123456] System is operational
"""
with open(dmesg_data_file, "w", encoding="utf-8") as f:
f.write(sample_content)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a sample dmesg file we should just create a file in the fixtures directory. It should also have iso timestamps like this:

"2023-06-01T01:00:00,685236-05:00 test message1\n"

)

output = result.stdout + result.stderr
assert result.returncode in [0, 1, 2], f"Unexpected return code: {result.returncode}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we checking for all these different return codes? The return code should be 1 if it was able to run.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any of those indicates that it ran somehow, but yeah i can restrict it to 1.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry 0, if it ran successfully it should be 0

@alexandraBara alexandraBara merged commit c527f66 into development Jan 8, 2026
6 checks passed
@alexandraBara alexandraBara deleted the alex_dmesg_analysis branch January 8, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants