summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glances/exports/glances_cassandra.py5
-rw-r--r--glances/main.py6
-rw-r--r--glances/outputs/glances_curses.py4
-rw-r--r--glances/plugins/glances_docker.py10
-rw-r--r--glances/plugins/glances_help.py6
-rw-r--r--glances/plugins/glances_ip.py2
-rw-r--r--glances/plugins/glances_plugin.py10
-rw-r--r--glances/plugins/glances_ports.py8
-rwxr-xr-xsetup.py2
9 files changed, 26 insertions, 27 deletions
diff --git a/glances/exports/glances_cassandra.py b/glances/exports/glances_cassandra.py
index 351ae098..79340528 100644
--- a/glances/exports/glances_cassandra.py
+++ b/glances/exports/glances_cassandra.py
@@ -112,9 +112,8 @@ class Export(GlancesExport):
session.set_keyspace(self.keyspace)
logger.info(
- "Stats will be exported to Cassandra cluster {0} ({1}) in keyspace {2}".format(cluster.metadata.cluster_name,
- cluster.metadata.all_hosts(),
- self.keyspace))
+ "Stats will be exported to Cassandra cluster {} ({}) in keyspace {}".format(
+ cluster.metadata.cluster_name, cluster.metadata.all_hosts(), self.keyspace))
# Table
try:
diff --git a/glances/main.py b/glances/main.py
index 64e7a90f..345d6f4c 100644
--- a/glances/main.py
+++ b/glances/main.py
@@ -163,7 +163,7 @@ Start the client browser (browser mode):\n\
parser.add_argument('--export-graph', action='store_true', default=None,
dest='export_graph', help='export stats to graphs')
parser.add_argument('--path-graph', default=tempfile.gettempdir(),
- dest='path_graph', help='set the export path for graphs (default is {0})'.format(tempfile.gettempdir()))
+ dest='path_graph', help='set the export path for graphs (default is {})'.format(tempfile.gettempdir()))
parser.add_argument('--export-csv', default=None,
dest='export_csv', help='export stats to a CSV file')
parser.add_argument('--export-influxdb', action='store_true', default=False,
@@ -372,10 +372,10 @@ Start the client browser (browser mode):\n\
if args.export_graph and args.path_graph is not None:
if not os.access(args.path_graph, os.W_OK):
logger.critical(
- "Graphs output path {0} do not exist or is not writable".format(args.path_graph))
+ "Graphs output path {} doesn't exist or is not writable".format(args.path_graph))
sys.exit(2)
logger.debug(
- "Graphs output path is set to {0}".format(args.path_graph))
+ "Graphs output path is set to {}".format(args.path_graph))
# For export graph, history is mandatory
if args.export_graph and args.disable_history:
diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py
index f752e0b2..fd7dcfdd 100644
--- a/glances/outputs/glances_curses.py
+++ b/glances/outputs/glances_curses.py
@@ -744,10 +744,10 @@ class _GlancesCurses(object):
# Generate history graph
if self.graph_tag and self.args.export_graph:
self.display_popup(
- 'Generate graphs history in {0}\nPlease wait...'.format(
+ 'Generate graphs history in {}\nPlease wait...'.format(
self.glances_graph.get_output_folder()))
self.display_popup(
- 'Generate graphs history in {0}\nDone: {1} graphs generated'.format(
+ 'Generate graphs history in {}\nDone: {} graphs generated'.format(
self.glances_graph.get_output_folder(),
self.glances_graph.generate_graph(stats)))
elif self.reset_history_tag and self.args.export_graph:
diff --git a/glances/plugins/glances_docker.py b/glances/plugins/glances_docker.py
index c5368abc..3af4d557 100644
--- a/glances/plugins/glances_docker.py
+++ b/glances/plugins/glances_docker.py
@@ -265,7 +265,7 @@ class Plugin(GlancesPlugin):
cpu_new['nb_core'] = len(all_stats['cpu_stats']['cpu_usage']['percpu_usage'] or [])
except KeyError as e:
# all_stats do not have CPU information
- logger.debug("Can not grab CPU usage for container {0} ({1})".format(container_id, e))
+ logger.debug("Cannot grab CPU usage for container {} ({})".format(container_id, e))
logger.debug(all_stats)
else:
# Previous CPU stats stored in the cpu_old variable
@@ -336,7 +336,7 @@ class Plugin(GlancesPlugin):
netcounters = all_stats["networks"]
except KeyError as e:
# all_stats do not have NETWORK information
- logger.debug("Can not grab NET usage for container {0} ({1})".format(container_id, e))
+ logger.debug("Cannot grab NET usage for container {} ({})".format(container_id, e))
logger.debug(all_stats)
# No fallback available...
return network_new
@@ -360,14 +360,14 @@ class Plugin(GlancesPlugin):
# XML/RPC API, which would otherwise be overly difficult work
# for users of the API
try:
- network_new['time_since_update'] = getTimeSinceLastUpdate('docker_net_{0}'.format(container_id))
+ network_new['time_since_update'] = getTimeSinceLastUpdate('docker_net_{}'.format(container_id))
network_new['rx'] = netcounters["eth0"]["rx_bytes"] - self.netcounters_old[container_id]["eth0"]["rx_bytes"]
network_new['tx'] = netcounters["eth0"]["tx_bytes"] - self.netcounters_old[container_id]["eth0"]["tx_bytes"]
network_new['cumulative_rx'] = netcounters["eth0"]["rx_bytes"]
network_new['cumulative_tx'] = netcounters["eth0"]["tx_bytes"]
except KeyError as e:
# all_stats do not have INTERFACE information
- logger.debug("Can not grab network interface usage for container {0} ({1})".format(container_id, e))
+ logger.debug("Cannot grab network interface usage for container {} ({})".format(container_id, e))
logger.debug(all_stats)
# Save stats to compute next bitrate
@@ -394,7 +394,7 @@ class Plugin(GlancesPlugin):
iocounters = all_stats["blkio_stats"]
except KeyError as e:
# all_stats do not have io information
- logger.debug("Can not grab block IO usage for container {0} ({1})".format(container_id, e))
+ logger.debug("Cannot grab block IO usage for container {} ({})".format(container_id, e))
logger.debug(all_stats)
# No fallback available...
return io_new
diff --git a/glances/plugins/glances_help.py b/glances/plugins/glances_help.py
index ac0be4f2..75c677e7 100644
--- a/glances/plugins/glances_help.py
+++ b/glances/plugins/glances_help.py
@@ -50,11 +50,11 @@ class Plugin(GlancesPlugin):
pass
def generate_view_data(self):
- self.view_data['version'] = '{0} {1}'.format('Glances', __version__)
- self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
+ self.view_data['version'] = '{} {}'.format('Glances', __version__)
+ self.view_data['psutil_version'] = ' with PSutil {}'.format(psutil_version)
try:
- self.view_data['configuration_file'] = 'Configuration file: {0}'.format(self.config.loaded_config_file)
+ self.view_data['configuration_file'] = 'Configuration file: {}'.format(self.config.loaded_config_file)
except AttributeError:
pass
diff --git a/glances/plugins/glances_ip.py b/glances/plugins/glances_ip.py
index 8a0ff9a6..36cd11c4 100644
--- a/glances/plugins/glances_ip.py
+++ b/glances/plugins/glances_ip.py
@@ -186,7 +186,7 @@ class PublicIpAddress(object):
try:
response = urlopen(url, timeout=self.timeout).read().decode('utf-8')
except Exception as e:
- logger.debug("IP plugin - Can not open URL {0} ({1})".format(url, e))
+ logger.debug("IP plugin - Cannot open URL {} ({})".format(url, e))
queue_target.put(None)
else:
# Request depend on service
diff --git a/glances/plugins/glances_plugin.py b/glances/plugins/glances_plugin.py
index 9d5a4ada..3e5878ab 100644
--- a/glances/plugins/glances_plugin.py
+++ b/glances/plugins/glances_plugin.py
@@ -114,14 +114,14 @@ class GlancesPlugin(object):
"""Init the stats history (dict of GlancesAttribute)."""
if self._history_enable():
init_list = [a['name'] for a in self.get_items_history_list()]
- logger.debug("Stats history activated for plugin {0} (items: {1})".format(self.plugin_name, init_list))
+ logger.debug("Stats history activated for plugin {} (items: {})".format(self.plugin_name, init_list))
return GlancesHistory()
def reset_stats_history(self):
"""Reset the stats history (dict of GlancesAttribute)."""
if self._history_enable():
reset_list = [a['name'] for a in self.get_items_history_list()]
- logger.debug("Reset history for plugin {0} (items: {1})".format(self.plugin_name, reset_list))
+ logger.debug("Reset history for plugin {} (items: {})".format(self.plugin_name, reset_list))
self.stats_history.reset()
def update_stats_history(self):
@@ -202,7 +202,7 @@ class GlancesPlugin(object):
try:
return self._json_dumps({item: s[item]})
except KeyError as e:
- logger.error("Cannot get item history {0} ({1})".format(item, e))
+ logger.error("Cannot get item history {} ({})".format(item, e))
return None
elif isinstance(s, list):
try:
@@ -210,7 +210,7 @@ class GlancesPlugin(object):
# http://stackoverflow.com/questions/4573875/python-get-index-of-dictionary-item-in-list
return self._json_dumps({item: map(itemgetter(item), s)})
except (KeyError, ValueError) as e:
- logger.error("Cannot get item history {0} ({1})".format(item, e))
+ logger.error("Cannot get item history {} ({})".format(item, e))
return None
else:
return None
@@ -429,7 +429,7 @@ class GlancesPlugin(object):
# Read the global section
if config.has_section('global'):
self._limits['history_size'] = config.get_float_value('global', 'history_size', default=28800)
- logger.debug("Load configuration key: {0} = {1}".format('history_size', self._limits['history_size']))
+ logger.debug("Load configuration key: {} = {}".format('history_size', self._limits['history_size']))
# Read the plugin specific section
if config.has_section(self.plugin_name):
diff --git a/glances/plugins/glances_ports.py b/glances/plugins/glances_ports.py
index a4d002a0..13110bdd 100644
--- a/glances/plugins/glances_ports.py
+++ b/glances/plugins/glances_ports.py
@@ -209,7 +209,7 @@ class ThreadScanner(threading.Thread):
try:
ip = socket.gethostbyname(hostname)
except Exception as e:
- logger.debug("{0}: Can not convert {1} to IP address ({2})".format(self.plugin_name, hostname, e))
+ logger.debug("{}: Cannot convert {} to IP address ({})".format(self.plugin_name, hostname, e))
return ip
def _port_scan_icmp(self, port):
@@ -230,7 +230,7 @@ class ThreadScanner(threading.Thread):
else:
port['status'] = False
except Exception as e:
- logger.debug("{0}: Error while pinging host ({2})".format(self.plugin_name, port['host'], e))
+ logger.debug("{}: Error while pinging host {} ({})".format(self.plugin_name, port['host'], e))
return ret
@@ -243,7 +243,7 @@ class ThreadScanner(threading.Thread):
socket.setdefaulttimeout(port['timeout'])
_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except Exception as e:
- logger.debug("{0}: Error while creating scanning socket".format(self.plugin_name))
+ logger.debug("{}: Error while creating scanning socket".format(self.plugin_name))
# Scan port
ip = self._resolv_name(port['host'])
@@ -251,7 +251,7 @@ class ThreadScanner(threading.Thread):
try:
ret = _socket.connect_ex((ip, int(port['port'])))
except Exception as e:
- logger.debug("{0}: Error while scanning port {1} ({2})".format(self.plugin_name, port, e))
+ logger.debug("0}: Error while scanning port {} ({})".format(self.plugin_name, port, e))
else:
if ret == 0:
port['status'] = counter.get()
diff --git a/setup.py b/setup.py
index 7fb20a02..6241351a 100755
--- a/setup.py
+++ b/setup.py
@@ -62,7 +62,7 @@ class tests(Command):
glances_version = get_version()
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 3):
- print('Glances {0} require at least Python 2.7 or 3.3 to run.'.format(glances_version))
+ print('Glances {} require at least Python 2.7 or 3.3 to run.'.format(glances_version))
print('Please install Glances 2.6.2 on your system.')
sys.exit(1)