def start(self): log_important("Prometheus start: started") ssh = SSH(self.ip, self.user, self.ssh_options) ssh.exec( f""" mkdir -p data dir=$(find . -maxdepth 1 -type d -name "scylla-monitoring*" -print -quit) cd $dir ./start-all.sh -v {self.scylla_version} -d ../data """) log_important("Prometheus start: done")
def stop(self): log_important("Prometheus stop: started") ssh = SSH(self.ip, self.user, self.ssh_options) ssh.exec( f""" dir=$(find . -maxdepth 1 -type d -name "scylla-monitoring*" -print -quit) echo "directory [$dir]" cd $dir ./kill-all.sh """) log_important("Prometheus stop: done")
def __collect_ec2_metadata(ip, ssh_user, ssh_options, dir): dest_dir = os.path.join(dir, ip) os.makedirs(dest_dir, exist_ok=True) ssh = SSH(ip, ssh_user, ssh_options) ssh.update() ssh.install("curl") ssh.exec( "curl http://169.254.169.254/latest/dynamic/instance-identity/document > metadata.txt" ) ssh.scp_from_remote("metadata.txt", dest_dir)
def __new_ssh(self, ip): return SSH(ip, self.ssh_user, self.properties['ssh_options'])
def data_dir_rm(self): log_important("Prometheus clear data: started") ssh = SSH(self.ip, self.user, self.ssh_options) ssh.exec("rm -fr data") log_important("Prometheus clear data: done")
def data_dir_download(self, dir): log_important("Prometheus download data: started") ssh = SSH(self.ip, self.user, self.ssh_options) ssh.scp_from_remote(f"data", dir) log_important("Prometheus download data: done")
def data_dir_upload(self, dir): log_important("Prometheus upload: started") ssh = SSH(self.ip, self.user, self.ssh_options) ssh.scp_to_remote(dir + "/*", "data") log_important("Prometheus upload: done")
def __new_ssh(self, ip): return SSH(ip, self.ssh_user, self.ssh_options)