提交 2fec33ad 编写于 作者: N Nicolargo

Change connection message. Add SNMP client

上级 6a3701f3
......@@ -134,7 +134,6 @@ class GlancesClient():
# Init screen
self.screen = glancesCurses(args=self.args)
# Return result
return ret
......@@ -177,18 +176,18 @@ class GlancesClient():
"""
Get stats from SNMP server
Return the client/server connection status:
- Connected: Connection OK
- SNMP: Connection with SNMP server OK
- Disconnected: Connection NOK
"""
# Update the stats
try:
self.stats.update()
except socket.error as e:
except:
# Client can not get SNMP server stats
return "Disconnected"
else:
# Grab success
return "Connected"
return "SNMP"
def serve_forever(self):
"""
......
......@@ -256,7 +256,8 @@ class glancesCurses:
stats: Stats database to display
cs_status:
"None": standalone or server mode
"Connected": Client is connected to the server
"Connected": Client is connected to a Glances server
"SNMP": Client is connected to a SNMP server
"Disconnected": Client is disconnected from the server
Return:
......
......@@ -111,6 +111,9 @@ class Plugin(GlancesPlugin):
if args.cs_status.lower() == "connected":
msg = _("Connected to ")
ret.append(self.curse_add_line(msg, 'OK'))
elif args.cs_status.lower() == "snmp":
msg = _("SNMP from ")
ret.append(self.curse_add_line(msg, 'OK'))
elif args.cs_status.lower() == "disconnected":
msg = _("Disconnected from ")
ret.append(self.curse_add_line(msg, 'CRITICAL'))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册