how to run the following command in python script?
echo "show stat" | socat unix-connect:/var/run/haproxy/admin.sock stdio | grep webservers,BACKEND | cut -d , -f8
I tried this
import subprocess
var = subprocess.check_output(echo "show stat" | socat unix-connect:/var/run/haproxy/admin.sock stdio '| grep ' webservers,BACKEND' | cut -d , -f8', shell=True)
var=int(var)
but That doesn't work !