-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
executable file
·41 lines (37 loc) · 1.26 KB
/
Copy pathexample.py
File metadata and controls
executable file
·41 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
import os
from jkmanager import *
try:
passed_url = sys.argv[1]
except:
print "No url was passed! Provide a url: http://servername/jkmanager"
quit()
username = ''
password = ''
parser = JKManager(passed_url)
parser.set_credentials(username, password)
parser.run()
quit = False
while quit == False:
print "\n======================="
print "Current status: (" + str(len(parser.servers)) + " node(s) found)"
print "=======================\n"
print "Status Server Worker\tBalancer"
for instance in parser.servers:
server_status = instance.getStatus()
server_name = (instance.vahst).split(".")[0]
if (server_status == "Active"):
print "[\033[92m Active \033[0m] " + server_name + "\t" + instance.name + "\t" + instance.balancer
elif (server_status == "Disabled"):
print "[\033[31mDisabled\033[0m] " + server_name + "\t" + instance.name + "\t" + instance.balancer
print
input = raw_input("Status, Enable, Disable: ")
if input.lower() == "enable":
for server in parser.servers:
server.enable()
elif input.lower() == "disable":
print "Disabling..."
for server in parser.servers:
server.disable()
elif input.lower() == "quit":
quit = True