Mentions légales du service

Skip to content
Snippets Groups Projects
Verified Commit 91bd5b66 authored by SIMONIN Matthieu's avatar SIMONIN Matthieu
Browse files

Replace dstat by dool fork

Fix #73
parent ac59222f
No related branches found
No related tags found
No related merge requests found
......@@ -210,7 +210,6 @@ test_dstat$debian$:
#-----------------------------------------------
test_static_run_command$ubuntu$: &ubuntu
<<: *debian10
allow_failure: true
image: ubuntu:latest
test_static_gather_facts$ubuntu$:
......@@ -236,7 +235,6 @@ test_discover_networks$ubuntu$:
test_dstat$ubuntu$:
<<: *ubuntu
allow_failure: true
###############################################################################
#
......
......@@ -7,7 +7,7 @@ import logging
import os
import time
logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.DEBUG)
# path to the inventory
inventory = os.path.join(os.getcwd(), "hosts")
......@@ -18,10 +18,10 @@ conf = Configuration.from_settings(job_type="allow_classic_ssh",
network = NetworkConfiguration(id="n1",
type="prod",
roles=["my_network"],
site="rennes")
site="nancy")
conf.add_network_conf(network)\
.add_machine(roles=["control"],
cluster="paravance",
cluster="grisou",
nodes=2,
primary_network=network)\
.finalize()
......
......@@ -11,6 +11,11 @@ from ..utils import _check_path
OUTPUT_FILE = "dstat.csv"
TMUX_SESSION = "__enoslib_dstat__"
DOOL_URL = ("https://raw.githubusercontent.com/"
"scottchiefbaker/dool/6b89f2d0b6e38e1c8d706e88a12e020367f5100d/dool")
DOOL_DIR = Path("/opt/enoslib_dool")
DOOL_PATH = DOOL_DIR / "dool"
class Dstat(Service):
def __init__(
......@@ -63,11 +68,18 @@ class Dstat(Service):
with play_on(
roles=self._roles, priors=self.priors, extra_vars=self.extra_vars
) as p:
p.apt(name=["dstat", "tmux"], state="present")
p.apt(name=["tmux"], state="present")
# install dool
p.file(path=str(DOOL_DIR), state="directory")
p.get_url(url=DOOL_URL, dest=str(DOOL_PATH), mode="0755")
p.file(path=self.remote_working_dir, recurse="yes", state="directory")
options = f"{self.options} -o {OUTPUT_FILE}"
p.shell((f"(tmux ls | grep {TMUX_SESSION}) || "
f"tmux new-session -s {TMUX_SESSION} -d 'exec dstat {options}'"),
p.shell(
(
f"(tmux ls | grep {TMUX_SESSION}) || "
f"tmux new-session -s {TMUX_SESSION} "
f"-d 'exec {DOOL_PATH} {options}'"
),
chdir=self.remote_working_dir,
display_name=f"Running dstat with the options {options}",
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment