@cryptotaxi247 / netdata-1 / commits / 8c8f2b67d

strings now formatted via format() instead of '%'

Evgeniy Kostenko committed Aug 3, 2018 at 07:51 UTC 8c8f2b67d2a4f7f3858867f63d0ca179a8f621fa
1 file changed +6 -6
python.d/monit.chart.py
+6 -6
@@ -85,7 +85,7 @@ class Service(UrlService):
85 try:
86 xml = ET.fromstring(data)
87 except ET.ParseError:
88 - self.debug('%s is not a vaild XML page. Please add "_status?format=xml&level=full" to monit URL.' % self.url)
88 + self.debug('{} is not a vaild XML page. Please add "_status?format=xml&level=full" to monit URL.'.format(self.url))
89 return None
90 return xml
91
@@ -111,14 +111,14 @@ class Service(UrlService):
111 self.debug("Skipping service from 'System' category, because it's useless in graphs")
112 continue
113
114 - xpath_query = "./service[@type='%d']" % (service_id)
115 - self.debug("Searching for %s as %s" % (service_category, xpath_query))
114 + xpath_query = "./service[@type='{:d}']".format(service_id)
115 + self.debug("Searching for {} as {}".format(service_category, xpath_query))
116 for service_node in xml.findall(xpath_query):
117
118 service_name = service_node.find('name').text
119 service_status = service_node.find('status').text
120 service_monitoring = service_node.find('monitor').text
121 - self.debug('=> found %s with type=%s, status=%s, monitoring=%s' % (service_name, service_id, service_status, service_monitoring))
121 + self.debug('=> found {} with type={}, status={}, monitoring={}'.format(service_name, service_id, service_status, service_monitoring))
122
123 dimension_key = service_category + '_' + service_name
124 if dimension_key not in self.charts[service_category]:
@@ -133,7 +133,7 @@ class Service(UrlService):
133 if subnode == 'uptime' and int(subnode_value.text) < 0:
134 self.debug('Skipping bugged metrics with negative uptime (monit before v5.16')
135 continue
136 - dimension_key = 'process_%s_%s' % (subnode, service_name)
136 + dimension_key = 'process_{}_{}'.format(subnode, service_name)
137 if dimension_key not in self.charts['process_' + subnode]:
138 self.charts['process_' + subnode].add_dimension([dimension_key, service_name, 'absolute'])
139 data[dimension_key] = int(subnode_value.text)
@@ -142,7 +142,7 @@ class Service(UrlService):
142 subnode_value = service_node.find('./icmp/responsetime')
143 if subnode_value == None:
144 continue
145 - dimension_key = 'host_latency_%s' % (service_name)
145 + dimension_key = 'host_latency_{}'.format(service_name)
146 if dimension_key not in self.charts['host_latency']:
147 self.charts['host_latency'].add_dimension([dimension_key, service_name, 'absolute', 1000, 1000000])
148 data[dimension_key] = float(subnode_value.text) * 1000000