From e1bf440917567c8c78a9c00af22e074bfb68d900 Mon Sep 17 00:00:00 2001 From: Brad Churchwell Date: Tue, 5 Jul 2022 14:08:21 -0500 Subject: [PATCH 1/6] bring in stress test recipe --- stress_test/package.json | 30 +++++++++++ stress_test/run.sh | 66 +++++++++++++++++++++++ stress_test/stress_cpu.service | 7 +++ stress_test/stress_gpu.service | 8 +++ stress_test/stress_network_client.service | 7 +++ stress_test/stress_network_server.service | 7 +++ 6 files changed, 125 insertions(+) create mode 100644 stress_test/package.json create mode 100755 stress_test/run.sh create mode 100644 stress_test/stress_cpu.service create mode 100644 stress_test/stress_gpu.service create mode 100644 stress_test/stress_network_client.service create mode 100644 stress_test/stress_network_server.service diff --git a/stress_test/package.json b/stress_test/package.json new file mode 100644 index 0000000..fd64570 --- /dev/null +++ b/stress_test/package.json @@ -0,0 +1,30 @@ +{ + "name": "stress_test", + "display_name": "Stress Test", + "description": "Stress Test for CPU, GPU, and Networking", + "parameters": [ + { + "name": "SERVER", + "display_name": "iPerf Server?", + "description": "Is this node a Server or Client for iPerf?", + "type": "boolean", + "required": false + }, + { + "name": "SERVER_IP", + "display_name": "Server IP Address", + "description": "IP Address of iPerf Server", + "type": "string", + "required": false + } + ], + "main": "stress_test/run.sh", + "dependencies": [ + "stress_test/run.sh", + "stress_test/stress_network_server.service", + "stress_test/stress_network_client.service", + "stress_test/stress_cpu.service", + "stress_test/stress_gpu.service", + "utils/cachengo.sh" + ] +} diff --git a/stress_test/run.sh b/stress_test/run.sh new file mode 100755 index 0000000..4625356 --- /dev/null +++ b/stress_test/run.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +source "utils/cachengo.sh" + +function do_install { + set -e + cachengo-cli updateInstallStatus $APPID "Installing" + + if [ "$SERVER" == "true" ]; then + cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" + apt install iperf -y + cp stress_test/stress_network_server.service /lib/systemd/system/ + cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" + apt install stress -y + cp stress_test/stress_cpu.service /lib/systemd/system/ + cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" + apt install hashcat -y + cp stress_test/stress_gpu.service /lib/systemd/system/ + cd / && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - + # cp stress_test/hashcat-5.1.0.7z / + # apt install p7zip -y + # p7zip -d /hashcat-5.1.0.7z + unzip /hashcat-5.1.0.zip -d / + cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" + systemctl enable stress_network_server.service stress_cpu.service stress_gpu.service + systemctl daemon-reload + systemctl start stress_network_server.service stress_cpu.service stress_gpu.service + else + cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" + apt install iperf -y + sed -i "s/#server_ip#/$SERVER_IP/" stress_test/stress_network_client.service + cp stress_test/stress_network_client.service /lib/systemd/system/ + cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" + apt install stress -y + cp stress_test/stress_cpu.service /lib/systemd/system/ + cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" + apt install hashcat -y + cp stress_test/stress_gpu.service /lib/systemd/system/ + cd / && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - + # cp stress_test/hashcat-5.1.0.7z / + # apt install p7zip -y + # p7zip -d /hashcat-5.1.0.7z + unzip /hashcat-5.1.0.zip -d / + cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" + systemctl enable stress_network_client.service stress_cpu.service stress_gpu.service + systemctl daemon-reload + systemctl start stress_network_client.service stress_cpu.service stress_gpu.service + fi + + cachengo-cli updateInstallStatus $APPID "Installed" +} + +function do_uninstall { + cachengo-cli updateInstallStatus $APPID "Uninstalling" + systemctl stop stress_network_*.service stress_cpu.service stress_gpu.service + rm -rf /lib/systemd/system/stress_network_*.service + rm -rf /lib/systemd/system/stress_cpu.service + rm -rf /lib/systemd/system/stress_gpu.service + cachengo-cli updateInstallStatus $APPID "Uninstalled" +} + + +case "$1" in + install) do_install ;; + uninstall) do_uninstall ;; +esac diff --git a/stress_test/stress_cpu.service b/stress_test/stress_cpu.service new file mode 100644 index 0000000..296e512 --- /dev/null +++ b/stress_test/stress_cpu.service @@ -0,0 +1,7 @@ +[Unit] +Description=CPU_Stress_Test +[Service] +ExecStart=/usr/bin/stress --cpu 6 +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_gpu.service b/stress_test/stress_gpu.service new file mode 100644 index 0000000..dd3551c --- /dev/null +++ b/stress_test/stress_gpu.service @@ -0,0 +1,8 @@ +[Unit] +Description=CPU_Stress_Test +[Service] +WorkingDirectory=/hashcat-5.1.0 +ExecStart=/usr/bin/hashcat -b +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_network_client.service b/stress_test/stress_network_client.service new file mode 100644 index 0000000..334b74a --- /dev/null +++ b/stress_test/stress_network_client.service @@ -0,0 +1,7 @@ +[Unit] +Description=Network_Stress_Test_Client +[Service] +ExecStart=/usr/bin/iperf3 -c #server_ip# -t 0 +Restart=always +[Install] +WantedBy=multi-user.target diff --git a/stress_test/stress_network_server.service b/stress_test/stress_network_server.service new file mode 100644 index 0000000..0a087e0 --- /dev/null +++ b/stress_test/stress_network_server.service @@ -0,0 +1,7 @@ +[Unit] +Description=Network_Stress_Test_Server +[Service] +ExecStart=/usr/bin/iperf3 -s +Restart=always +[Install] +WantedBy=multi-user.target From e90594d7f6474cefea4978caa6df7ba66fc1d590 Mon Sep 17 00:00:00 2001 From: trombonebuster <69058128+trombonebuster@users.noreply.github.com> Date: Tue, 5 Jul 2022 14:10:49 -0500 Subject: [PATCH 2/6] Update stress_gpu.service --- stress_test/stress_gpu.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stress_test/stress_gpu.service b/stress_test/stress_gpu.service index dd3551c..9b57ae9 100644 --- a/stress_test/stress_gpu.service +++ b/stress_test/stress_gpu.service @@ -1,5 +1,5 @@ [Unit] -Description=CPU_Stress_Test +Description=GPU_Stress_Test [Service] WorkingDirectory=/hashcat-5.1.0 ExecStart=/usr/bin/hashcat -b From 4387826a8d88af68d04a940c1ab15b0d7bdc2e28 Mon Sep 17 00:00:00 2001 From: Brad Churchwell Date: Tue, 5 Jul 2022 15:17:57 -0500 Subject: [PATCH 3/6] moved dependencies to data dir --- stress_test/run.sh | 55 ++++++++++++++-------------------- stress_test/stress_gpu.service | 2 +- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/stress_test/run.sh b/stress_test/run.sh index 4625356..679de6f 100755 --- a/stress_test/run.sh +++ b/stress_test/run.sh @@ -2,51 +2,41 @@ source "utils/cachengo.sh" +DATADIR=/data/$APPID + function do_install { set -e cachengo-cli updateInstallStatus $APPID "Installing" + cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" if [ "$SERVER" == "true" ]; then - cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" + NETWORKSERVICE=stress_network_server.service apt install iperf -y cp stress_test/stress_network_server.service /lib/systemd/system/ - cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" - apt install stress -y - cp stress_test/stress_cpu.service /lib/systemd/system/ - cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" - apt install hashcat -y - cp stress_test/stress_gpu.service /lib/systemd/system/ - cd / && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - - # cp stress_test/hashcat-5.1.0.7z / - # apt install p7zip -y - # p7zip -d /hashcat-5.1.0.7z - unzip /hashcat-5.1.0.zip -d / - cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" - systemctl enable stress_network_server.service stress_cpu.service stress_gpu.service - systemctl daemon-reload - systemctl start stress_network_server.service stress_cpu.service stress_gpu.service else - cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" + NETWORKSERVICE=stress_network_client.service apt install iperf -y sed -i "s/#server_ip#/$SERVER_IP/" stress_test/stress_network_client.service cp stress_test/stress_network_client.service /lib/systemd/system/ - cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" - apt install stress -y - cp stress_test/stress_cpu.service /lib/systemd/system/ - cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" - apt install hashcat -y - cp stress_test/stress_gpu.service /lib/systemd/system/ - cd / && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - - # cp stress_test/hashcat-5.1.0.7z / - # apt install p7zip -y - # p7zip -d /hashcat-5.1.0.7z - unzip /hashcat-5.1.0.zip -d / - cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" - systemctl enable stress_network_client.service stress_cpu.service stress_gpu.service - systemctl daemon-reload - systemctl start stress_network_client.service stress_cpu.service stress_gpu.service fi + cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" + apt install stress -y + cp stress_test/stress_cpu.service /lib/systemd/system/ + + cachengo-cli updateInstallStatus $APPID "Installing: GPU Stress Test" + apt install hashcat -y + sed -i "s|#datadir#|$DATADIR|g" stress_test/stress_gpu.service + cp stress_test/stress_gpu.service /lib/systemd/system/ + mkdir -p $DATADIR + cd $DATADIR && curl -L https://github.com/hashcat/hashcat/archive/refs/tags/v5.1.0.zip -o hashcat-5.1.0.zip && cd - + unzip $DATADIR/hashcat-5.1.0.zip -d $DATADIR + + cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" + systemctl enable $NETWORKSERVICE stress_cpu.service stress_gpu.service + systemctl daemon-reload + systemctl start $NETWORKSERVICE stress_cpu.service stress_gpu.service + cachengo-cli updateInstallStatus $APPID "Installed" } @@ -56,6 +46,7 @@ function do_uninstall { rm -rf /lib/systemd/system/stress_network_*.service rm -rf /lib/systemd/system/stress_cpu.service rm -rf /lib/systemd/system/stress_gpu.service + rm -rf $DATADIR cachengo-cli updateInstallStatus $APPID "Uninstalled" } diff --git a/stress_test/stress_gpu.service b/stress_test/stress_gpu.service index 9b57ae9..8e52229 100644 --- a/stress_test/stress_gpu.service +++ b/stress_test/stress_gpu.service @@ -1,7 +1,7 @@ [Unit] Description=GPU_Stress_Test [Service] -WorkingDirectory=/hashcat-5.1.0 +WorkingDirectory=#datadir#/hashcat-5.1.0 ExecStart=/usr/bin/hashcat -b Restart=always [Install] From 0304439dc952bd8fc9318e3be3d1cf0e047550ce Mon Sep 17 00:00:00 2001 From: trombonebuster <69058128+trombonebuster@users.noreply.github.com> Date: Wed, 6 Jul 2022 00:15:31 -0500 Subject: [PATCH 4/6] Update run.sh --- stress_test/run.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stress_test/run.sh b/stress_test/run.sh index 679de6f..09f1193 100755 --- a/stress_test/run.sh +++ b/stress_test/run.sh @@ -11,14 +11,13 @@ function do_install { if [ "$SERVER" == "true" ]; then NETWORKSERVICE=stress_network_server.service - apt install iperf -y cp stress_test/stress_network_server.service /lib/systemd/system/ else NETWORKSERVICE=stress_network_client.service - apt install iperf -y sed -i "s/#server_ip#/$SERVER_IP/" stress_test/stress_network_client.service cp stress_test/stress_network_client.service /lib/systemd/system/ fi + apt install iperf -y cachengo-cli updateInstallStatus $APPID "Installing: CPU Stress Test" apt install stress -y From 1a807ee18ef2b31e9c09bb0c53f3849c769bf279 Mon Sep 17 00:00:00 2001 From: trombonebuster <69058128+trombonebuster@users.noreply.github.com> Date: Wed, 6 Jul 2022 00:16:22 -0500 Subject: [PATCH 5/6] Update run.sh --- stress_test/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stress_test/run.sh b/stress_test/run.sh index 09f1193..e661bac 100755 --- a/stress_test/run.sh +++ b/stress_test/run.sh @@ -7,8 +7,8 @@ DATADIR=/data/$APPID function do_install { set -e cachengo-cli updateInstallStatus $APPID "Installing" + cachengo-cli updateInstallStatus $APPID "Installing: Network Stress Test" - if [ "$SERVER" == "true" ]; then NETWORKSERVICE=stress_network_server.service cp stress_test/stress_network_server.service /lib/systemd/system/ From dc464d7b5b4771e3147e199b1bae1d851ecbe857 Mon Sep 17 00:00:00 2001 From: trombonebuster Date: Wed, 20 Dec 2023 11:29:14 -0600 Subject: [PATCH 6/6] disable services --- stress_test/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stress_test/run.sh b/stress_test/run.sh index e661bac..6bd5437 100755 --- a/stress_test/run.sh +++ b/stress_test/run.sh @@ -32,7 +32,7 @@ function do_install { unzip $DATADIR/hashcat-5.1.0.zip -d $DATADIR cachengo-cli updateInstallStatus $APPID "Installing: Starting Stress Test" - systemctl enable $NETWORKSERVICE stress_cpu.service stress_gpu.service +# systemctl enable $NETWORKSERVICE stress_cpu.service stress_gpu.service systemctl daemon-reload systemctl start $NETWORKSERVICE stress_cpu.service stress_gpu.service