Skip to content

Commit

Permalink
top: Support per-node file report for remote monitoring
Browse files Browse the repository at this point in the history
Signed-off-by: iipeace <[email protected]>
  • Loading branch information
iipeace committed Jan 2, 2024
1 parent cc21555 commit fbabaed
Showing 1 changed file with 38 additions and 11 deletions.
49 changes: 38 additions & 11 deletions guider/guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__credits__ = "Peace Lee"
__license__ = "GPLv2"
__version__ = "3.9.8"
__revision__ = "240101"
__revision__ = "240102"
__maintainer__ = "Peace Lee"
__email__ = "[email protected]"
__repository__ = "https://github.com/iipeace/guider"
Expand Down Expand Up @@ -34798,9 +34798,12 @@ def printHelp(force=False, isExit=True):
# {0:1} {1:1} -e r -N [email protected]:5555, [email protected]:5555
# {0:1} {1:1} -e r -N [email protected]:5555, [email protected]:5555

- Print monitoring data from remote server with host name filter
- Print monitoring data from remote servers with host name filter
# {0:1} {1:1} -x 5555 -X -q HOSTFILTER:"*LINUX*"

- Save monitoring data from remote servers into a specific file
# {0:1} {1:1} -x 5555 -X -o .

- {3:1} {2:1} with sending signals to specific {2:1}
# {0:1} {1:1} -k a.out:SIGKILL
# {0:1} {1:1} -k a.out:SIGKILL:CONT
Expand Down Expand Up @@ -45298,6 +45301,31 @@ def stopHandler(signum=None, frame=None):
if SysMgr.pipeEnable:
SysMgr.reloadFileBuffer()

# init summary variables #
current = True

# handle reports based on remote monitoring data #
for n, v in SysMgr.hostList.items():
buf = v["buffer"]
if not buf:
continue

# create a summarizing process #
pid = SysMgr.createProcess()
if pid > 0:
continue

# init environments #
current = False
SysMgr.procBuffer = buf
SysMgr.addEnvironVar("NOHEADER")
SysMgr.fileSuffix = "%s_%s_%s" % (
v["hostname"],
n,
SysMgr.pid,
)
break

SysMgr.printLogo(absolute=True, big=True)

# save system info #
Expand All @@ -45311,7 +45339,7 @@ def stopHandler(signum=None, frame=None):
TaskAnalyzer.printFileInterval()
SysMgr.printProcBuffer()
else:
TaskAnalyzer.printIntervalUsage()
TaskAnalyzer.printIntervalUsage(current=current)

# print output of last commands #
if "PRINTCMD" in SysMgr.environList:
Expand Down Expand Up @@ -135775,16 +135803,19 @@ def handleServerResponse(self, packet):
return

# save host data #
if hostaddr in SysMgr.hostList:
SysMgr.hostList[hostaddr]["hostname"] = hostname
else:
if not hostaddr in SysMgr.hostList:
SysMgr.hostList[hostaddr] = {
"hostname": hostname,
"surface": "",
"buffer": [],
}

# save screen data #
SysMgr.hostList[hostaddr]["surface"] = data.rstrip().split("\n")
host = SysMgr.hostList[hostaddr]
host["hostname"] = hostname
host["surface"] = data.rstrip().split("\n")
if SysMgr.outPath:
host["buffer"].insert(0, UtilMgr.removeColor(data))

# init screen vars #
nrLine = 0
Expand Down Expand Up @@ -135819,10 +135850,6 @@ def handleServerResponse(self, packet):
fullSurface += "\n".join(window) + "\n\n"

nrSurface += 1

# handle per-node output file #
if SysMgr.outPath:
pass
except SystemExit:
sys.exit(0)
except KeyboardInterrupt:
Expand Down

0 comments on commit fbabaed

Please sign in to comment.