mirror of
https://github.com/nicolargo/glances.git
synced 2024-11-11 17:26:37 +03:00
Add configuratino varfor SNMP community and port number
This commit is contained in:
parent
dbb2476339
commit
35ad7eb3fb
@ -122,6 +122,10 @@ class GlancesMain(object):
|
||||
help=_('define a client/server password from the prompt'))
|
||||
parser.add_argument('-s', '--server', action='store_true', default=False,
|
||||
dest='server', help=_('run Glances in server mode'))
|
||||
parser.add_argument('--snmp-community', default='public', dest='snmp_community',
|
||||
help=_('SNMP community'))
|
||||
parser.add_argument('--snmp-port', default=161, type=int,
|
||||
dest='snmp_port', help=_('SNMP port'))
|
||||
parser.add_argument('-t', '--time', default=self.refresh_time, type=int,
|
||||
dest='seconds', help=_('set refresh time in seconds [default: %s sec]') % self.refresh_time)
|
||||
parser.add_argument('-w', '--webserver', action='store_true', default=False,
|
||||
|
@ -243,7 +243,9 @@ class GlancesStatsClientSNMP(GlancesStats):
|
||||
from glances.core.glances_snmp import GlancesSNMPClient
|
||||
|
||||
# Create an instance of the SNMP client
|
||||
clientsnmp = GlancesSNMPClient(host=self.args.client)
|
||||
clientsnmp = GlancesSNMPClient(host=self.args.client,
|
||||
port=self.args.snmp_port,
|
||||
community=self.args.snmp_community)
|
||||
|
||||
return clientsnmp.get_by_oid("1.3.6.1.2.1.1.5.0") != {}
|
||||
|
||||
|
@ -66,7 +66,9 @@ class GlancesPlugin(object):
|
||||
from glances.core.glances_snmp import GlancesSNMPClient
|
||||
|
||||
# Init the SNMP request
|
||||
clientsnmp = GlancesSNMPClient(host=self.args.client)
|
||||
clientsnmp = GlancesSNMPClient(host=self.args.client,
|
||||
port=self.args.snmp_port,
|
||||
community=self.args.snmp_community)
|
||||
|
||||
# Process the SNMP request
|
||||
snmpresult = clientsnmp.get_by_oid(*snmp_oid.values())
|
||||
|
Loading…
Reference in New Issue
Block a user