pull/19/head
Aidaho12 2018-03-24 19:50:53 +06:00
parent 1a5863e9f8
commit a3b26028ad
2 changed files with 16 additions and 5 deletions

View File

@ -325,11 +325,18 @@ def show_ip(stdout):
print(line)
def server_status(stdout):
if " " not in stdout.read().decode(encoding='UTF-8'):
print('<span class="serverUp"> UP</span> running 3 processes')
proc_count = ""
for line in stdout.read().decode(encoding='UTF-8'):
proc_count += line
if "0" != line:
err = 0
else:
err = 1
if err == 0:
print('<span class="serverUp"> UP</span> running %s processes' % proc_count)
else:
print('<span lass="serverDown"> DOWN</span> running 0 processes')
print('<span class="serverDown"> DOWN</span> running %s processes' % proc_count)
def ssh_command(serv, commands, **kwargs):
ssh = ssh_connect(serv)

View File

@ -100,7 +100,11 @@ print('</table><table class="overview"><tr class="overviewHead">'
'</td>'
'</tr>')
print('</td></tr>')
commands = [ "cat /etc/haproxy/haproxy.cfg |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l", "uname -smor", "haproxy -v |head -1", "top -u haproxy -b -n 1" ]
commands = [ "cat /etc/haproxy/haproxy.cfg |grep -E '^listen|^backend|^frontend' |grep -v stats |wc -l",
"uname -smor",
"haproxy -v |head -1",
"systemctl status haproxy |grep Active | sed 's/^[ \t]*//'",
"top -u haproxy -b -n 1" ]
for i in sorted(listhap):
print('<tr><td class="overviewTr"><a name="'+i+'"></a><h3 title="IP ' + listhap.get(i) + '">' + i + ':</h3></td>')
print('<td class="overviewTd"><span style="margin-left: -10px;">Total listen/frontend/backend:</span><pre>')