repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nicolargo/glances | glances/plugins/glances_irq.py | GlancesIRQ.__humanname | def __humanname(self, line):
"""Return the IRQ name, alias or number (choose the best for human).
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts
"""
... | python | def __humanname(self, line):
"""Return the IRQ name, alias or number (choose the best for human).
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts
"""
... | [
"def",
"__humanname",
"(",
"self",
",",
"line",
")",
":",
"splitted_line",
"=",
"line",
".",
"split",
"(",
")",
"irq_line",
"=",
"splitted_line",
"[",
"0",
"]",
".",
"replace",
"(",
"':'",
",",
"''",
")",
"if",
"irq_line",
".",
"isdigit",
"(",
")",
... | Return the IRQ name, alias or number (choose the best for human).
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts | [
"Return",
"the",
"IRQ",
"name",
"alias",
"or",
"number",
"(",
"choose",
"the",
"best",
"for",
"human",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_irq.py#L151-L163 | train | Return the human - readable name of the IRQ line. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_irq.py | GlancesIRQ.__sum | def __sum(self, line):
"""Return the IRQ sum number.
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts
FIQ: usb_fiq
"""
splitted_line = line.sp... | python | def __sum(self, line):
"""Return the IRQ sum number.
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts
FIQ: usb_fiq
"""
splitted_line = line.sp... | [
"def",
"__sum",
"(",
"self",
",",
"line",
")",
":",
"splitted_line",
"=",
"line",
".",
"split",
"(",
")",
"try",
":",
"ret",
"=",
"sum",
"(",
"map",
"(",
"int",
",",
"splitted_line",
"[",
"1",
":",
"(",
"self",
".",
"cpu_number",
"+",
"1",
")",
... | Return the IRQ sum number.
IRQ line samples:
1: 44487 341 44 72 IO-APIC 1-edge i8042
LOC: 33549868 22394684 32474570 21855077 Local timer interrupts
FIQ: usb_fiq | [
"Return",
"the",
"IRQ",
"sum",
"number",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_irq.py#L165-L179 | train | Return the IRQ sum number. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_irq.py | GlancesIRQ.__update | def __update(self):
"""Load the IRQ file and update the internal dict."""
self.reset()
if not os.path.exists(self.IRQ_FILE):
# Correct issue #947: IRQ file do not exist on OpenVZ container
return self.stats
try:
with open(self.IRQ_FILE) as irq_proc:
... | python | def __update(self):
"""Load the IRQ file and update the internal dict."""
self.reset()
if not os.path.exists(self.IRQ_FILE):
# Correct issue #947: IRQ file do not exist on OpenVZ container
return self.stats
try:
with open(self.IRQ_FILE) as irq_proc:
... | [
"def",
"__update",
"(",
"self",
")",
":",
"self",
".",
"reset",
"(",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"IRQ_FILE",
")",
":",
"# Correct issue #947: IRQ file do not exist on OpenVZ container",
"return",
"self",
".",
"stats",
... | Load the IRQ file and update the internal dict. | [
"Load",
"the",
"IRQ",
"file",
"and",
"update",
"the",
"internal",
"dict",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_irq.py#L181-L213 | train | Load the IRQ file and update the internal dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_mqtt.py | Export.init | def init(self):
"""Init the connection to the MQTT server."""
if not self.export_enable:
return None
try:
client = paho.Client(client_id='glances_' + self.hostname,
clean_session=False)
client.username_pw_set(username=self.user... | python | def init(self):
"""Init the connection to the MQTT server."""
if not self.export_enable:
return None
try:
client = paho.Client(client_id='glances_' + self.hostname,
clean_session=False)
client.username_pw_set(username=self.user... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"None",
"try",
":",
"client",
"=",
"paho",
".",
"Client",
"(",
"client_id",
"=",
"'glances_'",
"+",
"self",
".",
"hostname",
",",
"clean_session",
"=",
"Fal... | Init the connection to the MQTT server. | [
"Init",
"the",
"connection",
"to",
"the",
"MQTT",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_mqtt.py#L65-L82 | train | Init the connection to the MQTT server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_mqtt.py | Export.export | def export(self, name, columns, points):
"""Write the points in MQTT."""
WHITELIST = '_-' + string.ascii_letters + string.digits
SUBSTITUTE = '_'
def whitelisted(s,
whitelist=WHITELIST,
substitute=SUBSTITUTE):
return ''.join(c... | python | def export(self, name, columns, points):
"""Write the points in MQTT."""
WHITELIST = '_-' + string.ascii_letters + string.digits
SUBSTITUTE = '_'
def whitelisted(s,
whitelist=WHITELIST,
substitute=SUBSTITUTE):
return ''.join(c... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"WHITELIST",
"=",
"'_-'",
"+",
"string",
".",
"ascii_letters",
"+",
"string",
".",
"digits",
"SUBSTITUTE",
"=",
"'_'",
"def",
"whitelisted",
"(",
"s",
",",
"whitelist",
... | Write the points in MQTT. | [
"Write",
"the",
"points",
"in",
"MQTT",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_mqtt.py#L84-L104 | train | Write the points in MQTT. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_batpercent.py | Plugin.update | def update(self):
"""Update battery capacity stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats
self.glancesgrabbat.update()
stats = self.glancesgrabbat.get()
elif s... | python | def update(self):
"""Update battery capacity stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats
self.glancesgrabbat.update()
stats = self.glancesgrabbat.get()
elif s... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats",
"self",
".",
"glancesgrabbat",
".",
"update",
"(",
")",
"stats",
"... | Update battery capacity stats using the input method. | [
"Update",
"battery",
"capacity",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_batpercent.py#L66-L84 | train | Update battery capacity stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_batpercent.py | GlancesGrabBat.update | def update(self):
"""Update the stats."""
if batinfo_tag:
# Use the batinfo lib to grab the stats
# Compatible with multiple batteries
self.bat.update()
self.bat_list = [{
'label': 'Battery',
'value': self.battery_percent,
... | python | def update(self):
"""Update the stats."""
if batinfo_tag:
# Use the batinfo lib to grab the stats
# Compatible with multiple batteries
self.bat.update()
self.bat_list = [{
'label': 'Battery',
'value': self.battery_percent,
... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"batinfo_tag",
":",
"# Use the batinfo lib to grab the stats",
"# Compatible with multiple batteries",
"self",
".",
"bat",
".",
"update",
"(",
")",
"self",
".",
"bat_list",
"=",
"[",
"{",
"'label'",
":",
"'Battery'",
... | Update the stats. | [
"Update",
"the",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_batpercent.py#L101-L120 | train | Update the stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_batpercent.py | GlancesGrabBat.battery_percent | def battery_percent(self):
"""Get batteries capacity percent."""
if not batinfo_tag or not self.bat.stat:
return []
# Init the bsum (sum of percent)
# and Loop over batteries (yes a computer could have more than 1 battery)
bsum = 0
for b in self.bat.stat:
... | python | def battery_percent(self):
"""Get batteries capacity percent."""
if not batinfo_tag or not self.bat.stat:
return []
# Init the bsum (sum of percent)
# and Loop over batteries (yes a computer could have more than 1 battery)
bsum = 0
for b in self.bat.stat:
... | [
"def",
"battery_percent",
"(",
"self",
")",
":",
"if",
"not",
"batinfo_tag",
"or",
"not",
"self",
".",
"bat",
".",
"stat",
":",
"return",
"[",
"]",
"# Init the bsum (sum of percent)",
"# and Loop over batteries (yes a computer could have more than 1 battery)",
"bsum",
"... | Get batteries capacity percent. | [
"Get",
"batteries",
"capacity",
"percent",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_batpercent.py#L127-L142 | train | Get batteries capacity percent. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.load | def load(self):
"""Load server and password list from the confiuration file."""
# Init the static server list (if defined)
self.static_server = GlancesStaticServer(config=self.config)
# Init the password list (if defined)
self.password = GlancesPassword(config=self.config) | python | def load(self):
"""Load server and password list from the confiuration file."""
# Init the static server list (if defined)
self.static_server = GlancesStaticServer(config=self.config)
# Init the password list (if defined)
self.password = GlancesPassword(config=self.config) | [
"def",
"load",
"(",
"self",
")",
":",
"# Init the static server list (if defined)",
"self",
".",
"static_server",
"=",
"GlancesStaticServer",
"(",
"config",
"=",
"self",
".",
"config",
")",
"# Init the password list (if defined)",
"self",
".",
"password",
"=",
"Glance... | Load server and password list from the confiuration file. | [
"Load",
"server",
"and",
"password",
"list",
"from",
"the",
"confiuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L58-L64 | train | Load server and password list from the confiuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.get_servers_list | def get_servers_list(self):
"""Return the current server list (list of dict).
Merge of static + autodiscover servers list.
"""
ret = []
if self.args.browser:
ret = self.static_server.get_servers_list()
if self.autodiscover_server is not None:
... | python | def get_servers_list(self):
"""Return the current server list (list of dict).
Merge of static + autodiscover servers list.
"""
ret = []
if self.args.browser:
ret = self.static_server.get_servers_list()
if self.autodiscover_server is not None:
... | [
"def",
"get_servers_list",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"if",
"self",
".",
"args",
".",
"browser",
":",
"ret",
"=",
"self",
".",
"static_server",
".",
"get_servers_list",
"(",
")",
"if",
"self",
".",
"autodiscover_server",
"is",
"not",
... | Return the current server list (list of dict).
Merge of static + autodiscover servers list. | [
"Return",
"the",
"current",
"server",
"list",
"(",
"list",
"of",
"dict",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L66-L78 | train | Return the current server list ( list of dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.__get_uri | def __get_uri(self, server):
"""Return the URI for the given server dict."""
# Select the connection mode (with or without password)
if server['password'] != "":
if server['status'] == 'PROTECTED':
# Try with the preconfigure password (only if status is PROTECTED)
... | python | def __get_uri(self, server):
"""Return the URI for the given server dict."""
# Select the connection mode (with or without password)
if server['password'] != "":
if server['status'] == 'PROTECTED':
# Try with the preconfigure password (only if status is PROTECTED)
... | [
"def",
"__get_uri",
"(",
"self",
",",
"server",
")",
":",
"# Select the connection mode (with or without password)",
"if",
"server",
"[",
"'password'",
"]",
"!=",
"\"\"",
":",
"if",
"server",
"[",
"'status'",
"]",
"==",
"'PROTECTED'",
":",
"# Try with the preconfigu... | Return the URI for the given server dict. | [
"Return",
"the",
"URI",
"for",
"the",
"given",
"server",
"dict",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L80-L92 | train | Return the URI for the given server dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.__update_stats | def __update_stats(self, server):
"""
Update stats for the given server (picked from the server list)
"""
# Get the server URI
uri = self.__get_uri(server)
# Try to connect to the server
t = GlancesClientTransport()
t.set_timeout(3)
# Get common ... | python | def __update_stats(self, server):
"""
Update stats for the given server (picked from the server list)
"""
# Get the server URI
uri = self.__get_uri(server)
# Try to connect to the server
t = GlancesClientTransport()
t.set_timeout(3)
# Get common ... | [
"def",
"__update_stats",
"(",
"self",
",",
"server",
")",
":",
"# Get the server URI",
"uri",
"=",
"self",
".",
"__get_uri",
"(",
"server",
")",
"# Try to connect to the server",
"t",
"=",
"GlancesClientTransport",
"(",
")",
"t",
".",
"set_timeout",
"(",
"3",
... | Update stats for the given server (picked from the server list) | [
"Update",
"stats",
"for",
"the",
"given",
"server",
"(",
"picked",
"from",
"the",
"server",
"list",
")"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L94-L147 | train | Update stats for the given server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.__display_server | def __display_server(self, server):
"""
Connect and display the given server
"""
# Display the Glances client for the selected server
logger.debug("Selected server {}".format(server))
# Connection can take time
# Display a popup
self.screen.display_popup(... | python | def __display_server(self, server):
"""
Connect and display the given server
"""
# Display the Glances client for the selected server
logger.debug("Selected server {}".format(server))
# Connection can take time
# Display a popup
self.screen.display_popup(... | [
"def",
"__display_server",
"(",
"self",
",",
"server",
")",
":",
"# Display the Glances client for the selected server",
"logger",
".",
"debug",
"(",
"\"Selected server {}\"",
".",
"format",
"(",
"server",
")",
")",
"# Connection can take time",
"# Display a popup",
"self... | Connect and display the given server | [
"Connect",
"and",
"display",
"the",
"given",
"server"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L149-L214 | train | Connect and display the given server and display the Glances client | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.__serve_forever | def __serve_forever(self):
"""Main client loop."""
# No need to update the server list
# It's done by the GlancesAutoDiscoverListener class (autodiscover.py)
# Or define staticaly in the configuration file (module static_list.py)
# For each server in the list, grab elementary sta... | python | def __serve_forever(self):
"""Main client loop."""
# No need to update the server list
# It's done by the GlancesAutoDiscoverListener class (autodiscover.py)
# Or define staticaly in the configuration file (module static_list.py)
# For each server in the list, grab elementary sta... | [
"def",
"__serve_forever",
"(",
"self",
")",
":",
"# No need to update the server list",
"# It's done by the GlancesAutoDiscoverListener class (autodiscover.py)",
"# Or define staticaly in the configuration file (module static_list.py)",
"# For each server in the list, grab elementary stats (CPU, L... | Main client loop. | [
"Main",
"client",
"loop",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L216-L243 | train | Main loop for Glances server list update the screen list and display the active server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client_browser.py | GlancesClientBrowser.set_in_selected | def set_in_selected(self, key, value):
"""Set the (key, value) for the selected server in the list."""
# Static list then dynamic one
if self.screen.active_server >= len(self.static_server.get_servers_list()):
self.autodiscover_server.set_server(
self.screen.active_se... | python | def set_in_selected(self, key, value):
"""Set the (key, value) for the selected server in the list."""
# Static list then dynamic one
if self.screen.active_server >= len(self.static_server.get_servers_list()):
self.autodiscover_server.set_server(
self.screen.active_se... | [
"def",
"set_in_selected",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"# Static list then dynamic one",
"if",
"self",
".",
"screen",
".",
"active_server",
">=",
"len",
"(",
"self",
".",
"static_server",
".",
"get_servers_list",
"(",
")",
")",
":",
"self... | Set the (key, value) for the selected server in the list. | [
"Set",
"the",
"(",
"key",
"value",
")",
"for",
"the",
"selected",
"server",
"in",
"the",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client_browser.py#L256-L264 | train | Set the ( key value ) for the selected server in the list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_graph.py | Export.update | def update(self, stats):
"""Generate Graph file in the output folder."""
if self.generate_every != 0 and self._timer.finished():
self.args.generate_graph = True
self._timer.reset()
if not self.args.generate_graph:
return
plugins = stats.getPluginsLi... | python | def update(self, stats):
"""Generate Graph file in the output folder."""
if self.generate_every != 0 and self._timer.finished():
self.args.generate_graph = True
self._timer.reset()
if not self.args.generate_graph:
return
plugins = stats.getPluginsLi... | [
"def",
"update",
"(",
"self",
",",
"stats",
")",
":",
"if",
"self",
".",
"generate_every",
"!=",
"0",
"and",
"self",
".",
"_timer",
".",
"finished",
"(",
")",
":",
"self",
".",
"args",
".",
"generate_graph",
"=",
"True",
"self",
".",
"_timer",
".",
... | Generate Graph file in the output folder. | [
"Generate",
"Graph",
"file",
"in",
"the",
"output",
"folder",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_graph.py#L88-L105 | train | Generate Graph file in the output folder. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_graph.py | Export.export | def export(self, title, data):
"""Generate graph from the data.
Example for the mem plugin:
{'percent': [
(datetime.datetime(2018, 3, 24, 16, 27, 47, 282070), 51.8),
(datetime.datetime(2018, 3, 24, 16, 27, 47, 540999), 51.9),
(datetime.datetime(2018, 3, 24, 1... | python | def export(self, title, data):
"""Generate graph from the data.
Example for the mem plugin:
{'percent': [
(datetime.datetime(2018, 3, 24, 16, 27, 47, 282070), 51.8),
(datetime.datetime(2018, 3, 24, 16, 27, 47, 540999), 51.9),
(datetime.datetime(2018, 3, 24, 1... | [
"def",
"export",
"(",
"self",
",",
"title",
",",
"data",
")",
":",
"if",
"data",
"==",
"{",
"}",
":",
"return",
"False",
"chart",
"=",
"DateTimeLine",
"(",
"title",
"=",
"title",
".",
"capitalize",
"(",
")",
",",
"width",
"=",
"self",
".",
"width",... | Generate graph from the data.
Example for the mem plugin:
{'percent': [
(datetime.datetime(2018, 3, 24, 16, 27, 47, 282070), 51.8),
(datetime.datetime(2018, 3, 24, 16, 27, 47, 540999), 51.9),
(datetime.datetime(2018, 3, 24, 16, 27, 50, 653390), 52.0),
(da... | [
"Generate",
"graph",
"from",
"the",
"data",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_graph.py#L107-L140 | train | Generate a graph from the data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/main.py | GlancesMain.init_args | def init_args(self):
"""Init all the command line arguments."""
version = "Glances v" + __version__ + " with psutil v" + psutil_version
parser = argparse.ArgumentParser(
prog='glances',
conflict_handler='resolve',
formatter_class=argparse.RawDescriptionHelpFor... | python | def init_args(self):
"""Init all the command line arguments."""
version = "Glances v" + __version__ + " with psutil v" + psutil_version
parser = argparse.ArgumentParser(
prog='glances',
conflict_handler='resolve',
formatter_class=argparse.RawDescriptionHelpFor... | [
"def",
"init_args",
"(",
"self",
")",
":",
"version",
"=",
"\"Glances v\"",
"+",
"__version__",
"+",
"\" with psutil v\"",
"+",
"psutil_version",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"'glances'",
",",
"conflict_handler",
"=",
"'res... | Init all the command line arguments. | [
"Init",
"all",
"the",
"command",
"line",
"arguments",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/main.py#L110-L250 | train | Initialize all the command line arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/main.py | GlancesMain.parse_args | def parse_args(self):
"""Parse command line arguments."""
args = self.init_args().parse_args()
# Load the configuration file, if it exists
self.config = Config(args.conf_file)
# Debug mode
if args.debug:
from logging import DEBUG
logger.setLevel(... | python | def parse_args(self):
"""Parse command line arguments."""
args = self.init_args().parse_args()
# Load the configuration file, if it exists
self.config = Config(args.conf_file)
# Debug mode
if args.debug:
from logging import DEBUG
logger.setLevel(... | [
"def",
"parse_args",
"(",
"self",
")",
":",
"args",
"=",
"self",
".",
"init_args",
"(",
")",
".",
"parse_args",
"(",
")",
"# Load the configuration file, if it exists",
"self",
".",
"config",
"=",
"Config",
"(",
"args",
".",
"conf_file",
")",
"# Debug mode",
... | Parse command line arguments. | [
"Parse",
"command",
"line",
"arguments",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/main.py#L252-L417 | train | Parse command line arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/main.py | GlancesMain.is_standalone | def is_standalone(self):
"""Return True if Glances is running in standalone mode."""
return (not self.args.client and
not self.args.browser and
not self.args.server and
not self.args.webserver) | python | def is_standalone(self):
"""Return True if Glances is running in standalone mode."""
return (not self.args.client and
not self.args.browser and
not self.args.server and
not self.args.webserver) | [
"def",
"is_standalone",
"(",
"self",
")",
":",
"return",
"(",
"not",
"self",
".",
"args",
".",
"client",
"and",
"not",
"self",
".",
"args",
".",
"browser",
"and",
"not",
"self",
".",
"args",
".",
"server",
"and",
"not",
"self",
".",
"args",
".",
"w... | Return True if Glances is running in standalone mode. | [
"Return",
"True",
"if",
"Glances",
"is",
"running",
"in",
"standalone",
"mode",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/main.py#L419-L424 | train | Return True if Glances is running in standalone mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/main.py | GlancesMain.is_client | def is_client(self):
"""Return True if Glances is running in client mode."""
return (self.args.client or self.args.browser) and not self.args.server | python | def is_client(self):
"""Return True if Glances is running in client mode."""
return (self.args.client or self.args.browser) and not self.args.server | [
"def",
"is_client",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"args",
".",
"client",
"or",
"self",
".",
"args",
".",
"browser",
")",
"and",
"not",
"self",
".",
"args",
".",
"server"
] | Return True if Glances is running in client mode. | [
"Return",
"True",
"if",
"Glances",
"is",
"running",
"in",
"client",
"mode",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/main.py#L426-L428 | train | Return True if Glances is running in client mode. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/main.py | GlancesMain.__get_password | def __get_password(self, description='',
confirm=False, clear=False, username='glances'):
"""Read a password from the command line.
- if confirm = True, with confirmation
- if clear = True, plain (clear password)
"""
from glances.password import GlancesPas... | python | def __get_password(self, description='',
confirm=False, clear=False, username='glances'):
"""Read a password from the command line.
- if confirm = True, with confirmation
- if clear = True, plain (clear password)
"""
from glances.password import GlancesPas... | [
"def",
"__get_password",
"(",
"self",
",",
"description",
"=",
"''",
",",
"confirm",
"=",
"False",
",",
"clear",
"=",
"False",
",",
"username",
"=",
"'glances'",
")",
":",
"from",
"glances",
".",
"password",
"import",
"GlancesPassword",
"password",
"=",
"G... | Read a password from the command line.
- if confirm = True, with confirmation
- if clear = True, plain (clear password) | [
"Read",
"a",
"password",
"from",
"the",
"command",
"line",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/main.py#L458-L467 | train | Read a password from the command line. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_stdout.py | GlancesStdout.build_list | def build_list(self):
"""Return a list of tuples taken from self.args.stdout
[(plugin, attribute), ... ]"""
ret = []
for p in self.args.stdout.split(','):
if '.' in p:
p, a = p.split('.')
else:
a = None
ret.append((p, a)... | python | def build_list(self):
"""Return a list of tuples taken from self.args.stdout
[(plugin, attribute), ... ]"""
ret = []
for p in self.args.stdout.split(','):
if '.' in p:
p, a = p.split('.')
else:
a = None
ret.append((p, a)... | [
"def",
"build_list",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"args",
".",
"stdout",
".",
"split",
"(",
"','",
")",
":",
"if",
"'.'",
"in",
"p",
":",
"p",
",",
"a",
"=",
"p",
".",
"split",
"(",
"'.'",
")",... | Return a list of tuples taken from self.args.stdout
[(plugin, attribute), ... ] | [
"Return",
"a",
"list",
"of",
"tuples",
"taken",
"from",
"self",
".",
"args",
".",
"stdout",
"[",
"(",
"plugin",
"attribute",
")",
"...",
"]"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_stdout.py#L42-L52 | train | Return a list of tuples taken from self. args. stdout
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_stdout.py | GlancesStdout.update | def update(self,
stats,
duration=3):
"""Display stats to stdout.
Refresh every duration second.
"""
for plugin, attribute in self.plugins_list:
# Check if the plugin exist and is enable
if plugin in stats.getPluginsList() and \
... | python | def update(self,
stats,
duration=3):
"""Display stats to stdout.
Refresh every duration second.
"""
for plugin, attribute in self.plugins_list:
# Check if the plugin exist and is enable
if plugin in stats.getPluginsList() and \
... | [
"def",
"update",
"(",
"self",
",",
"stats",
",",
"duration",
"=",
"3",
")",
":",
"for",
"plugin",
",",
"attribute",
"in",
"self",
".",
"plugins_list",
":",
"# Check if the plugin exist and is enable",
"if",
"plugin",
"in",
"stats",
".",
"getPluginsList",
"(",
... | Display stats to stdout.
Refresh every duration second. | [
"Display",
"stats",
"to",
"stdout",
".",
"Refresh",
"every",
"duration",
"second",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_stdout.py#L57-L84 | train | Display stats to stdout. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_load.py | Plugin.update | def update(self):
"""Update load stats."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Get the load using the os standard lib
load = self._getloadavg()
if ... | python | def update(self):
"""Update load stats."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Get the load using the os standard lib
load = self._getloadavg()
if ... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats using the standard system lib",
"# Get the load using the os standard lib",
"load"... | Update load stats. | [
"Update",
"load",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_load.py#L80-L116 | train | Update load stats using the standard system and SNMP modules. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_load.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
try:
# Alert and log
self.views['min15']['decoration'] = self.get_alert_log(self.stats['min15'], maximum=100 * sel... | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
try:
# Alert and log
self.views['min15']['decoration'] = self.get_alert_log(self.stats['min15'], maximum=100 * sel... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"try",
":",
"# Alert and log",
"self",
".",
"views",
"[",
"'min15'",
"]",
"[",
... | Update stats views. | [
"Update",
"stats",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_load.py#L118-L131 | train | Update stats views. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_load.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist, not empty (issue #871) and plugin not disabled
if not self.stats or (self.stats == {}) or self.is_disable():... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist, not empty (issue #871) and plugin not disabled
if not self.stats or (self.stats == {}) or self.is_disable():... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist, not empty (issue #871) and plugin not disabled",
"if",
"not",
"self",
".",
"stats",
... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_load.py#L133-L174 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_psutilversion.py | Plugin.update | def update(self):
"""Update the stats."""
# Reset stats
self.reset()
# Return psutil version as a tuple
if self.input_method == 'local':
# psutil version only available in local
try:
self.stats = psutil_version_info
except Name... | python | def update(self):
"""Update the stats."""
# Reset stats
self.reset()
# Return psutil version as a tuple
if self.input_method == 'local':
# psutil version only available in local
try:
self.stats = psutil_version_info
except Name... | [
"def",
"update",
"(",
"self",
")",
":",
"# Reset stats",
"self",
".",
"reset",
"(",
")",
"# Return psutil version as a tuple",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# psutil version only available in local",
"try",
":",
"self",
".",
"stats",
"=... | Update the stats. | [
"Update",
"the",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_psutilversion.py#L44-L59 | train | Update the stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated.load_config | def load_config(self, config):
"""Load outdated parameter in the global section of the configuration file."""
global_section = 'global'
if (hasattr(config, 'has_section') and
config.has_section(global_section)):
self.args.disable_check_update = config.get_value(globa... | python | def load_config(self, config):
"""Load outdated parameter in the global section of the configuration file."""
global_section = 'global'
if (hasattr(config, 'has_section') and
config.has_section(global_section)):
self.args.disable_check_update = config.get_value(globa... | [
"def",
"load_config",
"(",
"self",
",",
"config",
")",
":",
"global_section",
"=",
"'global'",
"if",
"(",
"hasattr",
"(",
"config",
",",
"'has_section'",
")",
"and",
"config",
".",
"has_section",
"(",
"global_section",
")",
")",
":",
"self",
".",
"args",
... | Load outdated parameter in the global section of the configuration file. | [
"Load",
"outdated",
"parameter",
"in",
"the",
"global",
"section",
"of",
"the",
"configuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L66-L77 | train | Load outdated parameter in the global section of the configuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated.get_pypi_version | def get_pypi_version(self):
"""Wrapper to get the latest PyPI version (async)
The data are stored in a cached file
Only update online once a week
"""
if self.args.disable_check_update:
return
# If the cached file exist, read-it
cached_data = self._loa... | python | def get_pypi_version(self):
"""Wrapper to get the latest PyPI version (async)
The data are stored in a cached file
Only update online once a week
"""
if self.args.disable_check_update:
return
# If the cached file exist, read-it
cached_data = self._loa... | [
"def",
"get_pypi_version",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"disable_check_update",
":",
"return",
"# If the cached file exist, read-it",
"cached_data",
"=",
"self",
".",
"_load_cache",
"(",
")",
"if",
"cached_data",
"==",
"{",
"}",
":",
... | Wrapper to get the latest PyPI version (async)
The data are stored in a cached file
Only update online once a week | [
"Wrapper",
"to",
"get",
"the",
"latest",
"PyPI",
"version",
"(",
"async",
")",
"The",
"data",
"are",
"stored",
"in",
"a",
"cached",
"file",
"Only",
"update",
"online",
"once",
"a",
"week"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L88-L107 | train | Wrapper to get the latest PyPI version | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated.is_outdated | def is_outdated(self):
"""Return True if a new version is available"""
if self.args.disable_check_update:
# Check is disabled by configuration
return False
logger.debug("Check Glances version (installed: {} / latest: {})".format(self.installed_version(), self.latest_vers... | python | def is_outdated(self):
"""Return True if a new version is available"""
if self.args.disable_check_update:
# Check is disabled by configuration
return False
logger.debug("Check Glances version (installed: {} / latest: {})".format(self.installed_version(), self.latest_vers... | [
"def",
"is_outdated",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"disable_check_update",
":",
"# Check is disabled by configuration",
"return",
"False",
"logger",
".",
"debug",
"(",
"\"Check Glances version (installed: {} / latest: {})\"",
".",
"format",
"("... | Return True if a new version is available | [
"Return",
"True",
"if",
"a",
"new",
"version",
"is",
"available"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L109-L116 | train | Return True if a new version is available | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated._load_cache | def _load_cache(self):
"""Load cache file and return cached data"""
# If the cached file exist, read-it
max_refresh_date = timedelta(days=7)
cached_data = {}
try:
with open(self.cache_file, 'rb') as f:
cached_data = pickle.load(f)
except Except... | python | def _load_cache(self):
"""Load cache file and return cached data"""
# If the cached file exist, read-it
max_refresh_date = timedelta(days=7)
cached_data = {}
try:
with open(self.cache_file, 'rb') as f:
cached_data = pickle.load(f)
except Except... | [
"def",
"_load_cache",
"(",
"self",
")",
":",
"# If the cached file exist, read-it",
"max_refresh_date",
"=",
"timedelta",
"(",
"days",
"=",
"7",
")",
"cached_data",
"=",
"{",
"}",
"try",
":",
"with",
"open",
"(",
"self",
".",
"cache_file",
",",
"'rb'",
")",
... | Load cache file and return cached data | [
"Load",
"cache",
"file",
"and",
"return",
"cached",
"data"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L118-L136 | train | Load the cache file and return cached data | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated._save_cache | def _save_cache(self):
"""Save data to the cache file."""
# Create the cache directory
safe_makedirs(self.cache_dir)
# Create/overwrite the cache file
try:
with open(self.cache_file, 'wb') as f:
pickle.dump(self.data, f)
except Exception as e:... | python | def _save_cache(self):
"""Save data to the cache file."""
# Create the cache directory
safe_makedirs(self.cache_dir)
# Create/overwrite the cache file
try:
with open(self.cache_file, 'wb') as f:
pickle.dump(self.data, f)
except Exception as e:... | [
"def",
"_save_cache",
"(",
"self",
")",
":",
"# Create the cache directory",
"safe_makedirs",
"(",
"self",
".",
"cache_dir",
")",
"# Create/overwrite the cache file",
"try",
":",
"with",
"open",
"(",
"self",
".",
"cache_file",
",",
"'wb'",
")",
"as",
"f",
":",
... | Save data to the cache file. | [
"Save",
"data",
"to",
"the",
"cache",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L138-L148 | train | Save the data to the cache file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outdated.py | Outdated._update_pypi_version | def _update_pypi_version(self):
"""Get the latest PyPI version (as a string) via the RESTful JSON API"""
logger.debug("Get latest Glances version from the PyPI RESTful API ({})".format(PYPI_API_URL))
# Update the current time
self.data[u'refresh_date'] = datetime.now()
try:
... | python | def _update_pypi_version(self):
"""Get the latest PyPI version (as a string) via the RESTful JSON API"""
logger.debug("Get latest Glances version from the PyPI RESTful API ({})".format(PYPI_API_URL))
# Update the current time
self.data[u'refresh_date'] = datetime.now()
try:
... | [
"def",
"_update_pypi_version",
"(",
"self",
")",
":",
"logger",
".",
"debug",
"(",
"\"Get latest Glances version from the PyPI RESTful API ({})\"",
".",
"format",
"(",
"PYPI_API_URL",
")",
")",
"# Update the current time",
"self",
".",
"data",
"[",
"u'refresh_date'",
"]... | Get the latest PyPI version (as a string) via the RESTful JSON API | [
"Get",
"the",
"latest",
"PyPI",
"version",
"(",
"as",
"a",
"string",
")",
"via",
"the",
"RESTful",
"JSON",
"API"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outdated.py#L150-L169 | train | Get the latest Glances version via the RESTful API and update the cache file with the result | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.cursor_up | def cursor_up(self, stats):
"""Set the cursor to position N-1 in the list."""
if 0 <= self.cursor_position - 1:
self.cursor_position -= 1
else:
if self._current_page - 1 < 0 :
self._current_page = self._page_max - 1
self.cursor_position = (... | python | def cursor_up(self, stats):
"""Set the cursor to position N-1 in the list."""
if 0 <= self.cursor_position - 1:
self.cursor_position -= 1
else:
if self._current_page - 1 < 0 :
self._current_page = self._page_max - 1
self.cursor_position = (... | [
"def",
"cursor_up",
"(",
"self",
",",
"stats",
")",
":",
"if",
"0",
"<=",
"self",
".",
"cursor_position",
"-",
"1",
":",
"self",
".",
"cursor_position",
"-=",
"1",
"else",
":",
"if",
"self",
".",
"_current_page",
"-",
"1",
"<",
"0",
":",
"self",
".... | Set the cursor to position N-1 in the list. | [
"Set",
"the",
"cursor",
"to",
"position",
"N",
"-",
"1",
"in",
"the",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L122-L132 | train | Set the cursor to position N - 1 in the list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.cursor_down | def cursor_down(self, stats):
"""Set the cursor to position N-1 in the list."""
if self.cursor_position + 1 < self.get_pagelines(stats):
self.cursor_position += 1
else:
if self._current_page + 1 < self._page_max:
self._current_page += 1
... | python | def cursor_down(self, stats):
"""Set the cursor to position N-1 in the list."""
if self.cursor_position + 1 < self.get_pagelines(stats):
self.cursor_position += 1
else:
if self._current_page + 1 < self._page_max:
self._current_page += 1
... | [
"def",
"cursor_down",
"(",
"self",
",",
"stats",
")",
":",
"if",
"self",
".",
"cursor_position",
"+",
"1",
"<",
"self",
".",
"get_pagelines",
"(",
"stats",
")",
":",
"self",
".",
"cursor_position",
"+=",
"1",
"else",
":",
"if",
"self",
".",
"_current_p... | Set the cursor to position N-1 in the list. | [
"Set",
"the",
"cursor",
"to",
"position",
"N",
"-",
"1",
"in",
"the",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L134-L144 | train | Move the cursor down by 1. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.cursor_pageup | def cursor_pageup(self, stats):
"""Set prev page."""
if self._current_page - 1 < 0:
self._current_page = self._page_max - 1
else:
self._current_page -= 1
self.cursor_position = 0 | python | def cursor_pageup(self, stats):
"""Set prev page."""
if self._current_page - 1 < 0:
self._current_page = self._page_max - 1
else:
self._current_page -= 1
self.cursor_position = 0 | [
"def",
"cursor_pageup",
"(",
"self",
",",
"stats",
")",
":",
"if",
"self",
".",
"_current_page",
"-",
"1",
"<",
"0",
":",
"self",
".",
"_current_page",
"=",
"self",
".",
"_page_max",
"-",
"1",
"else",
":",
"self",
".",
"_current_page",
"-=",
"1",
"se... | Set prev page. | [
"Set",
"prev",
"page",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L146-L152 | train | Set current page up. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.cursor_pagedown | def cursor_pagedown(self, stats):
"""Set next page."""
if self._current_page + 1 < self._page_max:
self._current_page += 1
else:
self._current_page = 0
self.cursor_position = 0 | python | def cursor_pagedown(self, stats):
"""Set next page."""
if self._current_page + 1 < self._page_max:
self._current_page += 1
else:
self._current_page = 0
self.cursor_position = 0 | [
"def",
"cursor_pagedown",
"(",
"self",
",",
"stats",
")",
":",
"if",
"self",
".",
"_current_page",
"+",
"1",
"<",
"self",
".",
"_page_max",
":",
"self",
".",
"_current_page",
"+=",
"1",
"else",
":",
"self",
".",
"_current_page",
"=",
"0",
"self",
".",
... | Set next page. | [
"Set",
"next",
"page",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L154-L160 | train | Set next page. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.update | def update(self,
stats,
duration=3,
cs_status=None,
return_to_browser=False):
"""Update the servers' list screen.
Wait for __refresh_time sec / catch key every 100 ms.
stats: Dict of dict with servers stats
"""
# Flush... | python | def update(self,
stats,
duration=3,
cs_status=None,
return_to_browser=False):
"""Update the servers' list screen.
Wait for __refresh_time sec / catch key every 100 ms.
stats: Dict of dict with servers stats
"""
# Flush... | [
"def",
"update",
"(",
"self",
",",
"stats",
",",
"duration",
"=",
"3",
",",
"cs_status",
"=",
"None",
",",
"return_to_browser",
"=",
"False",
")",
":",
"# Flush display",
"logger",
".",
"debug",
"(",
"'Servers list: {}'",
".",
"format",
"(",
"stats",
")",
... | Update the servers' list screen.
Wait for __refresh_time sec / catch key every 100 ms.
stats: Dict of dict with servers stats | [
"Update",
"the",
"servers",
"list",
"screen",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L216-L246 | train | Update the servers list screen. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_curses_browser.py | GlancesCursesBrowser.display | def display(self, stats, cs_status=None):
"""Display the servers list.
Return:
True if the stats have been displayed
False if the stats have not been displayed (no server available)
"""
# Init the internal line/column for Glances Curses
self.init_line_col... | python | def display(self, stats, cs_status=None):
"""Display the servers list.
Return:
True if the stats have been displayed
False if the stats have not been displayed (no server available)
"""
# Init the internal line/column for Glances Curses
self.init_line_col... | [
"def",
"display",
"(",
"self",
",",
"stats",
",",
"cs_status",
"=",
"None",
")",
":",
"# Init the internal line/column for Glances Curses",
"self",
".",
"init_line_column",
"(",
")",
"# Get the current screen size",
"screen_x",
"=",
"self",
".",
"screen",
".",
"getm... | Display the servers list.
Return:
True if the stats have been displayed
False if the stats have not been displayed (no server available) | [
"Display",
"the",
"servers",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_curses_browser.py#L256-L399 | train | Display the servers list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_smart.py | is_admin | def is_admin():
"""
https://stackoverflow.com/a/19719292
@return: True if the current user is an 'Admin' whatever that
means (root on Unix), otherwise False.
Warning: The inner function fails unless you have Windows XP SP2 or
higher. The failure causes a traceback to be printed and this
func... | python | def is_admin():
"""
https://stackoverflow.com/a/19719292
@return: True if the current user is an 'Admin' whatever that
means (root on Unix), otherwise False.
Warning: The inner function fails unless you have Windows XP SP2 or
higher. The failure causes a traceback to be printed and this
func... | [
"def",
"is_admin",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"import",
"ctypes",
"import",
"traceback",
"# WARNING: requires Windows XP SP2 or higher!",
"try",
":",
"return",
"ctypes",
".",
"windll",
".",
"shell32",
".",
"IsUserAnAdmin",
"(",
... | https://stackoverflow.com/a/19719292
@return: True if the current user is an 'Admin' whatever that
means (root on Unix), otherwise False.
Warning: The inner function fails unless you have Windows XP SP2 or
higher. The failure causes a traceback to be printed and this
function to return False. | [
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"19719292"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_smart.py#L64-L85 | train | Checks if the current user is an Admin | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_smart.py | get_smart_data | def get_smart_data():
"""
Get SMART attribute data
:return: list of multi leveled dictionaries
each dict has a key "DeviceName" with the identification of the device in smartctl
also has keys of the SMART attribute id, with value of another dict of the attributes
[
... | python | def get_smart_data():
"""
Get SMART attribute data
:return: list of multi leveled dictionaries
each dict has a key "DeviceName" with the identification of the device in smartctl
also has keys of the SMART attribute id, with value of another dict of the attributes
[
... | [
"def",
"get_smart_data",
"(",
")",
":",
"stats",
"=",
"[",
"]",
"# get all devices",
"devlist",
"=",
"DeviceList",
"(",
")",
"for",
"dev",
"in",
"devlist",
".",
"devices",
":",
"stats",
".",
"append",
"(",
"{",
"DEVKEY",
":",
"str",
"(",
"dev",
")",
... | Get SMART attribute data
:return: list of multi leveled dictionaries
each dict has a key "DeviceName" with the identification of the device in smartctl
also has keys of the SMART attribute id, with value of another dict of the attributes
[
{
... | [
"Get",
"SMART",
"attribute",
"data",
":",
"return",
":",
"list",
"of",
"multi",
"leveled",
"dictionaries",
"each",
"dict",
"has",
"a",
"key",
"DeviceName",
"with",
"the",
"identification",
"of",
"the",
"device",
"in",
"smartctl",
"also",
"has",
"keys",
"of",... | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_smart.py#L102-L143 | train | Get multi leveled dictionary of SMART attribute data | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_smart.py | Plugin.update | def update(self):
"""Update SMART stats using the input method."""
# Init new stats
stats = self.get_init_value()
if import_error_tag:
return self.stats
if self.input_method == 'local':
stats = get_smart_data()
elif self.input_method == 'snmp':
... | python | def update(self):
"""Update SMART stats using the input method."""
# Init new stats
stats = self.get_init_value()
if import_error_tag:
return self.stats
if self.input_method == 'local':
stats = get_smart_data()
elif self.input_method == 'snmp':
... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"import_error_tag",
":",
"return",
"self",
".",
"stats",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"stats",
"=",
"get_sm... | Update SMART stats using the input method. | [
"Update",
"SMART",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_smart.py#L169-L185 | train | Update SMART stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_prometheus.py | Export.init | def init(self):
"""Init the Prometheus Exporter"""
try:
start_http_server(port=int(self.port), addr=self.host)
except Exception as e:
logger.critical("Can not start Prometheus exporter on {}:{} ({})".format(self.host, self.port, e))
sys.exit(2)
else:
... | python | def init(self):
"""Init the Prometheus Exporter"""
try:
start_http_server(port=int(self.port), addr=self.host)
except Exception as e:
logger.critical("Can not start Prometheus exporter on {}:{} ({})".format(self.host, self.port, e))
sys.exit(2)
else:
... | [
"def",
"init",
"(",
"self",
")",
":",
"try",
":",
"start_http_server",
"(",
"port",
"=",
"int",
"(",
"self",
".",
"port",
")",
",",
"addr",
"=",
"self",
".",
"host",
")",
"except",
"Exception",
"as",
"e",
":",
"logger",
".",
"critical",
"(",
"\"Can... | Init the Prometheus Exporter | [
"Init",
"the",
"Prometheus",
"Exporter"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_prometheus.py#L63-L71 | train | Init the Prometheus Exporter | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_prometheus.py | Export.export | def export(self, name, columns, points):
"""Write the points to the Prometheus exporter using Gauge."""
logger.debug("Export {} stats to Prometheus exporter".format(name))
# Remove non number stats and convert all to float (for Boolean)
data = {k: float(v) for (k, v) in iteritems(dict(z... | python | def export(self, name, columns, points):
"""Write the points to the Prometheus exporter using Gauge."""
logger.debug("Export {} stats to Prometheus exporter".format(name))
# Remove non number stats and convert all to float (for Boolean)
data = {k: float(v) for (k, v) in iteritems(dict(z... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"logger",
".",
"debug",
"(",
"\"Export {} stats to Prometheus exporter\"",
".",
"format",
"(",
"name",
")",
")",
"# Remove non number stats and convert all to float (for Boolean)",
"da... | Write the points to the Prometheus exporter using Gauge. | [
"Write",
"the",
"points",
"to",
"the",
"Prometheus",
"exporter",
"using",
"Gauge",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_prometheus.py#L73-L99 | train | Write the points to the Prometheus exporter using Gauge. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport._plugins_to_export | def _plugins_to_export(self):
"""Return the list of plugins to export."""
ret = self.exportable_plugins
for p in ret:
if getattr(self.args, 'disable_' + p):
ret.remove(p)
return ret | python | def _plugins_to_export(self):
"""Return the list of plugins to export."""
ret = self.exportable_plugins
for p in ret:
if getattr(self.args, 'disable_' + p):
ret.remove(p)
return ret | [
"def",
"_plugins_to_export",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"exportable_plugins",
"for",
"p",
"in",
"ret",
":",
"if",
"getattr",
"(",
"self",
".",
"args",
",",
"'disable_'",
"+",
"p",
")",
":",
"ret",
".",
"remove",
"(",
"p",
")",
... | Return the list of plugins to export. | [
"Return",
"the",
"list",
"of",
"plugins",
"to",
"export",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L79-L85 | train | Return the list of plugins to export. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport.load_conf | def load_conf(self, section, mandatories=['host', 'port'], options=None):
"""Load the export <section> configuration in the Glances configuration file.
:param section: name of the export section to load
:param mandatories: a list of mandatories parameters to load
:param options: a list ... | python | def load_conf(self, section, mandatories=['host', 'port'], options=None):
"""Load the export <section> configuration in the Glances configuration file.
:param section: name of the export section to load
:param mandatories: a list of mandatories parameters to load
:param options: a list ... | [
"def",
"load_conf",
"(",
"self",
",",
"section",
",",
"mandatories",
"=",
"[",
"'host'",
",",
"'port'",
"]",
",",
"options",
"=",
"None",
")",
":",
"options",
"=",
"options",
"or",
"[",
"]",
"if",
"self",
".",
"config",
"is",
"None",
":",
"return",
... | Load the export <section> configuration in the Glances configuration file.
:param section: name of the export section to load
:param mandatories: a list of mandatories parameters to load
:param options: a list of optionnals parameters to load
:returns: Boolean -- True if section is fou... | [
"Load",
"the",
"export",
"<section",
">",
"configuration",
"in",
"the",
"Glances",
"configuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L90-L125 | train | Load the export section configuration in the Glances configuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport.get_item_key | def get_item_key(self, item):
"""Return the value of the item 'key'."""
try:
ret = item[item['key']]
except KeyError:
logger.error("No 'key' available in {}".format(item))
if isinstance(ret, list):
return ret[0]
else:
return ret | python | def get_item_key(self, item):
"""Return the value of the item 'key'."""
try:
ret = item[item['key']]
except KeyError:
logger.error("No 'key' available in {}".format(item))
if isinstance(ret, list):
return ret[0]
else:
return ret | [
"def",
"get_item_key",
"(",
"self",
",",
"item",
")",
":",
"try",
":",
"ret",
"=",
"item",
"[",
"item",
"[",
"'key'",
"]",
"]",
"except",
"KeyError",
":",
"logger",
".",
"error",
"(",
"\"No 'key' available in {}\"",
".",
"format",
"(",
"item",
")",
")"... | Return the value of the item 'key'. | [
"Return",
"the",
"value",
"of",
"the",
"item",
"key",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L127-L136 | train | Return the value of the item key. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport.parse_tags | def parse_tags(self, tags):
"""Parse tags into a dict.
input tags: a comma separated list of 'key:value' pairs.
Example: foo:bar,spam:eggs
output dtags: a dict of tags.
Example: {'foo': 'bar', 'spam': 'eggs'}
"""
dtags = {}
if tags:
tr... | python | def parse_tags(self, tags):
"""Parse tags into a dict.
input tags: a comma separated list of 'key:value' pairs.
Example: foo:bar,spam:eggs
output dtags: a dict of tags.
Example: {'foo': 'bar', 'spam': 'eggs'}
"""
dtags = {}
if tags:
tr... | [
"def",
"parse_tags",
"(",
"self",
",",
"tags",
")",
":",
"dtags",
"=",
"{",
"}",
"if",
"tags",
":",
"try",
":",
"dtags",
"=",
"dict",
"(",
"[",
"x",
".",
"split",
"(",
"':'",
")",
"for",
"x",
"in",
"tags",
".",
"split",
"(",
"','",
")",
"]",
... | Parse tags into a dict.
input tags: a comma separated list of 'key:value' pairs.
Example: foo:bar,spam:eggs
output dtags: a dict of tags.
Example: {'foo': 'bar', 'spam': 'eggs'} | [
"Parse",
"tags",
"into",
"a",
"dict",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L138-L155 | train | Parse tags into a dict.
input tags = a comma separated list of key : value pairs. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport.update | def update(self, stats):
"""Update stats to a server.
The method builds two lists: names and values
and calls the export method to export the stats.
Note: this class can be overwrite (for example in CSV and Graph).
"""
if not self.export_enable:
return False... | python | def update(self, stats):
"""Update stats to a server.
The method builds two lists: names and values
and calls the export method to export the stats.
Note: this class can be overwrite (for example in CSV and Graph).
"""
if not self.export_enable:
return False... | [
"def",
"update",
"(",
"self",
",",
"stats",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"False",
"# Get all the stats & limits",
"all_stats",
"=",
"stats",
".",
"getAllExportsAsDict",
"(",
"plugin_list",
"=",
"self",
".",
"plugins_to_expo... | Update stats to a server.
The method builds two lists: names and values
and calls the export method to export the stats.
Note: this class can be overwrite (for example in CSV and Graph). | [
"Update",
"stats",
"to",
"a",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L157-L185 | train | Update stats to a server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_export.py | GlancesExport.__build_export | def __build_export(self, stats):
"""Build the export lists."""
export_names = []
export_values = []
if isinstance(stats, dict):
# Stats is a dict
# Is there a key ?
if 'key' in iterkeys(stats) and stats['key'] in iterkeys(stats):
pre_k... | python | def __build_export(self, stats):
"""Build the export lists."""
export_names = []
export_values = []
if isinstance(stats, dict):
# Stats is a dict
# Is there a key ?
if 'key' in iterkeys(stats) and stats['key'] in iterkeys(stats):
pre_k... | [
"def",
"__build_export",
"(",
"self",
",",
"stats",
")",
":",
"export_names",
"=",
"[",
"]",
"export_values",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"stats",
",",
"dict",
")",
":",
"# Stats is a dict",
"# Is there a key ?",
"if",
"'key'",
"in",
"iterkeys",
... | Build the export lists. | [
"Build",
"the",
"export",
"lists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_export.py#L187-L223 | train | Build the export lists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_server.py | GlancesStatsServer.update | def update(self, input_stats=None):
"""Update the stats."""
input_stats = input_stats or {}
# Force update of all the stats
super(GlancesStatsServer, self).update()
# Build all_stats variable (concatenation of all the stats)
self.all_stats = self._set_stats(input_stats) | python | def update(self, input_stats=None):
"""Update the stats."""
input_stats = input_stats or {}
# Force update of all the stats
super(GlancesStatsServer, self).update()
# Build all_stats variable (concatenation of all the stats)
self.all_stats = self._set_stats(input_stats) | [
"def",
"update",
"(",
"self",
",",
"input_stats",
"=",
"None",
")",
":",
"input_stats",
"=",
"input_stats",
"or",
"{",
"}",
"# Force update of all the stats",
"super",
"(",
"GlancesStatsServer",
",",
"self",
")",
".",
"update",
"(",
")",
"# Build all_stats varia... | Update the stats. | [
"Update",
"the",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_server.py#L41-L49 | train | Update the stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_server.py | GlancesStatsServer._set_stats | def _set_stats(self, input_stats):
"""Set the stats to the input_stats one."""
# Build the all_stats with the get_raw() method of the plugins
return {p: self._plugins[p].get_raw() for p in self._plugins if self._plugins[p].is_enable()} | python | def _set_stats(self, input_stats):
"""Set the stats to the input_stats one."""
# Build the all_stats with the get_raw() method of the plugins
return {p: self._plugins[p].get_raw() for p in self._plugins if self._plugins[p].is_enable()} | [
"def",
"_set_stats",
"(",
"self",
",",
"input_stats",
")",
":",
"# Build the all_stats with the get_raw() method of the plugins",
"return",
"{",
"p",
":",
"self",
".",
"_plugins",
"[",
"p",
"]",
".",
"get_raw",
"(",
")",
"for",
"p",
"in",
"self",
".",
"_plugin... | Set the stats to the input_stats one. | [
"Set",
"the",
"stats",
"to",
"the",
"input_stats",
"one",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_server.py#L51-L54 | train | Set the stats to the input_stats one. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_influxdb.py | Export.init | def init(self):
"""Init the connection to the InfluxDB server."""
if not self.export_enable:
return None
try:
db = InfluxDBClient(host=self.host,
port=self.port,
username=self.user,
... | python | def init(self):
"""Init the connection to the InfluxDB server."""
if not self.export_enable:
return None
try:
db = InfluxDBClient(host=self.host,
port=self.port,
username=self.user,
... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"None",
"try",
":",
"db",
"=",
"InfluxDBClient",
"(",
"host",
"=",
"self",
".",
"host",
",",
"port",
"=",
"self",
".",
"port",
",",
"username",
"=",
"se... | Init the connection to the InfluxDB server. | [
"Init",
"the",
"connection",
"to",
"the",
"InfluxDB",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_influxdb.py#L59-L82 | train | Init the connection to the InfluxDB server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_influxdb.py | Export._normalize | def _normalize(self, name, columns, points):
"""Normalize data for the InfluxDB's data model."""
for i, _ in enumerate(points):
# Supported type:
# https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_reference/
if points[i] is None:
... | python | def _normalize(self, name, columns, points):
"""Normalize data for the InfluxDB's data model."""
for i, _ in enumerate(points):
# Supported type:
# https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_reference/
if points[i] is None:
... | [
"def",
"_normalize",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"for",
"i",
",",
"_",
"in",
"enumerate",
"(",
"points",
")",
":",
"# Supported type:",
"# https://docs.influxdata.com/influxdb/v1.5/write_protocols/line_protocol_reference/",
"if",... | Normalize data for the InfluxDB's data model. | [
"Normalize",
"data",
"for",
"the",
"InfluxDB",
"s",
"data",
"model",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_influxdb.py#L84-L110 | train | Normalize data for the InfluxDB s data model. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_influxdb.py | Export.export | def export(self, name, columns, points):
"""Write the points to the InfluxDB server."""
# Manage prefix
if self.prefix is not None:
name = self.prefix + '.' + name
# Write input to the InfluxDB database
try:
self.client.write_points(self._normalize(name, c... | python | def export(self, name, columns, points):
"""Write the points to the InfluxDB server."""
# Manage prefix
if self.prefix is not None:
name = self.prefix + '.' + name
# Write input to the InfluxDB database
try:
self.client.write_points(self._normalize(name, c... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"# Manage prefix",
"if",
"self",
".",
"prefix",
"is",
"not",
"None",
":",
"name",
"=",
"self",
".",
"prefix",
"+",
"'.'",
"+",
"name",
"# Write input to the InfluxDB databa... | Write the points to the InfluxDB server. | [
"Write",
"the",
"points",
"to",
"the",
"InfluxDB",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_influxdb.py#L112-L124 | train | Write the points to the InfluxDB server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/filter.py | GlancesFilter.filter | def filter(self, value):
"""Set the filter (as a sting) and compute the regular expression
A filter could be one of the following:
- python > Process name of cmd start with python
- .*python.* > Process name of cmd contain python
- username:nicolargo > Process of nicolargo user
... | python | def filter(self, value):
"""Set the filter (as a sting) and compute the regular expression
A filter could be one of the following:
- python > Process name of cmd start with python
- .*python.* > Process name of cmd contain python
- username:nicolargo > Process of nicolargo user
... | [
"def",
"filter",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_filter_input",
"=",
"value",
"if",
"value",
"is",
"None",
":",
"self",
".",
"_filter",
"=",
"None",
"self",
".",
"_filter_key",
"=",
"None",
"else",
":",
"new_filter",
"=",
"value",
... | Set the filter (as a sting) and compute the regular expression
A filter could be one of the following:
- python > Process name of cmd start with python
- .*python.* > Process name of cmd contain python
- username:nicolargo > Process of nicolargo user | [
"Set",
"the",
"filter",
"(",
"as",
"a",
"sting",
")",
"and",
"compute",
"the",
"regular",
"expression",
"A",
"filter",
"could",
"be",
"one",
"of",
"the",
"following",
":",
"-",
"python",
">",
"Process",
"name",
"of",
"cmd",
"start",
"with",
"python",
"... | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/filter.py#L69-L100 | train | Set the filter and compute the regular expression | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/filter.py | GlancesFilter.is_filtered | def is_filtered(self, process):
"""Return True if the process item match the current filter
The proces item is a dict.
"""
if self.filter is None:
# No filter => Not filtered
return False
if self.filter_key is None:
# Apply filter on command l... | python | def is_filtered(self, process):
"""Return True if the process item match the current filter
The proces item is a dict.
"""
if self.filter is None:
# No filter => Not filtered
return False
if self.filter_key is None:
# Apply filter on command l... | [
"def",
"is_filtered",
"(",
"self",
",",
"process",
")",
":",
"if",
"self",
".",
"filter",
"is",
"None",
":",
"# No filter => Not filtered",
"return",
"False",
"if",
"self",
".",
"filter_key",
"is",
"None",
":",
"# Apply filter on command line and process name",
"r... | Return True if the process item match the current filter
The proces item is a dict. | [
"Return",
"True",
"if",
"the",
"process",
"item",
"match",
"the",
"current",
"filter",
"The",
"proces",
"item",
"is",
"a",
"dict",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/filter.py#L112-L126 | train | Return True if the process item matches the current filter
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/filter.py | GlancesFilter._is_process_filtered | def _is_process_filtered(self, process, key=None):
"""Return True if the process[key] should be filtered according to the current filter"""
if key is None:
key = self.filter_key
try:
# If the item process[key] is a list, convert it to a string
# in order to ma... | python | def _is_process_filtered(self, process, key=None):
"""Return True if the process[key] should be filtered according to the current filter"""
if key is None:
key = self.filter_key
try:
# If the item process[key] is a list, convert it to a string
# in order to ma... | [
"def",
"_is_process_filtered",
"(",
"self",
",",
"process",
",",
"key",
"=",
"None",
")",
":",
"if",
"key",
"is",
"None",
":",
"key",
"=",
"self",
".",
"filter_key",
"try",
":",
"# If the item process[key] is a list, convert it to a string",
"# in order to match it ... | Return True if the process[key] should be filtered according to the current filter | [
"Return",
"True",
"if",
"the",
"process",
"[",
"key",
"]",
"should",
"be",
"filtered",
"according",
"to",
"the",
"current",
"filter"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/filter.py#L128-L149 | train | Return True if the process [ key ] should be filtered according to the current filter | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password_list.py | GlancesPasswordList.load | def load(self, config):
"""Load the password from the configuration file."""
password_dict = {}
if config is None:
logger.warning("No configuration file available. Cannot load password list.")
elif not config.has_section(self._section):
logger.warning("No [%s] se... | python | def load(self, config):
"""Load the password from the configuration file."""
password_dict = {}
if config is None:
logger.warning("No configuration file available. Cannot load password list.")
elif not config.has_section(self._section):
logger.warning("No [%s] se... | [
"def",
"load",
"(",
"self",
",",
"config",
")",
":",
"password_dict",
"=",
"{",
"}",
"if",
"config",
"is",
"None",
":",
"logger",
".",
"warning",
"(",
"\"No configuration file available. Cannot load password list.\"",
")",
"elif",
"not",
"config",
".",
"has_sect... | Load the password from the configuration file. | [
"Load",
"the",
"password",
"from",
"the",
"configuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password_list.py#L39-L56 | train | Load the password from the configuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password_list.py | GlancesPasswordList.get_password | def get_password(self, host=None):
"""
If host=None, return the current server list (dict).
Else, return the host's password (or the default one if defined or None)
"""
if host is None:
return self._password_dict
else:
try:
return s... | python | def get_password(self, host=None):
"""
If host=None, return the current server list (dict).
Else, return the host's password (or the default one if defined or None)
"""
if host is None:
return self._password_dict
else:
try:
return s... | [
"def",
"get_password",
"(",
"self",
",",
"host",
"=",
"None",
")",
":",
"if",
"host",
"is",
"None",
":",
"return",
"self",
".",
"_password_dict",
"else",
":",
"try",
":",
"return",
"self",
".",
"_password_dict",
"[",
"host",
"]",
"except",
"(",
"KeyErr... | If host=None, return the current server list (dict).
Else, return the host's password (or the default one if defined or None) | [
"If",
"host",
"=",
"None",
"return",
"the",
"current",
"server",
"list",
"(",
"dict",
")",
".",
"Else",
"return",
"the",
"host",
"s",
"password",
"(",
"or",
"the",
"default",
"one",
"if",
"defined",
"or",
"None",
")"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password_list.py#L58-L72 | train | Get the password of the current server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/amps/glances_systemd.py | Amp.update | def update(self, process_list):
"""Update the AMP"""
# Get the systemctl status
logger.debug('{}: Update stats using systemctl {}'.format(self.NAME, self.get('systemctl_cmd')))
try:
res = check_output(self.get('systemctl_cmd').split())
except (OSError, CalledProcessEr... | python | def update(self, process_list):
"""Update the AMP"""
# Get the systemctl status
logger.debug('{}: Update stats using systemctl {}'.format(self.NAME, self.get('systemctl_cmd')))
try:
res = check_output(self.get('systemctl_cmd').split())
except (OSError, CalledProcessEr... | [
"def",
"update",
"(",
"self",
",",
"process_list",
")",
":",
"# Get the systemctl status",
"logger",
".",
"debug",
"(",
"'{}: Update stats using systemctl {}'",
".",
"format",
"(",
"self",
".",
"NAME",
",",
"self",
".",
"get",
"(",
"'systemctl_cmd'",
")",
")",
... | Update the AMP | [
"Update",
"the",
"AMP"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_systemd.py#L68-L95 | train | Update the AMP status using systemctl | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | get_mem | def get_mem(device_handle):
"""Get GPU device memory consumption in percent."""
try:
memory_info = pynvml.nvmlDeviceGetMemoryInfo(device_handle)
return memory_info.used * 100.0 / memory_info.total
except pynvml.NVMLError:
return None | python | def get_mem(device_handle):
"""Get GPU device memory consumption in percent."""
try:
memory_info = pynvml.nvmlDeviceGetMemoryInfo(device_handle)
return memory_info.used * 100.0 / memory_info.total
except pynvml.NVMLError:
return None | [
"def",
"get_mem",
"(",
"device_handle",
")",
":",
"try",
":",
"memory_info",
"=",
"pynvml",
".",
"nvmlDeviceGetMemoryInfo",
"(",
"device_handle",
")",
"return",
"memory_info",
".",
"used",
"*",
"100.0",
"/",
"memory_info",
".",
"total",
"except",
"pynvml",
"."... | Get GPU device memory consumption in percent. | [
"Get",
"GPU",
"device",
"memory",
"consumption",
"in",
"percent",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L267-L273 | train | Get GPU device memory consumption in percent. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | Plugin.init_nvidia | def init_nvidia(self):
"""Init the NVIDIA API."""
if import_error_tag:
self.nvml_ready = False
try:
pynvml.nvmlInit()
self.device_handles = get_device_handles()
self.nvml_ready = True
except Exception:
logger.debug("pynvml coul... | python | def init_nvidia(self):
"""Init the NVIDIA API."""
if import_error_tag:
self.nvml_ready = False
try:
pynvml.nvmlInit()
self.device_handles = get_device_handles()
self.nvml_ready = True
except Exception:
logger.debug("pynvml coul... | [
"def",
"init_nvidia",
"(",
"self",
")",
":",
"if",
"import_error_tag",
":",
"self",
".",
"nvml_ready",
"=",
"False",
"try",
":",
"pynvml",
".",
"nvmlInit",
"(",
")",
"self",
".",
"device_handles",
"=",
"get_device_handles",
"(",
")",
"self",
".",
"nvml_rea... | Init the NVIDIA API. | [
"Init",
"the",
"NVIDIA",
"API",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L62-L75 | train | Initialize the NVIDIA API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | Plugin.update | def update(self):
"""Update the GPU stats."""
# Init new stats
stats = self.get_init_value()
# !!! JUST FOR TEST (because i did not have any NVidia GPU... :()
# self.stats = [{"key": "gpu_id", "mem": None, "proc": 60, "gpu_id": 0, "name": "GeForce GTX 560 Ti"}]
# self.st... | python | def update(self):
"""Update the GPU stats."""
# Init new stats
stats = self.get_init_value()
# !!! JUST FOR TEST (because i did not have any NVidia GPU... :()
# self.stats = [{"key": "gpu_id", "mem": None, "proc": 60, "gpu_id": 0, "name": "GeForce GTX 560 Ti"}]
# self.st... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"# !!! JUST FOR TEST (because i did not have any NVidia GPU... :()",
"# self.stats = [{\"key\": \"gpu_id\", \"mem\": None, \"proc\": 60, \"gpu_id\": 0, \"name\": \"GeForce... | Update the GPU stats. | [
"Update",
"the",
"GPU",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L83-L111 | train | Update the GPU stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist, not empty (issue #871) and plugin not disabled
if not self.stats or (self.stats == []) or self.is_disable():... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist, not empty (issue #871) and plugin not disabled
if not self.stats or (self.stats == []) or self.is_disable():... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist, not empty (issue #871) and plugin not disabled",
"if",
"not",
"self",
".",
"stats",
... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L134-L217 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | Plugin.get_device_stats | def get_device_stats(self):
"""Get GPU stats."""
stats = []
for index, device_handle in enumerate(self.device_handles):
device_stats = {}
# Dictionnary key is the GPU_ID
device_stats['key'] = self.get_key()
# GPU id (for multiple GPU, start at 0)
... | python | def get_device_stats(self):
"""Get GPU stats."""
stats = []
for index, device_handle in enumerate(self.device_handles):
device_stats = {}
# Dictionnary key is the GPU_ID
device_stats['key'] = self.get_key()
# GPU id (for multiple GPU, start at 0)
... | [
"def",
"get_device_stats",
"(",
"self",
")",
":",
"stats",
"=",
"[",
"]",
"for",
"index",
",",
"device_handle",
"in",
"enumerate",
"(",
"self",
".",
"device_handles",
")",
":",
"device_stats",
"=",
"{",
"}",
"# Dictionnary key is the GPU_ID",
"device_stats",
"... | Get GPU stats. | [
"Get",
"GPU",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L219-L237 | train | Get GPU stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_gpu.py | Plugin.exit | def exit(self):
"""Overwrite the exit method to close the GPU API."""
if self.nvml_ready:
try:
pynvml.nvmlShutdown()
except Exception as e:
logger.debug("pynvml failed to shutdown correctly ({})".format(e))
# Call the father exit method
... | python | def exit(self):
"""Overwrite the exit method to close the GPU API."""
if self.nvml_ready:
try:
pynvml.nvmlShutdown()
except Exception as e:
logger.debug("pynvml failed to shutdown correctly ({})".format(e))
# Call the father exit method
... | [
"def",
"exit",
"(",
"self",
")",
":",
"if",
"self",
".",
"nvml_ready",
":",
"try",
":",
"pynvml",
".",
"nvmlShutdown",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"logger",
".",
"debug",
"(",
"\"pynvml failed to shutdown correctly ({})\"",
".",
"format"... | Overwrite the exit method to close the GPU API. | [
"Overwrite",
"the",
"exit",
"method",
"to",
"close",
"the",
"GPU",
"API",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_gpu.py#L239-L248 | train | Overwrite the exit method to close the GPU API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient.log_and_exit | def log_and_exit(self, msg=''):
"""Log and exit."""
if not self.return_to_browser:
logger.critical(msg)
sys.exit(2)
else:
logger.error(msg) | python | def log_and_exit(self, msg=''):
"""Log and exit."""
if not self.return_to_browser:
logger.critical(msg)
sys.exit(2)
else:
logger.error(msg) | [
"def",
"log_and_exit",
"(",
"self",
",",
"msg",
"=",
"''",
")",
":",
"if",
"not",
"self",
".",
"return_to_browser",
":",
"logger",
".",
"critical",
"(",
"msg",
")",
"sys",
".",
"exit",
"(",
"2",
")",
"else",
":",
"logger",
".",
"error",
"(",
"msg",... | Log and exit. | [
"Log",
"and",
"exit",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L79-L85 | train | Log and exit. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient._login_glances | def _login_glances(self):
"""Login to a Glances server"""
client_version = None
try:
client_version = self.client.init()
except socket.error as err:
# Fallback to SNMP
self.client_mode = 'snmp'
logger.error("Connection to Glances server fai... | python | def _login_glances(self):
"""Login to a Glances server"""
client_version = None
try:
client_version = self.client.init()
except socket.error as err:
# Fallback to SNMP
self.client_mode = 'snmp'
logger.error("Connection to Glances server fai... | [
"def",
"_login_glances",
"(",
"self",
")",
":",
"client_version",
"=",
"None",
"try",
":",
"client_version",
"=",
"self",
".",
"client",
".",
"init",
"(",
")",
"except",
"socket",
".",
"error",
"as",
"err",
":",
"# Fallback to SNMP",
"self",
".",
"client_m... | Login to a Glances server | [
"Login",
"to",
"a",
"Glances",
"server"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L101-L137 | train | Login to a Glances server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient._login_snmp | def _login_snmp(self):
"""Login to a SNMP server"""
logger.info("Trying to grab stats by SNMP...")
from glances.stats_client_snmp import GlancesStatsClientSNMP
# Init stats
self.stats = GlancesStatsClientSNMP(config=self.config, args=self.args)
if not self.stats.check_... | python | def _login_snmp(self):
"""Login to a SNMP server"""
logger.info("Trying to grab stats by SNMP...")
from glances.stats_client_snmp import GlancesStatsClientSNMP
# Init stats
self.stats = GlancesStatsClientSNMP(config=self.config, args=self.args)
if not self.stats.check_... | [
"def",
"_login_snmp",
"(",
"self",
")",
":",
"logger",
".",
"info",
"(",
"\"Trying to grab stats by SNMP...\"",
")",
"from",
"glances",
".",
"stats_client_snmp",
"import",
"GlancesStatsClientSNMP",
"# Init stats",
"self",
".",
"stats",
"=",
"GlancesStatsClientSNMP",
"... | Login to a SNMP server | [
"Login",
"to",
"a",
"SNMP",
"server"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L139-L152 | train | Login to a SNMP server | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient.login | def login(self):
"""Logon to the server."""
if self.args.snmp_force:
# Force SNMP instead of Glances server
self.client_mode = 'snmp'
else:
# First of all, trying to connect to a Glances server
if not self._login_glances():
return ... | python | def login(self):
"""Logon to the server."""
if self.args.snmp_force:
# Force SNMP instead of Glances server
self.client_mode = 'snmp'
else:
# First of all, trying to connect to a Glances server
if not self._login_glances():
return ... | [
"def",
"login",
"(",
"self",
")",
":",
"if",
"self",
".",
"args",
".",
"snmp_force",
":",
"# Force SNMP instead of Glances server",
"self",
".",
"client_mode",
"=",
"'snmp'",
"else",
":",
"# First of all, trying to connect to a Glances server",
"if",
"not",
"self",
... | Logon to the server. | [
"Logon",
"to",
"the",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L154-L183 | train | Logon to the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient.update | def update(self):
"""Update stats from Glances/SNMP server."""
if self.client_mode == 'glances':
return self.update_glances()
elif self.client_mode == 'snmp':
return self.update_snmp()
else:
self.end()
logger.critical("Unknown server mode: ... | python | def update(self):
"""Update stats from Glances/SNMP server."""
if self.client_mode == 'glances':
return self.update_glances()
elif self.client_mode == 'snmp':
return self.update_snmp()
else:
self.end()
logger.critical("Unknown server mode: ... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"client_mode",
"==",
"'glances'",
":",
"return",
"self",
".",
"update_glances",
"(",
")",
"elif",
"self",
".",
"client_mode",
"==",
"'snmp'",
":",
"return",
"self",
".",
"update_snmp",
"(",
")",
... | Update stats from Glances/SNMP server. | [
"Update",
"stats",
"from",
"Glances",
"/",
"SNMP",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L185-L194 | train | Update stats from Glances or SNMP server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient.update_glances | def update_glances(self):
"""Get stats from Glances server.
Return the client/server connection status:
- Connected: Connection OK
- Disconnected: Connection NOK
"""
# Update the stats
try:
server_stats = json.loads(self.client.getAll())
excep... | python | def update_glances(self):
"""Get stats from Glances server.
Return the client/server connection status:
- Connected: Connection OK
- Disconnected: Connection NOK
"""
# Update the stats
try:
server_stats = json.loads(self.client.getAll())
excep... | [
"def",
"update_glances",
"(",
"self",
")",
":",
"# Update the stats",
"try",
":",
"server_stats",
"=",
"json",
".",
"loads",
"(",
"self",
".",
"client",
".",
"getAll",
"(",
")",
")",
"except",
"socket",
".",
"error",
":",
"# Client cannot get server stats",
... | Get stats from Glances server.
Return the client/server connection status:
- Connected: Connection OK
- Disconnected: Connection NOK | [
"Get",
"stats",
"from",
"Glances",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L196-L215 | train | Update the internal dict with the stats from Glances server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/client.py | GlancesClient.serve_forever | def serve_forever(self):
"""Main client loop."""
# Test if client and server are in the same major version
if not self.login():
logger.critical("The server version is not compatible with the client")
self.end()
return self.client_mode
exitkey = False... | python | def serve_forever(self):
"""Main client loop."""
# Test if client and server are in the same major version
if not self.login():
logger.critical("The server version is not compatible with the client")
self.end()
return self.client_mode
exitkey = False... | [
"def",
"serve_forever",
"(",
"self",
")",
":",
"# Test if client and server are in the same major version",
"if",
"not",
"self",
".",
"login",
"(",
")",
":",
"logger",
".",
"critical",
"(",
"\"The server version is not compatible with the client\"",
")",
"self",
".",
"e... | Main client loop. | [
"Main",
"client",
"loop",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/client.py#L234-L261 | train | Main client loop. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_folders.py | Plugin.update | def update(self):
"""Update the foldered list."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Folder list only available in a full Glances environment
# Check if the glances_folder instance is init
if self.glances... | python | def update(self):
"""Update the foldered list."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Folder list only available in a full Glances environment
# Check if the glances_folder instance is init
if self.glances... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Folder list only available in a full Glances environment",
"# Check if the glances_folder instanc... | Update the foldered list. | [
"Update",
"the",
"foldered",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_folders.py#L53-L75 | train | Update the foldered list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_folders.py | Plugin.get_alert | def get_alert(self, stat, header=""):
"""Manage limits of the folder list."""
if not isinstance(stat['size'], numbers.Number):
ret = 'DEFAULT'
else:
ret = 'OK'
if stat['critical'] is not None and \
stat['size'] > int(stat['critical']) * 1000000... | python | def get_alert(self, stat, header=""):
"""Manage limits of the folder list."""
if not isinstance(stat['size'], numbers.Number):
ret = 'DEFAULT'
else:
ret = 'OK'
if stat['critical'] is not None and \
stat['size'] > int(stat['critical']) * 1000000... | [
"def",
"get_alert",
"(",
"self",
",",
"stat",
",",
"header",
"=",
"\"\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"stat",
"[",
"'size'",
"]",
",",
"numbers",
".",
"Number",
")",
":",
"ret",
"=",
"'DEFAULT'",
"else",
":",
"ret",
"=",
"'OK'",
"if",... | Manage limits of the folder list. | [
"Manage",
"limits",
"of",
"the",
"folder",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_folders.py#L77-L106 | train | Manage limits of the folder list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_folders.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist and display plugin enable...",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_folders.py#L108-L143 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/actions.py | GlancesActions.run | def run(self, stat_name, criticity, commands, repeat, mustache_dict=None):
"""Run the commands (in background).
- stats_name: plugin_name (+ header)
- criticity: criticity of the trigger
- commands: a list of command line with optional {{mustache}}
- If True, then repeat the act... | python | def run(self, stat_name, criticity, commands, repeat, mustache_dict=None):
"""Run the commands (in background).
- stats_name: plugin_name (+ header)
- criticity: criticity of the trigger
- commands: a list of command line with optional {{mustache}}
- If True, then repeat the act... | [
"def",
"run",
"(",
"self",
",",
"stat_name",
",",
"criticity",
",",
"commands",
",",
"repeat",
",",
"mustache_dict",
"=",
"None",
")",
":",
"if",
"(",
"self",
".",
"get",
"(",
"stat_name",
")",
"==",
"criticity",
"and",
"not",
"repeat",
")",
"or",
"n... | Run the commands (in background).
- stats_name: plugin_name (+ header)
- criticity: criticity of the trigger
- commands: a list of command line with optional {{mustache}}
- If True, then repeat the action
- mustache_dict: Plugin stats (can be use within {{mustache}})
Re... | [
"Run",
"the",
"commands",
"(",
"in",
"background",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/actions.py#L66-L106 | train | Execute the commands in background and return True if the commands have been executed False otherwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/globals.py | safe_makedirs | def safe_makedirs(path):
"""A safe function for creating a directory tree."""
try:
os.makedirs(path)
except OSError as err:
if err.errno == errno.EEXIST:
if not os.path.isdir(path):
raise
else:
raise | python | def safe_makedirs(path):
"""A safe function for creating a directory tree."""
try:
os.makedirs(path)
except OSError as err:
if err.errno == errno.EEXIST:
if not os.path.isdir(path):
raise
else:
raise | [
"def",
"safe_makedirs",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"path",
")",
"except",
"OSError",
"as",
"err",
":",
"if",
"err",
".",
"errno",
"==",
"errno",
".",
"EEXIST",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
... | A safe function for creating a directory tree. | [
"A",
"safe",
"function",
"for",
"creating",
"a",
"directory",
"tree",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/globals.py#L44-L53 | train | A safe function for creating a directory tree. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_client.py | GlancesStatsClient.set_plugins | def set_plugins(self, input_plugins):
"""Set the plugin list according to the Glances server."""
header = "glances_"
for item in input_plugins:
# Import the plugin
try:
plugin = __import__(header + item)
except ImportError:
# Se... | python | def set_plugins(self, input_plugins):
"""Set the plugin list according to the Glances server."""
header = "glances_"
for item in input_plugins:
# Import the plugin
try:
plugin = __import__(header + item)
except ImportError:
# Se... | [
"def",
"set_plugins",
"(",
"self",
",",
"input_plugins",
")",
":",
"header",
"=",
"\"glances_\"",
"for",
"item",
"in",
"input_plugins",
":",
"# Import the plugin",
"try",
":",
"plugin",
"=",
"__import__",
"(",
"header",
"+",
"item",
")",
"except",
"ImportError... | Set the plugin list according to the Glances server. | [
"Set",
"the",
"plugin",
"list",
"according",
"to",
"the",
"Glances",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_client.py#L43-L61 | train | Set the plugin list according to the Glances server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_client.py | GlancesStatsClient.update | def update(self, input_stats):
"""Update all the stats."""
# For Glances client mode
for p in input_stats:
# Update plugin stats with items sent by the server
self._plugins[p].set_stats(input_stats[p])
# Update the views for the updated stats
self.... | python | def update(self, input_stats):
"""Update all the stats."""
# For Glances client mode
for p in input_stats:
# Update plugin stats with items sent by the server
self._plugins[p].set_stats(input_stats[p])
# Update the views for the updated stats
self.... | [
"def",
"update",
"(",
"self",
",",
"input_stats",
")",
":",
"# For Glances client mode",
"for",
"p",
"in",
"input_stats",
":",
"# Update plugin stats with items sent by the server",
"self",
".",
"_plugins",
"[",
"p",
"]",
".",
"set_stats",
"(",
"input_stats",
"[",
... | Update all the stats. | [
"Update",
"all",
"the",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_client.py#L63-L70 | train | Update all the stats. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_quicklook.py | Plugin.update | def update(self):
"""Update quicklook stats using the input method."""
# Init new stats
stats = self.get_init_value()
# Grab quicklook stats: CPU, MEM and SWAP
if self.input_method == 'local':
# Get the latest CPU percent value
stats['cpu'] = cpu_percent.... | python | def update(self):
"""Update quicklook stats using the input method."""
# Init new stats
stats = self.get_init_value()
# Grab quicklook stats: CPU, MEM and SWAP
if self.input_method == 'local':
# Get the latest CPU percent value
stats['cpu'] = cpu_percent.... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"# Grab quicklook stats: CPU, MEM and SWAP",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Get the latest CPU percent value",
"stats",
"[",... | Update quicklook stats using the input method. | [
"Update",
"quicklook",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_quicklook.py#L71-L103 | train | Update the quicklook stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_quicklook.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert only
for key in ['cpu', 'mem', 'swap']:
if key in self.stats:
self.views[key]['decoration'] = ... | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert only
for key in ['cpu', 'mem', 'swap']:
if key in self.stats:
self.views[key]['decoration'] = ... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"# Alert only",
"for",
"key",
"in",
"[",
"'cpu'",
",",
"'mem'",
",",
"'swap'",
... | Update stats views. | [
"Update",
"stats",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_quicklook.py#L105-L114 | train | Update stats views. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_quicklook.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=10):
"""Return the list to display in the UI."""
# Init the return message
ret = []
# Only process if stats exist...
if not self.stats or self.is_disable():
return ret
# Define the data: Bar (default behavor) or Spark... | python | def msg_curse(self, args=None, max_width=10):
"""Return the list to display in the UI."""
# Init the return message
ret = []
# Only process if stats exist...
if not self.stats or self.is_disable():
return ret
# Define the data: Bar (default behavor) or Spark... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"10",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist...",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
".",
"is_disable",
"(",
... | Return the list to display in the UI. | [
"Return",
"the",
"list",
"to",
"display",
"in",
"the",
"UI",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_quicklook.py#L116-L179 | train | Return the list of messages to display in the UI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_quicklook.py | Plugin._msg_create_line | def _msg_create_line(self, msg, data, key):
"""Create a new line to the Quickview."""
ret = []
ret.append(self.curse_add_line(msg))
ret.append(self.curse_add_line(data.pre_char, decoration='BOLD'))
ret.append(self.curse_add_line(data.get(), self.get_views(key=key, option='decora... | python | def _msg_create_line(self, msg, data, key):
"""Create a new line to the Quickview."""
ret = []
ret.append(self.curse_add_line(msg))
ret.append(self.curse_add_line(data.pre_char, decoration='BOLD'))
ret.append(self.curse_add_line(data.get(), self.get_views(key=key, option='decora... | [
"def",
"_msg_create_line",
"(",
"self",
",",
"msg",
",",
"data",
",",
"key",
")",
":",
"ret",
"=",
"[",
"]",
"ret",
".",
"append",
"(",
"self",
".",
"curse_add_line",
"(",
"msg",
")",
")",
"ret",
".",
"append",
"(",
"self",
".",
"curse_add_line",
"... | Create a new line to the Quickview. | [
"Create",
"a",
"new",
"line",
"to",
"the",
"Quickview",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_quicklook.py#L181-L191 | train | Create a new line to the Quickview. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/amps/glances_default.py | Amp.update | def update(self, process_list):
"""Update the AMP"""
# Get the systemctl status
logger.debug('{}: Update AMP stats using service {}'.format(self.NAME, self.get('service_cmd')))
try:
res = self.get('command')
except OSError as e:
logger.debug('{}: Error whi... | python | def update(self, process_list):
"""Update the AMP"""
# Get the systemctl status
logger.debug('{}: Update AMP stats using service {}'.format(self.NAME, self.get('service_cmd')))
try:
res = self.get('command')
except OSError as e:
logger.debug('{}: Error whi... | [
"def",
"update",
"(",
"self",
",",
"process_list",
")",
":",
"# Get the systemctl status",
"logger",
".",
"debug",
"(",
"'{}: Update AMP stats using service {}'",
".",
"format",
"(",
"self",
".",
"NAME",
",",
"self",
".",
"get",
"(",
"'service_cmd'",
")",
")",
... | Update the AMP | [
"Update",
"the",
"AMP"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_default.py#L59-L81 | train | Update the AMP stats using the systemctl command. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_restful.py | Export.init | def init(self):
"""Init the connection to the RESTful server."""
if not self.export_enable:
return None
# Build the RESTful URL where the stats will be posted
url = '{}://{}:{}{}'.format(self.protocol,
self.host,
... | python | def init(self):
"""Init the connection to the RESTful server."""
if not self.export_enable:
return None
# Build the RESTful URL where the stats will be posted
url = '{}://{}:{}{}'.format(self.protocol,
self.host,
... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"None",
"# Build the RESTful URL where the stats will be posted",
"url",
"=",
"'{}://{}:{}{}'",
".",
"format",
"(",
"self",
".",
"protocol",
",",
"self",
".",
"host",... | Init the connection to the RESTful server. | [
"Init",
"the",
"connection",
"to",
"the",
"RESTful",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_restful.py#L57-L68 | train | Init the connection to the RESTful server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_restful.py | Export.export | def export(self, name, columns, points):
"""Export the stats to the Statsd server."""
if name == self.plugins_to_export()[0] and self.buffer != {}:
# One complete loop have been done
logger.debug("Export stats ({}) to RESTful endpoint ({})".format(listkeys(self.buffer),
... | python | def export(self, name, columns, points):
"""Export the stats to the Statsd server."""
if name == self.plugins_to_export()[0] and self.buffer != {}:
# One complete loop have been done
logger.debug("Export stats ({}) to RESTful endpoint ({})".format(listkeys(self.buffer),
... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"if",
"name",
"==",
"self",
".",
"plugins_to_export",
"(",
")",
"[",
"0",
"]",
"and",
"self",
".",
"buffer",
"!=",
"{",
"}",
":",
"# One complete loop have been done",
... | Export the stats to the Statsd server. | [
"Export",
"the",
"stats",
"to",
"the",
"Statsd",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_restful.py#L70-L82 | train | Export the stats to the Statsd server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/folder_list.py | FolderList.__set_folder_list | def __set_folder_list(self, section):
"""Init the monitored folder list.
The list is defined in the Glances configuration file.
"""
for l in range(1, self.__folder_list_max_size + 1):
value = {}
key = 'folder_' + str(l) + '_'
# Path is mandatory
... | python | def __set_folder_list(self, section):
"""Init the monitored folder list.
The list is defined in the Glances configuration file.
"""
for l in range(1, self.__folder_list_max_size + 1):
value = {}
key = 'folder_' + str(l) + '_'
# Path is mandatory
... | [
"def",
"__set_folder_list",
"(",
"self",
",",
"section",
")",
":",
"for",
"l",
"in",
"range",
"(",
"1",
",",
"self",
".",
"__folder_list_max_size",
"+",
"1",
")",
":",
"value",
"=",
"{",
"}",
"key",
"=",
"'folder_'",
"+",
"str",
"(",
"l",
")",
"+",... | Init the monitored folder list.
The list is defined in the Glances configuration file. | [
"Init",
"the",
"monitored",
"folder",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/folder_list.py#L75-L105 | train | Initialize the monitored folder list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/folder_list.py | FolderList.__folder_size | def __folder_size(self, path):
"""Return the size of the directory given by path
path: <string>"""
ret = 0
for f in scandir(path):
if f.is_dir() and (f.name != '.' or f.name != '..'):
ret += self.__folder_size(os.path.join(path, f.name))
else:
... | python | def __folder_size(self, path):
"""Return the size of the directory given by path
path: <string>"""
ret = 0
for f in scandir(path):
if f.is_dir() and (f.name != '.' or f.name != '..'):
ret += self.__folder_size(os.path.join(path, f.name))
else:
... | [
"def",
"__folder_size",
"(",
"self",
",",
"path",
")",
":",
"ret",
"=",
"0",
"for",
"f",
"in",
"scandir",
"(",
"path",
")",
":",
"if",
"f",
".",
"is_dir",
"(",
")",
"and",
"(",
"f",
".",
"name",
"!=",
"'.'",
"or",
"f",
".",
"name",
"!=",
"'..... | Return the size of the directory given by path
path: <string> | [
"Return",
"the",
"size",
"of",
"the",
"directory",
"given",
"by",
"path"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/folder_list.py#L132-L147 | train | Return the size of the directory given by path | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/folder_list.py | FolderList.update | def update(self):
"""Update the command result attributed."""
# Only continue if monitor list is not empty
if len(self.__folder_list) == 0:
return self.__folder_list
# Iter upon the folder list
for i in range(len(self.get())):
# Update folder size
... | python | def update(self):
"""Update the command result attributed."""
# Only continue if monitor list is not empty
if len(self.__folder_list) == 0:
return self.__folder_list
# Iter upon the folder list
for i in range(len(self.get())):
# Update folder size
... | [
"def",
"update",
"(",
"self",
")",
":",
"# Only continue if monitor list is not empty",
"if",
"len",
"(",
"self",
".",
"__folder_list",
")",
"==",
"0",
":",
"return",
"self",
".",
"__folder_list",
"# Iter upon the folder list",
"for",
"i",
"in",
"range",
"(",
"l... | Update the command result attributed. | [
"Update",
"the",
"command",
"result",
"attributed",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/folder_list.py#L149-L168 | train | Update the command result attributed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bars.py | Bar.get | def get(self):
"""Return the bars."""
frac, whole = modf(self.size * self.percent / 100.0)
ret = curses_bars[8] * int(whole)
if frac > 0:
ret += curses_bars[int(frac * 8)]
whole += 1
ret += self.__empty_char * int(self.size - whole)
if self.__with_... | python | def get(self):
"""Return the bars."""
frac, whole = modf(self.size * self.percent / 100.0)
ret = curses_bars[8] * int(whole)
if frac > 0:
ret += curses_bars[int(frac * 8)]
whole += 1
ret += self.__empty_char * int(self.size - whole)
if self.__with_... | [
"def",
"get",
"(",
"self",
")",
":",
"frac",
",",
"whole",
"=",
"modf",
"(",
"self",
".",
"size",
"*",
"self",
".",
"percent",
"/",
"100.0",
")",
"ret",
"=",
"curses_bars",
"[",
"8",
"]",
"*",
"int",
"(",
"whole",
")",
"if",
"frac",
">",
"0",
... | Return the bars. | [
"Return",
"the",
"bars",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bars.py#L85-L95 | train | Return the bars. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_zeromq.py | Export.init | def init(self):
"""Init the connection to the CouchDB server."""
if not self.export_enable:
return None
server_uri = 'tcp://{}:{}'.format(self.host, self.port)
try:
self.context = zmq.Context()
publisher = self.context.socket(zmq.PUB)
pub... | python | def init(self):
"""Init the connection to the CouchDB server."""
if not self.export_enable:
return None
server_uri = 'tcp://{}:{}'.format(self.host, self.port)
try:
self.context = zmq.Context()
publisher = self.context.socket(zmq.PUB)
pub... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"None",
"server_uri",
"=",
"'tcp://{}:{}'",
".",
"format",
"(",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
"try",
":",
"self",
".",
"context",
"=... | Init the connection to the CouchDB server. | [
"Init",
"the",
"connection",
"to",
"the",
"CouchDB",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_zeromq.py#L58-L75 | train | Init the connection to the CouchDB server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_zeromq.py | Export.exit | def exit(self):
"""Close the socket and context"""
if self.client is not None:
self.client.close()
if self.context is not None:
self.context.destroy() | python | def exit(self):
"""Close the socket and context"""
if self.client is not None:
self.client.close()
if self.context is not None:
self.context.destroy() | [
"def",
"exit",
"(",
"self",
")",
":",
"if",
"self",
".",
"client",
"is",
"not",
"None",
":",
"self",
".",
"client",
".",
"close",
"(",
")",
"if",
"self",
".",
"context",
"is",
"not",
"None",
":",
"self",
".",
"context",
".",
"destroy",
"(",
")"
] | Close the socket and context | [
"Close",
"the",
"socket",
"and",
"context"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_zeromq.py#L77-L82 | train | Close the socket and context | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_zeromq.py | Export.export | def export(self, name, columns, points):
"""Write the points to the ZeroMQ server."""
logger.debug("Export {} stats to ZeroMQ".format(name))
# Create DB input
data = dict(zip(columns, points))
# Do not publish empty stats
if data == {}:
return False
... | python | def export(self, name, columns, points):
"""Write the points to the ZeroMQ server."""
logger.debug("Export {} stats to ZeroMQ".format(name))
# Create DB input
data = dict(zip(columns, points))
# Do not publish empty stats
if data == {}:
return False
... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"logger",
".",
"debug",
"(",
"\"Export {} stats to ZeroMQ\"",
".",
"format",
"(",
"name",
")",
")",
"# Create DB input",
"data",
"=",
"dict",
"(",
"zip",
"(",
"columns",
... | Write the points to the ZeroMQ server. | [
"Write",
"the",
"points",
"to",
"the",
"ZeroMQ",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_zeromq.py#L84-L110 | train | Write the points to the ZeroMQ server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_cassandra.py | Export.init | def init(self):
"""Init the connection to the Cassandra server."""
if not self.export_enable:
return None
# if username and/or password are not set the connection will try to connect with no auth
auth_provider = PlainTextAuthProvider(
username=self.username, pass... | python | def init(self):
"""Init the connection to the Cassandra server."""
if not self.export_enable:
return None
# if username and/or password are not set the connection will try to connect with no auth
auth_provider = PlainTextAuthProvider(
username=self.username, pass... | [
"def",
"init",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"export_enable",
":",
"return",
"None",
"# if username and/or password are not set the connection will try to connect with no auth",
"auth_provider",
"=",
"PlainTextAuthProvider",
"(",
"username",
"=",
"self",
... | Init the connection to the Cassandra server. | [
"Init",
"the",
"connection",
"to",
"the",
"Cassandra",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_cassandra.py#L68-L107 | train | Init the connection to the Cassandra server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_cassandra.py | Export.export | def export(self, name, columns, points):
"""Write the points to the Cassandra cluster."""
logger.debug("Export {} stats to Cassandra".format(name))
# Remove non number stats and convert all to float (for Boolean)
data = {k: float(v) for (k, v) in dict(zip(columns, points)).iteritems() i... | python | def export(self, name, columns, points):
"""Write the points to the Cassandra cluster."""
logger.debug("Export {} stats to Cassandra".format(name))
# Remove non number stats and convert all to float (for Boolean)
data = {k: float(v) for (k, v) in dict(zip(columns, points)).iteritems() i... | [
"def",
"export",
"(",
"self",
",",
"name",
",",
"columns",
",",
"points",
")",
":",
"logger",
".",
"debug",
"(",
"\"Export {} stats to Cassandra\"",
".",
"format",
"(",
"name",
")",
")",
"# Remove non number stats and convert all to float (for Boolean)",
"data",
"="... | Write the points to the Cassandra cluster. | [
"Write",
"the",
"points",
"to",
"the",
"Cassandra",
"cluster",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_cassandra.py#L109-L126 | train | Write the points to the Cassandra cluster. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_cassandra.py | Export.exit | def exit(self):
"""Close the Cassandra export module."""
# To ensure all connections are properly closed
self.session.shutdown()
self.cluster.shutdown()
# Call the father method
super(Export, self).exit() | python | def exit(self):
"""Close the Cassandra export module."""
# To ensure all connections are properly closed
self.session.shutdown()
self.cluster.shutdown()
# Call the father method
super(Export, self).exit() | [
"def",
"exit",
"(",
"self",
")",
":",
"# To ensure all connections are properly closed",
"self",
".",
"session",
".",
"shutdown",
"(",
")",
"self",
".",
"cluster",
".",
"shutdown",
"(",
")",
"# Call the father method",
"super",
"(",
"Export",
",",
"self",
")",
... | Close the Cassandra export module. | [
"Close",
"the",
"Cassandra",
"export",
"module",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_cassandra.py#L128-L134 | train | Close the Cassandra export module. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_system.py | _linux_os_release | def _linux_os_release():
"""Try to determine the name of a Linux distribution.
This function checks for the /etc/os-release file.
It takes the name from the 'NAME' field and the version from 'VERSION_ID'.
An empty string is returned if the above values cannot be determined.
"""
pretty_name = ''... | python | def _linux_os_release():
"""Try to determine the name of a Linux distribution.
This function checks for the /etc/os-release file.
It takes the name from the 'NAME' field and the version from 'VERSION_ID'.
An empty string is returned if the above values cannot be determined.
"""
pretty_name = ''... | [
"def",
"_linux_os_release",
"(",
")",
":",
"pretty_name",
"=",
"''",
"ashtray",
"=",
"{",
"}",
"keys",
"=",
"[",
"'NAME'",
",",
"'VERSION_ID'",
"]",
"try",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'/etc'",
",",
"'os-release'",
... | Try to determine the name of a Linux distribution.
This function checks for the /etc/os-release file.
It takes the name from the 'NAME' field and the version from 'VERSION_ID'.
An empty string is returned if the above values cannot be determined. | [
"Try",
"to",
"determine",
"the",
"name",
"of",
"a",
"Linux",
"distribution",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_system.py#L51-L76 | train | Try to determine the name of a Linux distribution. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.