Change connection message. Add SNMP client

pull/354/head
Nicolargo 2014-05-07 09:53:57 +02:00
parent 6a3701f388
commit 2fec33adf3
3 changed files with 8 additions and 5 deletions

View File

@ -134,7 +134,6 @@ class GlancesClient():
# Init screen # Init screen
self.screen = glancesCurses(args=self.args) self.screen = glancesCurses(args=self.args)
# Return result # Return result
return ret return ret
@ -177,18 +176,18 @@ class GlancesClient():
""" """
Get stats from SNMP server Get stats from SNMP server
Return the client/server connection status: Return the client/server connection status:
- Connected: Connection OK - SNMP: Connection with SNMP server OK
- Disconnected: Connection NOK - Disconnected: Connection NOK
""" """
# Update the stats # Update the stats
try: try:
self.stats.update() self.stats.update()
except socket.error as e: except:
# Client can not get SNMP server stats # Client can not get SNMP server stats
return "Disconnected" return "Disconnected"
else: else:
# Grab success # Grab success
return "Connected" return "SNMP"
def serve_forever(self): def serve_forever(self):
""" """

View File

@ -256,7 +256,8 @@ class glancesCurses:
stats: Stats database to display stats: Stats database to display
cs_status: cs_status:
"None": standalone or server mode "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 "Disconnected": Client is disconnected from the server
Return: Return:

View File

@ -111,6 +111,9 @@ class Plugin(GlancesPlugin):
if args.cs_status.lower() == "connected": if args.cs_status.lower() == "connected":
msg = _("Connected to ") msg = _("Connected to ")
ret.append(self.curse_add_line(msg, 'OK')) 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": elif args.cs_status.lower() == "disconnected":
msg = _("Disconnected from ") msg = _("Disconnected from ")
ret.append(self.curse_add_line(msg, 'CRITICAL')) ret.append(self.curse_add_line(msg, 'CRITICAL'))