[ SEA-GHOST MINI SHELL]
#!/usr/bin/python
import os
import json
OUTPUT = {"data": []}
nodes = []
nodeslist = os.popen("sudo pcs status cluster").readlines()
result = [node.rstrip() for node in nodeslist]
def get_pacemaker_info():
for counter, value in enumerate(result):
if value=="PCSD Status:":
nodes = [x.strip(' ') for x in result[counter+1::]]
for x in nodes:
y = x.split(":")
OUTPUT["data"].append({"{#PCSNODE}":y[0],"{#PCSSTATUS}":y[1].replace(' ','')})
return json.dumps(OUTPUT)
if __name__ == "__main__":
print(get_pacemaker_info())
SEA-GHOST - SHELL CODING BY SEA-GHOST