[PATCH 3/5] sysbench: add monitoring framework integration

Luis Chamberlain <[email protected]>
Newsgroups dev.linux.lists.kdevops
Message-ID <[email protected]>
Add support for the monitoring framework to sysbench workflow, matching
the implementation in other workflows. This allows sysbench to leverage
all monitoring capabilities including the new eBPF fragmentation monitoring.

Changes:
- Import monitor_run tasks before test execution
- Import monitor_collect tasks after test completion
- Add monitor-results make target for interim data collection
- Add sysbench to monitoring results path detection
- Install python3-bpfcc/python3-bcc dependency across all distributions

With these changes, users can simply enable monitoring options in
menuconfig and sysbench will automatically start/stop monitoring
during test execution.

Generated-by: Claude AI
Signed-off-by: Luis Chamberlain <[email protected]>
---
 playbooks/roles/monitoring/tasks/monitor_collect.yml |  2 ++
 .../sysbench/tasks/install-deps/debian/main.yml      |  2 ++
 .../sysbench/tasks/install-deps/redhat/main.yml      |  1 +
 .../roles/sysbench/tasks/install-deps/suse/main.yml  |  1 +
 playbooks/roles/sysbench/tasks/main.yaml             | 12 ++++++++++++
 workflows/sysbench/Makefile                          |  8 +++++++-
 6 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/playbooks/roles/monitoring/tasks/monitor_collect.yml b/playbooks/roles/monitoring/tasks/monitor_collect.yml
index 967526b40428..9662f827301f 100644
--- a/playbooks/roles/monitoring/tasks/monitor_collect.yml
+++ b/playbooks/roles/monitoring/tasks/monitor_collect.yml
@@ -117,6 +117,8 @@
         {{ topdir_path }}/workflows/fstests/results/monitoring
       {%- elif kdevops_workflow_enable_mmtests|default(false)|bool -%}
         {{ topdir_path }}/workflows/mmtests/results/monitoring
+      {%- elif kdevops_workflow_enable_sysbench|default(false)|bool -%}
+        {{ topdir_path }}/workflows/sysbench/results/monitoring
       {%- else -%}
         {{ topdir_path }}/results/monitoring
       {%- endif -%}
diff --git a/playbooks/roles/sysbench/tasks/install-deps/debian/main.yml b/playbooks/roles/sysbench/tasks/install-deps/debian/main.yml
index bd091389edf8..0a7943640797 100644
--- a/playbooks/roles/sysbench/tasks/install-deps/debian/main.yml
+++ b/playbooks/roles/sysbench/tasks/install-deps/debian/main.yml
@@ -25,6 +25,7 @@
       - docker.io
       - locales
       - rsync
+      - python3-bpfcc
     state: present
     update_cache: true
   tags: ["deps"]
@@ -72,6 +73,7 @@
     name:
       - locales
       - rsync
+      - python3-bpfcc
     state: present
     update_cache: true
   when: "sysbench_type_postgresql_native|bool"
diff --git a/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml b/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
index 9b780db2dd13..04e67434fb5b 100644
--- a/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
+++ b/playbooks/roles/sysbench/tasks/install-deps/redhat/main.yml
@@ -22,3 +22,4 @@
   vars:
     packages:
       - docker
+      - python3-bcc
diff --git a/playbooks/roles/sysbench/tasks/install-deps/suse/main.yml b/playbooks/roles/sysbench/tasks/install-deps/suse/main.yml
index f9e78f3881ad..0dfb2f651670 100644
--- a/playbooks/roles/sysbench/tasks/install-deps/suse/main.yml
+++ b/playbooks/roles/sysbench/tasks/install-deps/suse/main.yml
@@ -62,6 +62,7 @@
   ansible.builtin.package:
     name:
       - docker
+      - python3-bcc
     state: present
   when:
     - repos_present|bool
diff --git a/playbooks/roles/sysbench/tasks/main.yaml b/playbooks/roles/sysbench/tasks/main.yaml
index 77c57d6a9dee..bd550428d8c7 100644
--- a/playbooks/roles/sysbench/tasks/main.yaml
+++ b/playbooks/roles/sysbench/tasks/main.yaml
@@ -30,6 +30,12 @@
     name: create_data_partition
   tags: ["mkfs"]
 
+# Start monitoring services before running tests
+- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_run.yml
+  when:
+    - enable_monitoring|default(false)|bool
+  tags: ["run_sysbench", "monitoring", "monitor_run"]
+
 - name: MySQL Docker
   ansible.builtin.import_tasks: mysql-docker/main.yaml
   when: sysbench_type_mysql_docker | bool
@@ -37,3 +43,9 @@
 - name: PostgreSQL Native
   ansible.builtin.import_tasks: postgresql-native/main.yaml
   when: sysbench_type_postgresql_native | bool
+
+# Collect monitoring data after tests complete
+- ansible.builtin.import_tasks: ../../monitoring/tasks/monitor_collect.yml
+  when:
+    - enable_monitoring|default(false)|bool
+  tags: ["run_sysbench", "monitoring", "monitor_collect"]
diff --git a/workflows/sysbench/Makefile b/workflows/sysbench/Makefile
index 66e594d34841..45347d79ed1f 100644
--- a/workflows/sysbench/Makefile
+++ b/workflows/sysbench/Makefile
@@ -1,4 +1,4 @@
-PHONY += sysbench sysbench-test sysbench-telemetry sysbench-help-menu
+PHONY += sysbench sysbench-test sysbench-telemetry sysbench-help-menu monitor-results
 
 
 TAGS_SYSBENCH_RUN := db_start
@@ -47,6 +47,11 @@ sysbench-results:
 		playbooks/sysbench.yml \
 		--tags $(subst $(space),$(comma),$(TAGS_SYSBENCH_RESULTS))
 
+monitor-results: $(KDEVOPS_EXTRA_VARS)
+	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
+		playbooks/monitor-results.yml \
+		--extra-vars=@./extra_vars.yaml
+
 sysbench-clean:
 	$(Q)ansible-playbook $(ANSIBLE_VERBOSE) \
 		playbooks/sysbench.yml \
@@ -65,6 +70,7 @@ sysbench-help-menu:
 	@echo "sysbench-test                     - Run sysbench tests and collect results (with telemetry)"
 	@echo "sysbench-telemetry                - Gather sysbench telemetry data on each node"
 	@echo "sysbench-results                  - Collect all sysbench results onto local host"
+	@echo "monitor-results                   - Collect interim monitoring data without stopping monitoring"
 	@echo "sysbench-clean                    - Remove any previous results on node and host"
 	@echo ""
 
-- 
2.45.2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.